public bool AddMSmsTemplate(MBarcodeTemplate mbarcodetemplate) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddSmsTemplate"; cmd.Parameters.AddWithValue("@PkSrNo", mbarcodetemplate.PkSrNo); cmd.Parameters.AddWithValue("@ScriptData", mbarcodetemplate.ScriptData); cmd.Parameters.AddWithValue("@CompanyNo", mbarcodetemplate.CompanyNo); cmd.Parameters.AddWithValue("@UserID", mbarcodetemplate.UserID); cmd.Parameters.AddWithValue("@UserDate", mbarcodetemplate.UserDate); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { mbarcodetemplate.msg = ObjTrans.ErrorMessage; return(false); } }
public MBarcodeTemplate ModifyMBarcodeTemplateByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from MBarcodeTemplate 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) { MBarcodeTemplate MM = new MBarcodeTemplate(); while (dr.Read()) { MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]); if (!Convert.IsDBNull(dr["TemplateName"])) { MM.TemplateName = Convert.ToString(dr["TemplateName"]); } if (!Convert.IsDBNull(dr["Size"])) { MM.Size = Convert.ToString(dr["Size"]); } if (!Convert.IsDBNull(dr["DefaultScript"])) { MM.DefaultScript = Convert.ToString(dr["DefaultScript"]); } if (!Convert.IsDBNull(dr["ScriptData"])) { MM.ScriptData = Convert.ToString(dr["ScriptData"]); } if (!Convert.IsDBNull(dr["PrinterName"])) { MM.PrinterName = Convert.ToString(dr["PrinterName"]); } if (!Convert.IsDBNull(dr["CompanyNo"])) { MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]); } if (!Convert.IsDBNull(dr["StatusNo"])) { MM.StatusNo = Convert.ToInt64(dr["StatusNo"]); } if (!Convert.IsDBNull(dr["UserID"])) { MM.UserID = Convert.ToInt64(dr["UserID"]); } if (!Convert.IsDBNull(dr["UserDate"])) { MM.UserDate = Convert.ToDateTime(dr["UserDate"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new MBarcodeTemplate()); }