예제 #1
0
        public bool AddMFooterDiscountDetails(MFooterDiscountDetails mfooterdiscountdetails)
        {
            SqlCommand cmd;

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

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

            //  cmd.Parameters.AddWithValue("@FooterDiscNo", mfooterdiscountdetails.FooterDiscNo);

            cmd.Parameters.AddWithValue("@Amount", mfooterdiscountdetails.Amount);

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

            cmd.Parameters.AddWithValue("@DiscAmount", mfooterdiscountdetails.DiscAmount);

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

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

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

            commandcollection.Add(cmd);
            return(true);
        }
예제 #2
0
        public MFooterDiscountDetails ModifyMFooterDiscountDetailsByID(int ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MFooterDiscountDetails 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)
            {
                MFooterDiscountDetails MM = new MFooterDiscountDetails();
                while (dr.Read())
                {
                    MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]);
                    if (!Convert.IsDBNull(dr["FooterDiscNo"]))
                    {
                        MM.FooterDiscNo = Convert.ToInt64(dr["FooterDiscNo"]);
                    }
                    if (!Convert.IsDBNull(dr["Amount"]))
                    {
                        MM.Amount = Convert.ToDouble(dr["Amount"]);
                    }
                    if (!Convert.IsDBNull(dr["DiscPercentage"]))
                    {
                        MM.DiscPercentage = Convert.ToDouble(dr["DiscPercentage"]);
                    }
                    if (!Convert.IsDBNull(dr["DiscAmount"]))
                    {
                        MM.DiscAmount = Convert.ToDouble(dr["DiscAmount"]);
                    }
                    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 MFooterDiscountDetails());
        }
예제 #3
0
        public bool DeleteMFooterDiscountDetails(MFooterDiscountDetails mfooterdiscountDetails)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@PkSrNo", mfooterdiscountDetails.PkSrNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mfooterdiscountDetails.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }