public MBarcodeSettings ModifyMBarcodeSettingsByID(int ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from MBarcodeSettings where PkSrNo =" + ID; cmd = new SqlCommand(sql, Con); cmd.Connection = Con; Con.Open(); cmd.CommandType = CommandType.Text; SqlDataReader dr; dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.HasRows) { MBarcodeSettings MM = new MBarcodeSettings(); while (dr.Read()) { MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]); if (!Convert.IsDBNull(dr["SettingNo"])) { MM.SettingNo = Convert.ToInt64(dr["SettingNo"]); } if (!Convert.IsDBNull(dr["BarcodeTemplateNo"])) { MM.BarcodeTemplateNo = Convert.ToInt64(dr["BarcodeTemplateNo"]); } if (!Convert.IsDBNull(dr["SettingValue"])) { MM.SettingValue = Convert.ToString(dr["SettingValue"]); } if (!Convert.IsDBNull(dr["IsActive"])) { MM.IsActive = Convert.ToBoolean(dr["IsActive"]); } if (!Convert.IsDBNull(dr["CompanyNo"])) { MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new MBarcodeSettings()); }
public bool DeleteMBarcodeSettings(MBarcodeSettings mbarcodesettings) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteMBarcodeSettings"; cmd.Parameters.AddWithValue("@PkSrNo", mbarcodesettings.PkSrNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { mbarcodesettings.msg = ObjTrans.ErrorMessage; return(false); } }
public bool AddMBarcodeSettings(MBarcodeSettings mbarcodesettings) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddMBarcodeSettings"; cmd.Parameters.AddWithValue("@PkSrNo", mbarcodesettings.PkSrNo); cmd.Parameters.AddWithValue("@SettingNo", mbarcodesettings.SettingNo); cmd.Parameters.AddWithValue("@BarcodeTemplateNo", mbarcodesettings.BarcodeTemplateNo); cmd.Parameters.AddWithValue("@SettingValue", mbarcodesettings.SettingValue); cmd.Parameters.AddWithValue("@IsActive", mbarcodesettings.IsActive); cmd.Parameters.AddWithValue("@CompanyNo", mbarcodesettings.CompanyNo); commandcollection.Add(cmd); return(true); }