public bool AddMRecipeSub(MRecipeSub RecipeSub) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddMRecipeSub"; cmd.Parameters.AddWithValue("@SRecipeID", RecipeSub.SRecipeID); //cmd.Parameters.AddWithValue("@FKMRecipeID", RecipeSub.FKMRecipeID); cmd.Parameters.AddWithValue("@RawGroupNo", RecipeSub.RawGroupNo); cmd.Parameters.AddWithValue("@RawProductID ", RecipeSub.RawProductID); cmd.Parameters.AddWithValue("@Qty", RecipeSub.Qty); cmd.Parameters.AddWithValue("@UomNo", RecipeSub.UomNo); cmd.Parameters.AddWithValue("@ProductQty", RecipeSub.ProductQty); cmd.Parameters.AddWithValue("@Wastageper", RecipeSub.Wastageper); cmd.Parameters.AddWithValue("@WastagePerQty", RecipeSub.WastagePerQty); cmd.Parameters.AddWithValue("@FinalQty", RecipeSub.FinalQty); cmd.Parameters.AddWithValue("@IsActive", RecipeSub.IsActive); commandcollection.Add(cmd); return(true); }
public bool DeleteMRecipeSub(MRecipeSub RecipeSub) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteMRecipeSub"; cmd.Parameters.AddWithValue("@SRecipeID", RecipeSub.SRecipeID); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { RecipeSub.msg = ObjTrans.ErrorMessage; return(false); } }
public bool UpdateMRecipeSub(MRecipeSub RecipeSub) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "UpdateMRecipeSub"; cmd.Parameters.AddWithValue("@SRecipeID", RecipeSub.SRecipeID); commandcollection.Add(cmd); return(true); //if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) //{ // return true; //} //else //{ // RecipeSub.msg = ObjTrans.ErrorMessage; // return false; //} }
public MRecipeSub ModifyMRecipeSubByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from MRecipeSub where SRecipeID =" + 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) { MRecipeSub MM = new MRecipeSub(); while (dr.Read()) { MM.SRecipeID = Convert.ToInt32(dr["SRecipeID"]); if (!Convert.IsDBNull(dr["FKMRecipeID"])) { MM.FKMRecipeID = Convert.ToInt64(dr["FKMRecipeID"]); } if (!Convert.IsDBNull(dr["RawGroupNo"])) { MM.RawGroupNo = Convert.ToInt64(dr["RawGroupNo"]); } if (!Convert.IsDBNull(dr["RawProductID"])) { MM.RawProductID = Convert.ToInt64(dr["RawProductID"]); } if (!Convert.IsDBNull(dr["Qty"])) { MM.Qty = Convert.ToDecimal(dr["Qty"]); } if (!Convert.IsDBNull(dr["UomNo"])) { MM.UomNo = Convert.ToInt64(dr["UomNo"]); } if (!Convert.IsDBNull(dr["WastagePerQty"])) { MM.WastagePerQty = Convert.ToDecimal(dr["WastagePerQty"]); } if (!Convert.IsDBNull(dr["Wastageper"])) { MM.Wastageper = Convert.ToDecimal(dr["Wastageper"]); } if (!Convert.IsDBNull(dr["FinalQty"])) { MM.FinalQty = Convert.ToDecimal(dr["FinalQty"]); } if (!Convert.IsDBNull(dr["IsActive"])) { MM.IsActive = Convert.ToBoolean(dr["IsActive"]); } if (!Convert.IsDBNull(dr["ProductQty"])) { MM.ProductQty = Convert.ToDouble(dr["ProductQty"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new MRecipeSub()); }