public void SetDefault() { Defaultlogin obj = CDefaultlogin_exten.PKId("1", new DAL()); if (obj.Defaultlogin_name != null) { txt_user_name.Text = obj.Defaultlogin_name; txt_user_password.Text = obj.Default_password; login_checkBox.Checked = true; } txt_errorUserPassword.Text = ""; errorcount = 0; }
private void Login_checkBox_CheckedChanged(object sender, EventArgs e) { Defaultlogin obj = CDefaultlogin_exten.PKId("1", new DAL()); if (login_checkBox.Checked == true) { if (obj.Defaultlogin_name != null) { if ((txt_user_name.Text == obj.Defaultlogin_name) && (txt_user_password.Text == obj.Default_password)) { return; } else { obj.Defaultlogin_id = "1"; obj.Defaultlogin_name = txt_user_name.Text; obj.Default_password = txt_user_password.Text; obj.Createon = Current.Datetime; CDefaultlogin.Update(obj, new DAL()); } } else { if ((txt_user_name.Text != "") || (txt_user_password.Text != "")) { obj.Defaultlogin_id = "1"; obj.Defaultlogin_name = txt_user_name.Text; obj.Default_password = txt_user_password.Text; obj.Createon = Current.Datetime; CDefaultlogin.Insert(obj, new DAL()); } } } else if (login_checkBox.Checked == false) { CDefaultlogin.Delete("1", new DAL()); } }