Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void btn_login_Click(object sender, EventArgs e)
- {
- try
- {
- if (!string.IsNullOrEmpty(this.txt_username.Text) && !string.IsNullOrEmpty(this.txt_password.Text))
- {
- using (EZYROBOT_ServicesSoapClient ezyrobot_ServicesSoapClient = new EZYROBOT_ServicesSoapClient())
- {
- CUSTOMER customer = JsonConvert.DeserializeObject<CUSTOMER>(ezyrobot_ServicesSoapClient.GetCustomerByUsernamePassword(this.txt_username.Text.ToLower().Trim(), Services.MD5Hash(this.txt_password.Text.Trim())));
- if (customer != null && customer.USERNAME.ToLower().Equals(this.txt_username.Text.ToLower().Trim()))
- {
- if (this.cb_remember.Checked)
- {
- Settings.Default.Username = this.txt_username.Text.Trim();
- Settings.Default.Password = this.txt_password.Text.Trim();
- Settings.Default.Save();
- }
- else if (!string.IsNullOrEmpty(Settings.Default.Username) && !string.IsNullOrEmpty(Settings.Default.Password))
- {
- Settings.Default.Username = string.Empty;
- Settings.Default.Password = string.Empty;
- Settings.Default.Save();
- }
- using (FRM_Main frm_Main = new FRM_Main())
- {
- base.Hide();
- frm_Main.Closed += delegate(object s, EventArgs args)
- {
- base.Close();
- };
- frm_Main.Customer = customer;
- frm_Main.ShowDialog();
- goto IL_246;
- }
- }
- if (this.cb_remember.Checked)
- {
- Settings.Default.Username = this.txt_username.Text.Trim();
- Settings.Default.Password = this.txt_password.Text.Trim();
- Settings.Default.Save();
- }
- else if (!string.IsNullOrEmpty(Settings.Default.Username) && !string.IsNullOrEmpty(Settings.Default.Password))
- {
- Settings.Default.Username = string.Empty;
- Settings.Default.Password = string.Empty;
- Settings.Default.Save();
- }
- using (FRM_Main frm_Main2 = new FRM_Main())
- {
- base.Hide();
- frm_Main2.Closed += delegate(object s, EventArgs args)
- {
- base.Close();
- };
- frm_Main2.Customer = customer;
- frm_Main2.ShowDialog();
- }
- IL_246:
- goto IL_27A;
- }
- }
- this.lbl_status.Text = "กรุณาใส่ข้อมูลให้ครบถ้วน";
- this.lbl_status.Visible = true;
- this.txt_username.Focus();
- IL_27A:;
- }
- catch
- {
- MessageBox.Show("เกิดข้อผิดพลาด กรุณาติดต่อแอดมินพ่อค้าเกมจิปาฐะ", "เกิดข้อผิดพลาด", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment