예제 #1
0
        public List <MarkupStructureMasterModel> GetAllMarkupStructure()
        {
            List <eSunSpeedDomain.MarkupStructureMasterModel> lstMarkup = new List <MarkupStructureMasterModel>();

            eSunSpeedDomain.MarkupStructureMasterModel objMS;

            string Query = "SELECT * FROM `markupstructure`";

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objMS = new MarkupStructureMasterModel();

                objMS.Ms_id          = Convert.ToInt32(dr["MS_Id"]);
                objMS.StructureName  = dr["StructureName"].ToString();
                objMS.SimpleDiscount = Convert.ToBoolean(dr["SimpleDiscount"]);
                objMS.CompoundMarkupwithSameNature  = Convert.ToBoolean(dr["CM_withSameNature"]);
                objMS.CompoundMarkupDifferentNature = Convert.ToBoolean(dr["CM_DifferentNature"]);
                objMS.NoOfMarkups             = dr["NoOfMarkups"] == null || dr["NoOfMarkups"].ToString() == "" ? 0 : Convert.ToInt32(dr["NoOfMarkups"]);
                objMS.SpecifyCaptionForMarkup = dr["SpecifyCaptionForMarkup"].ToString();
                objMS.AbsoluteDiscount        = Convert.ToBoolean(dr["AbsoluteAmount"]);
                objMS.PerMainQty    = Convert.ToBoolean(dr["PerMainQty"]);
                objMS.Percentage    = Convert.ToBoolean(dr["Percentage"]);
                objMS.PerAltQty     = Convert.ToBoolean(dr["PerAltQty"]);
                objMS.ItemPrice     = Convert.ToBoolean(dr["ItemPrice"]);
                objMS.ItemMRP       = Convert.ToBoolean(dr["ItemMRP"]);
                objMS.ItemAmount    = Convert.ToBoolean(dr["ItemAmount"]);
                objMS.ItemListPrice = Convert.ToBoolean(dr["ItemListPrice"]);

                lstMarkup.Add(objMS);
            }

            return(lstMarkup);
        }
예제 #2
0
        public bool SaveMarkupStructure(MarkupStructureMasterModel objMS)
        {
            string Query   = string.Empty;
            bool   isSaved = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@StructureName", objMS.StructureName));
                paramCollection.Add(new DBParameter("@SimpleDiscount", Convert.ToBoolean(objMS.SimpleDiscount), System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@CompoundMarkupwithSameNature", objMS.CompoundMarkupwithSameNature, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@CompoundMarkupDifferentNature", objMS.CompoundMarkupDifferentNature, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@NoOfMarkups", objMS.NoOfMarkups, System.Data.DbType.Int32));
                paramCollection.Add(new DBParameter("@SpecifyCaptionForMarkup", objMS.SpecifyCaptionForMarkup));
                paramCollection.Add(new DBParameter("@AbsoluteAmount", objMS.AbsoluteDiscount, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@PerMainQty", objMS.PerMainQty, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@Percentage", objMS.Percentage, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@PerAltQty", objMS.PerAltQty, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@ItemPrice", objMS.ItemPrice, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@ItemMRP", objMS.ItemMRP, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@ItemAmount", objMS.ItemAmount, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@ItemListPrice", objMS.ItemListPrice, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));

                System.Data.IDataReader dr =
                    _dbHelper.ExecuteDataReader("spInsertMarkupStructure", _dbHelper.GetConnObject(), paramCollection, System.Data.CommandType.StoredProcedure);
                int id = 0;
                dr.Read();
                id = Convert.ToInt32(dr[0]);
                SaveAccountPosting(objMS.ListofAccountPosting, id);
            }
            catch (Exception ex)
            {
                isSaved = false;
                throw ex;
            }

            return(isSaved);
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            MarkupStructureMasterModel objmarkup = new MarkupStructureMasterModel();

            objmarkup.StructureName  = tbxStrName.Text.Trim() == null ? string.Empty : tbxStrName.Text.Trim();
            objmarkup.SimpleDiscount = false;
            objmarkup.CompoundMarkupwithSameNature  = false;
            objmarkup.CompoundMarkupDifferentNature = false;
            if (rbnMarkupType.SelectedIndex == 0)
            {
                objmarkup.SimpleDiscount = true;
            }
            if (rbnMarkupType.SelectedIndex == 1)
            {
                objmarkup.CompoundMarkupwithSameNature = true;
            }
            if (rbnMarkupType.SelectedIndex == 2)
            {
                objmarkup.CompoundMarkupDifferentNature = true;
            }
            objmarkup.NoOfMarkups      = Convert.ToInt32(tbxNoDiscounts.Text.Trim() == null ?"0": tbxNoDiscounts.Text.Trim());
            objmarkup.AbsoluteDiscount = false;
            objmarkup.PerMainQty       = false;
            objmarkup.Percentage       = false;
            objmarkup.PerAltQty        = false;
            if (rbnAccountMarkup.SelectedIndex == 0)
            {
                objmarkup.AbsoluteDiscount = true;
            }
            if (rbnAccountMarkup.SelectedIndex == 1)
            {
                objmarkup.PerMainQty = true;
            }
            if (rbnAccountMarkup.SelectedIndex == 2)
            {
                objmarkup.Percentage = true;
            }
            if (rbnAccountMarkup.SelectedIndex == 3)
            {
                objmarkup.PerAltQty = true;
            }
            objmarkup.ItemPrice  = false;
            objmarkup.ItemMRP    = false;
            objmarkup.ItemAmount = false;
            objmarkup.ItemPrice  = false;
            if (rbnPercentage.SelectedIndex == 0)
            {
                objmarkup.ItemPrice = true;
            }
            if (rbnPercentage.SelectedIndex == 1)
            {
                objmarkup.ItemMRP = true;
            }
            if (rbnPercentage.SelectedIndex == 2)
            {
                objmarkup.ItemAmount = true;
            }
            if (rbnPercentage.SelectedIndex == 3)
            {
                objmarkup.ItemPrice = true;
            }
            objmarkup.SpecifyCaptionForMarkup = tbxCaptionMarkup.Text.Trim() == null ? string.Empty : tbxCaptionMarkup.Text.Trim();

            DSAccountPosting        objdsAccount;
            List <DSAccountPosting> lstAccountPost = new List <DSAccountPosting>();

            for (int i = 0; i < dvgMarkupStrDetails.DataRowCount; i++)
            {
                DataRow row = dvgMarkupStrDetails.GetDataRow(i);
                objdsAccount                 = new DSAccountPosting();
                objdsAccount.AccountPost     = Convert.ToBoolean(row["AccountPost"].ToString() == "Y"?true:false);
                objdsAccount.AccountHeadPost = row["AccountHeadPost"].ToString() == null ? string.Empty : row["AccountHeadPost"].ToString();
                objdsAccount.AffectsGoods    = Convert.ToBoolean(row["AffectsGoods"].ToString() == "Y"?true:false);

                lstAccountPost.Add(objdsAccount);
            }
            objmarkup.ListofAccountPosting = lstAccountPost;
            bool IsSaved = objMakBL.SaveMarkupStructure(objmarkup);

            if (IsSaved)
            {
                MessageBox.Show("Saved Sussfully");
            }
        }