public TBarCodePrint ModifyTBarCodePrintByID(int ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from TBarCodePrint 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) { TBarCodePrint MM = new TBarCodePrint(); while (dr.Read()) { MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]); if (!Convert.IsDBNull(dr["ItemNo"])) { MM.ItemNo = Convert.ToInt64(dr["ItemNo"]); } if (!Convert.IsDBNull(dr["Quantity"])) { MM.Quantity = Convert.ToInt64(dr["Quantity"]); } if (!Convert.IsDBNull(dr["FKRateSettingNo"])) { MM.FKRateSettingNo = Convert.ToInt64(dr["FKRateSettingNo"]); } if (!Convert.IsDBNull(dr["MacNo"])) { MM.MacNo = Convert.ToInt64(dr["MacNo"]); } if (!Convert.IsDBNull(dr["UserID"])) { MM.UserID = Convert.ToInt64(dr["UserID"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new TBarCodePrint()); }
public bool DeleteTBarCodePrint(TBarCodePrint tbarcodeprint) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteTBarCodePrint"; cmd.Parameters.AddWithValue("@MacNo", tbarcodeprint.MacNo); cmd.Parameters.AddWithValue("@UserID", tbarcodeprint.UserID); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { tbarcodeprint.msg = ObjTrans.ErrorMessage; return(false); } }
public bool AddTBarCodePrint(TBarCodePrint tbarcodeprint) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddTBarCodePrint"; cmd.Parameters.AddWithValue("@PkSrNo", tbarcodeprint.PkSrNo); cmd.Parameters.AddWithValue("@ItemNo", tbarcodeprint.ItemNo); cmd.Parameters.AddWithValue("@Quantity", tbarcodeprint.Quantity); cmd.Parameters.AddWithValue("@FKRateSettingNo", tbarcodeprint.FKRateSettingNo); cmd.Parameters.AddWithValue("@MacNo", tbarcodeprint.MacNo); cmd.Parameters.AddWithValue("@UserID", tbarcodeprint.UserID); commandcollection.Add(cmd); return(true); }