private static Defaultlogin GetOldData(int id, string OldDB) { string q = "USE " + OldDB + "; "; q += "SELECT * FROM " + DEFAULTLOGIN.DEFAULTLOGIN_TBL + " WHERE " + DEFAULTLOGIN.DEFAULTLOGIN_ID + " = '" + id + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Defaultlogin obj = new Defaultlogin { Defaultlogin_name = redr[DEFAULTLOGIN.DEFAULTLOGIN_NAME].ToString(), Default_password = redr[DEFAULTLOGIN.DEFAULT_PASSWORD].ToString(), Createon = redr[DEFAULTLOGIN.CREATEON].ToString(), Notes = redr[DEFAULTLOGIN.NOTES].ToString(), Active_id = redr[DEFAULTLOGIN.ACTIVE_ID].ToString(), User_id = "1" }; return(obj); } return(null); } }
private static void InsertData(Defaultlogin obj, string newDB) { if (CheckData(obj, newDB) == false) { CDefaultlogin.Insert(obj, new DAL()); } ; }
private static string AttachParams(string q, Defaultlogin v) { q = q.Replace("@" + DEFAULTLOGIN.DEFAULTLOGIN_ID + "@", "" + ConvertTO.SqlString(v.Defaultlogin_id) + ""); q = q.Replace("@" + DEFAULTLOGIN.DEFAULTLOGIN_NAME + "@", "" + ConvertTO.SqlString(v.Defaultlogin_name) + ""); q = q.Replace("@" + DEFAULTLOGIN.DEFAULT_PASSWORD + "@", "" + ConvertTO.SqlString(v.Default_password) + ""); q = q.Replace("@" + DEFAULTLOGIN.CREATEON + "@", "" + ConvertTO.SqlDateTime(v.Createon) + ""); return(q); }
public static void Update(Defaultlogin v, DAL dalsession) { string q = "UPDATE " + DEFAULTLOGIN.DEFAULTLOGIN_TBL + " SET"; q += " " + DEFAULTLOGIN.DEFAULTLOGIN_NAME + " = @" + DEFAULTLOGIN.DEFAULTLOGIN_NAME + "@ \r\n "; q += "," + DEFAULTLOGIN.DEFAULT_PASSWORD + " = @" + DEFAULTLOGIN.DEFAULT_PASSWORD + "@ \r\n "; q += "," + DEFAULTLOGIN.CREATEON + " = @" + DEFAULTLOGIN.CREATEON + "@ \r\n "; q += " WHERE " + DEFAULTLOGIN.DEFAULTLOGIN_ID + " = @" + DEFAULTLOGIN.DEFAULTLOGIN_ID + "@ "; q = AttachParams(q, v); dalsession.Execute(q); }
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; }
public static void Insert(Defaultlogin v, DAL dalsession) { string q = " INSERT INTO " + DEFAULTLOGIN.DEFAULTLOGIN_TBL + " ( "; q += " " + DEFAULTLOGIN.DEFAULTLOGIN_ID + " \r\n "; q += "," + DEFAULTLOGIN.DEFAULTLOGIN_NAME + " \r\n "; q += "," + DEFAULTLOGIN.DEFAULT_PASSWORD + " \r\n "; q += "," + DEFAULTLOGIN.CREATEON + " \r\n "; q += " ) VALUES ( "; q += " @" + DEFAULTLOGIN.DEFAULTLOGIN_ID + "@ \r\n "; q += ", @" + DEFAULTLOGIN.DEFAULTLOGIN_NAME + "@ \r\n "; q += ", @" + DEFAULTLOGIN.DEFAULT_PASSWORD + "@ \r\n "; q += ", @" + DEFAULTLOGIN.CREATEON + "@ \r\n "; q += " ) \r\n "; q = AttachParams(q, v); dalsession.Execute(q); }
private static Defaultlogin EntityData(string q) { using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Defaultlogin obj = new Defaultlogin() { Defaultlogin_id = redr[DEFAULTLOGIN.DEFAULTLOGIN_ID].ToString(), Defaultlogin_name = redr[DEFAULTLOGIN.DEFAULTLOGIN_NAME].ToString(), Default_password = redr[DEFAULTLOGIN.DEFAULT_PASSWORD].ToString(), Createon = redr[DEFAULTLOGIN.CREATEON].ToString() }; return(obj); } redr.Close(); return(new Defaultlogin()); } }
private static bool CheckData(Defaultlogin obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + DEFAULTLOGIN.DEFAULTLOGIN_TBL + " WHERE " + DEFAULTLOGIN.DEFAULTLOGIN_NAME + " = '" + obj.Defaultlogin_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Defaultlogin_id = redr[DEFAULTLOGIN.DEFAULTLOGIN_ID].ToString(); CDefaultlogin.Update(obj, new DAL()); return(true); } return(false); } }
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()); } }