public bool AddMRackDetails(MRackDetails MRackDetails) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddMRackDetails"; cmd.Parameters.AddWithValue("@RackDetailsNo", MRackDetails.RackDetailsNo); cmd.Parameters.AddWithValue("@UOMLNo", MRackDetails.UOMLNo); cmd.Parameters.AddWithValue("@FkRackNo", MRackDetails.FkRackNo); cmd.Parameters.AddWithValue("@ItemNo", MRackDetails.ItemNo); cmd.Parameters.AddWithValue("@ToQty", MRackDetails.ToQty); cmd.Parameters.AddWithValue("@IsActive", MRackDetails.IsActive); cmd.Parameters.AddWithValue("@UserID", MRackDetails.UserID); cmd.Parameters.AddWithValue("@UserDate", MRackDetails.UserDate); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { MRackDetails.msg = ObjTrans.ErrorMessage; return(false); } }
public MRackDetails ModifyMRackDetailsByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from MRackDetails where RackDetailsNo =" + 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) { MRackDetails MM = new MRackDetails(); while (dr.Read()) { MM.RackDetailsNo = Convert.ToInt32(dr["RackDetailsNo"]); if (!Convert.IsDBNull(dr["UOMLNo"])) { MM.UOMLNo = Convert.ToInt64(dr["UOMLNo"]); } if (!Convert.IsDBNull(dr["FkRackNo"])) { MM.FkRackNo = Convert.ToInt64(dr["FkRackNo"]); } if (!Convert.IsDBNull(dr["ItemNo"])) { MM.ItemNo = Convert.ToInt64(dr["ItemNo"]); } if (!Convert.IsDBNull(dr["ToQty"])) { MM.ToQty = Convert.ToDouble(dr["ToQty"]); } if (!Convert.IsDBNull(dr["IsActive"])) { MM.IsActive = Convert.ToBoolean(dr["IsActive"]); } 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 MRackDetails()); }
public bool DeleteMRackDetails(MRackDetails MRackDetails) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteMRackDetails"; cmd.Parameters.AddWithValue("@RackDetailsNo", MRackDetails.RackDetailsNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { MRackDetails.msg = ObjTrans.ErrorMessage; return(false); } }