public bool AddTSeasonalItems(TSeasonalItems tseasonalitems) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddTSeasonalItems"; cmd.Parameters.AddWithValue("@PKSrNo", tseasonalitems.PKSrNo); cmd.Parameters.AddWithValue("@BillNo", tseasonalitems.BillNo); cmd.Parameters.AddWithValue("@ItemName", tseasonalitems.ItemName); cmd.Parameters.AddWithValue("@MRP", tseasonalitems.MRP); cmd.Parameters.AddWithValue("@Qty", tseasonalitems.Qty); cmd.Parameters.AddWithValue("@Barcode", tseasonalitems.Barcode); cmd.Parameters.AddWithValue("@IsPrint", tseasonalitems.IsPrint); cmd.Parameters.AddWithValue("@UserID", tseasonalitems.UserID); cmd.Parameters.AddWithValue("@UserDate", tseasonalitems.UserDate); commandcollection.Add(cmd); return(true); }
public bool DeleteTSeasonalItems(TSeasonalItems tseasonalitems) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteTSeasonalItems"; cmd.Parameters.AddWithValue("@PKSrNo", tseasonalitems.PKSrNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { tseasonalitems.msg = ObjTrans.ErrorMessage; return(false); } }
public TSeasonalItems ModifyTSeasonalItemsByID(int ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from TSeasonalItems 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) { TSeasonalItems MM = new TSeasonalItems(); while (dr.Read()) { MM.PKSrNo = Convert.ToInt32(dr["PKSrNo"]); if (!Convert.IsDBNull(dr["BillNo"])) { MM.BillNo = Convert.ToInt64(dr["BillNo"]); } if (!Convert.IsDBNull(dr["ItemName"])) { MM.ItemName = Convert.ToString(dr["ItemName"]); } if (!Convert.IsDBNull(dr["MRP"])) { MM.MRP = Convert.ToDouble(dr["MRP"]); } if (!Convert.IsDBNull(dr["Qty"])) { MM.Qty = Convert.ToDouble(dr["Qty"]); } if (!Convert.IsDBNull(dr["Barcode"])) { MM.Barcode = Convert.ToString(dr["Barcode"]); } if (!Convert.IsDBNull(dr["IsPrint"])) { MM.IsPrint = Convert.ToBoolean(dr["IsPrint"]); } if (!Convert.IsDBNull(dr["UserID"])) { MM.UserID = Convert.ToInt64(dr["UserID"]); } if (!Convert.IsDBNull(dr["UserDate"])) { MM.UserDate = Convert.ToDateTime(dr["UserDate"]); } if (!Convert.IsDBNull(dr["ModifyBy"])) { MM.ModifyBy = Convert.ToString(dr["ModifyBy"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new TSeasonalItems()); }