Esempio n. 1
0
        public bool DeleteMFooterDiscount(MFooterDiscount mfooterdiscount)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@PkSrNo", mfooterdiscount.PkSrNo);
            cmd.Parameters.AddWithValue("@IsActive", mfooterdiscount.IsActive);

            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mfooterdiscount.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Esempio n. 2
0
        public bool AddMFooterDiscount(MFooterDiscount mfooterdiscount)
        {
            SqlCommand cmd;

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

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

            cmd.Parameters.AddWithValue("@FooterDiscUserNo", mfooterdiscount.FooterDiscUserNo);

            cmd.Parameters.AddWithValue("@FooterDiscDate", mfooterdiscount.FooterDiscDate);

            cmd.Parameters.AddWithValue("@PeriodFrom", mfooterdiscount.PeriodFrom);

            cmd.Parameters.AddWithValue("@PeriodTo", mfooterdiscount.PeriodTo);

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

            cmd.Parameters.AddWithValue("@DiscType", mfooterdiscount.DiscType);

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

            cmd.Parameters.AddWithValue("@UserID", mfooterdiscount.UserID);

            cmd.Parameters.AddWithValue("@UserDate", mfooterdiscount.UserDate);

            SqlParameter outParameter = new SqlParameter();

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

            commandcollection.Add(cmd);
            return(true);
        }
Esempio n. 3
0
        public MFooterDiscount ModifyMFooterDiscountByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MFooterDiscount 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)
            {
                MFooterDiscount MM = new MFooterDiscount();
                while (dr.Read())
                {
                    MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]);
                    if (!Convert.IsDBNull(dr["FooterDiscUserNo"]))
                    {
                        MM.FooterDiscUserNo = Convert.ToInt64(dr["FooterDiscUserNo"]);
                    }
                    if (!Convert.IsDBNull(dr["FooterDiscDate"]))
                    {
                        MM.FooterDiscDate = Convert.ToDateTime(dr["FooterDiscDate"]);
                    }
                    if (!Convert.IsDBNull(dr["PeriodFrom"]))
                    {
                        MM.PeriodFrom = Convert.ToDateTime(dr["PeriodFrom"]);
                    }
                    if (!Convert.IsDBNull(dr["PeriodTo"]))
                    {
                        MM.PeriodTo = Convert.ToDateTime(dr["PeriodTo"]);
                    }
                    if (!Convert.IsDBNull(dr["DiscType"]))
                    {
                        MM.DiscType = Convert.ToInt64(dr["DiscType"]);
                    }
                    if (!Convert.IsDBNull(dr["IsActive"]))
                    {
                        MM.IsActive = Convert.ToInt32(dr["IsActive"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    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 MFooterDiscount());
        }