Beispiel #1
0
        public bool AddMItemBrandDiscount(MItemBrandDiscount mitembranddiscount)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddMItemBrandDiscount";

            cmd.Parameters.AddWithValue("@PkSrNo", mitembranddiscount.PkSrNo);

            //   cmd.Parameters.AddWithValue("@ItemDiscNo", mitembranddiscount.ItemDiscNo);

            cmd.Parameters.AddWithValue("@StockGroupNo", mitembranddiscount.StockGroupNo);

            cmd.Parameters.AddWithValue("@DiscPercentage", mitembranddiscount.DiscPercentage);

            cmd.Parameters.AddWithValue("@IsActive", mitembranddiscount.IsActive);

            cmd.Parameters.AddWithValue("@CompanyNo", mitembranddiscount.CompanyNo);

            SqlParameter outParameter = new SqlParameter();

            outParameter.ParameterName = "@ReturnID";
            outParameter.Direction     = ParameterDirection.Output;
            outParameter.DbType        = DbType.Int32;
            cmd.Parameters.Add(outParameter);

            commandcollection.Add(cmd);
            return(true);
        }
Beispiel #2
0
        public MItemBrandDiscount ModifyMItemBrandDiscountByID(int ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MItemBrandDiscount where CompanyNo=" + DBGetVal.FirmNo + " And 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)
            {
                MItemBrandDiscount MM = new MItemBrandDiscount();
                while (dr.Read())
                {
                    MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]);
                    if (!Convert.IsDBNull(dr["ItemDiscNo"]))
                    {
                        MM.ItemDiscNo = Convert.ToInt64(dr["ItemDiscNo"]);
                    }
                    if (!Convert.IsDBNull(dr["StockGroupNo"]))
                    {
                        MM.StockGroupNo = Convert.ToInt64(dr["StockGroupNo"]);
                    }
                    if (!Convert.IsDBNull(dr["DiscPercentage"]))
                    {
                        MM.DiscPercentage = Convert.ToInt64(dr["DiscPercentage"]);
                    }
                    if (!Convert.IsDBNull(dr["IsActive"]))
                    {
                        MM.IsActive = Convert.ToBoolean(dr["IsActive"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MItemBrandDiscount());
        }
Beispiel #3
0
        public bool DeleteMItemBrandDiscount(MItemBrandDiscount mitembranddiscount)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "DeleteMItemBrandDiscount";

            cmd.Parameters.AddWithValue("@PkSrNo", mitembranddiscount.PkSrNo);


            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }