protected void btnInsert_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(dlChargeType.SelectedValue) == true ||
                string.IsNullOrEmpty(dlFieldType.SelectedValue) == true ||
                string.IsNullOrEmpty(dlRateValue.SelectedValue) == true)
            {
                ResponseMessage("Fields items required! (Sales type, Field type, Commission rate)");
                dlChargeType.Focus();
                return;
            }

            GetCommissionRatesGrid();
            CustomerCommissionRate commclass;
            commclass = new CustomerCommissionRate();
            commclass.SalesType = dlChargeType.Text;
            commclass.FieldType = dlFieldType.Text;
            commclass.FieldValue = (float)Convert.ToDecimal(dlRateValue.SelectedValue);
            this.commRateListAccessor.AddCommission(commclass);

            gvCommissionRates.DataSource = commRateListAccessor.AllCommission;
            gvCommissionRates.DataBind();
            LoadCommission();
        }
Example #2
0
        public bool FindCommissionListByCustomerCode(string CustomerCode)
        {
            bool bResult = false;

            using (DbManager db = new DbManager())
            {
                try
                {
                    db.Command.CommandText = string.Format(@"select * from CUSTOMER_COMMISSION_TBL 
where CUSTCODE = '{0}'", CustomerCode);

                    using (IDataReader dbReader = (IDataReader)db.ExecuteReader())
                    {
                        CustomerCommissionRate commrate;
                        commList.Clear();
                        while (dbReader.Read())
                        {
                            commrate = new CustomerCommissionRate();
                            commrate.CustomerCode = CustomerCode;
                            commrate.FieldType    = dbReader.GetString(dbReader.GetOrdinal("FIELD_TYPE"));
                            commrate.FieldValue   = (float)Convert.ToDecimal(dbReader.GetValue(dbReader.GetOrdinal("FIELD_VALUE")));
                            commrate.SalesType    = dbReader.GetString(dbReader.GetOrdinal("SALES_TYPE"));

                            commList.Add(commrate);
                            bResult = true;
                        }
                        dbReader.Close();
                    }
                }
                catch (Exception except)
                {
                    throw new Exception("Error in retrieving commission rates!");
                }
            }
            return(bResult);
        }
        public bool FindCommissionListByCustomerCode(string CustomerCode)
        {
            bool bResult = false;

            using (DbManager db = new DbManager())
            {
                try
                {
                    db.Command.CommandText = string.Format(@"select * from CUSTOMER_COMMISSION_TBL
            where CUSTCODE = '{0}'",CustomerCode);

                    using (IDataReader dbReader = (IDataReader)db.ExecuteReader())
                    {
                        CustomerCommissionRate commrate;
                        commList.Clear();
                        while (dbReader.Read())
                        {
                            commrate = new CustomerCommissionRate();
                            commrate.CustomerCode = CustomerCode;
                            commrate.FieldType = dbReader.GetString(dbReader.GetOrdinal("FIELD_TYPE"));
                            commrate.FieldValue = (float)Convert.ToDecimal(dbReader.GetValue(dbReader.GetOrdinal("FIELD_VALUE")));
                            commrate.SalesType = dbReader.GetString(dbReader.GetOrdinal("SALES_TYPE"));

                            commList.Add(commrate);
                            bResult = true;
                        }
                        dbReader.Close();
                    }
                }
                catch (Exception except)
                {
                    throw new Exception("Error in retrieving commission rates!");
                }
            }
            return bResult;
        }
 public void AddCommission(CustomerCommissionRate comm)
 {
     commList.Add(comm);
 }
Example #5
0
 public void AddCommission(CustomerCommissionRate comm)
 {
     commList.Add(comm);
 }
 private void GetCommissionRatesGrid()
 {
     CustomerCommissionRate commclass;
     foreach (GridViewRow grow in gvCommissionRates.Rows)
     {
         commclass = new CustomerCommissionRate();
         commclass.SalesType = grow.Cells[2].Text;
         commclass.FieldType = grow.Cells[3].Text;
         commclass.FieldValue = (float)Convert.ToDecimal(grow.Cells[4].Text);
         commRateListAccessor.AddCommission(commclass);
     }
 }