public DataTable search(mdlUsers ObjUsers) { DataTable dt = new DataTable(); dt = ObjdalUsers.search(ObjUsers); return dt; }
public bool UpdateRecord(mdlUsers Objmdlusers) { bool temp = false; try { byte[] intBytes = BitConverter.GetBytes(0x0); SqlCommand cmd = new SqlCommand(insertupdate, Con); cmd.Parameters.Add("@pk_userid", SqlDbType.VarChar, 16).Value = Objmdlusers.pk_UserId; cmd.Parameters.Add("@Password", SqlDbType.VarChar, 16).Value = Objmdlusers.Password; if (Objmdlusers.Sign_Img != null) { cmd.Parameters.Add("@Sign_Img", SqlDbType.Image).Value = Objmdlusers.Sign_Img; } else { cmd.Parameters.Add("@Sign_Img", SqlDbType.Image).Value = intBytes; } cmd.Parameters.Add("@imagePath", SqlDbType.VarChar, 200).Value = Objmdlusers.Sign_Img_Path; cmd.Parameters.Add("@AddUser", SqlDbType.VarChar, 16).Value = Objmdlusers.AddUser; cmd.Parameters.Add("@LoginComp", SqlDbType.VarChar, 50).Value = Objmdlusers.LoginComp; cmd.Parameters.Add("@isDiscontinued", SqlDbType.Bit).Value = Objmdlusers.IsDiscontinue; cmd.Parameters.Add("@Category", SqlDbType.VarChar, 20).Value = Objmdlusers.Categoty; cmd.Parameters.Add("@Type", SqlDbType.VarChar, 50).Value = Objmdlusers.Type; cmd.Parameters.Add("@Value", SqlDbType.VarChar, 50).Value = "Update"; if (Con.State == ConnectionState.Open) { Con.Close(); } Con.Open(); cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); temp = true; if (Con.State == ConnectionState.Open) { Con.Close(); } } catch (Exception ex) { temp = false; MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error); if (Con.State == ConnectionState.Open) { Con.Close(); } } return temp; }
public Boolean SaveNewUser(mdlUsers ObjUsers, string Saveupdate) { if (Saveupdate == "Save") { return ObjdalUsers.SaveRecord(ObjUsers); } else if (Saveupdate == "Update") { return ObjdalUsers.UpdateRecord(ObjUsers); } else { return false; } }
public DataTable search(mdlUsers Objmdlusers) { DataTable dt = new DataTable(); try { if (Con.State == ConnectionState.Open) { Con.Close(); } Con.Open(); SqlDataAdapter da = new SqlDataAdapter(selectdata, Con); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@userid", SqlDbType.VarChar, 9).Value = Objmdlusers.pk_UserId; da.Fill(dt); if (Con.State == ConnectionState.Open) { Con.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error); if (Con.State == ConnectionState.Open) { Con.Close(); } } return dt; }