Beispiel #1
0
        protected void cmdSaveEditPrice_OnClick(object sender, EventArgs e)
        {
            ProductPriceInfo price = new ProductPriceInfo();

            price.UnitCost         = taxPriceUnitCost.Value;
            price.OriginalUnitCost = taxPriceOriginalUnitCost.Value;
            price.TaxPercent       = Convert.ToDecimal(txtPriceTaxPercent.Text.Trim());
            price.Startdate        = dtpPriceStartdate.SelectedDate;
            price.EndDate          = dtpPriceEndDate.SelectedDate;
            price.RoleId           = Convert.ToInt32(ddlPriceRoleId.SelectedValue);
            price.SimpleProductId  = ProductId;

            int productPriceId = Convert.ToInt32(hidProductPriceId.Value);

            if (productPriceId < 0)
            {
                Controller.NewProductPrice(price);
            }
            else
            {
                price.ProductPriceId = productPriceId;
                Controller.UpdateProductPrice(price);
            }

            grdPriceList.DataSource = ProductPrices;
            grdPriceList.DataBind();

            pnlPriceList.Visible = true;
            pnlPriceEdit.Visible = false;
        }
Beispiel #2
0
        protected void grdPriceList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                case "Select":
                    int index          = Convert.ToInt32(e.CommandArgument);
                    int productPriceId = (int)grdPriceList.DataKeys[index].Value;

                    ProductPriceInfo price = Controller.GetProductPriceById(productPriceId);

                    hidProductPriceId.Value        = productPriceId.ToString();
                    txtPriceTaxPercent.Text        = price.TaxPercent.ToString();
                    taxPriceUnitCost.Value         = price.UnitCost;
                    taxPriceUnitCost.Mode          = "net";
                    taxPriceOriginalUnitCost.Value = price.OriginalUnitCost;
                    taxPriceOriginalUnitCost.Mode  = "net";
                    dtpPriceStartdate.SelectedDate = price.Startdate;
                    dtpPriceEndDate.SelectedDate   = price.EndDate;
                    ddlPriceRoleId.SelectedValue   = price.RoleId.ToString();

                    pnlPriceEdit.Visible = true;
                    pnlPriceList.Visible = false;
                    break;

                case "Insert":

                    hidProductPriceId.Value        = "-1";
                    txtPriceTaxPercent.Text        = 0.0m.ToString();
                    taxPriceUnitCost.Value         = 0.00m;;
                    taxPriceUnitCost.Mode          = "net";
                    taxPriceOriginalUnitCost.Value = 0.00m;
                    taxPriceOriginalUnitCost.Mode  = "net";
                    dtpPriceStartdate.SelectedDate = DateTime.Now;
                    dtpPriceEndDate.SelectedDate   = null;
                    ddlPriceRoleId.SelectedValue   = "-1";

                    pnlPriceEdit.Visible = true;
                    pnlPriceList.Visible = false;
                    break;
                }
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #3
0
 public abstract void UpdateProductPrice(ProductPriceInfo ProductPrice);
Beispiel #4
0
 public abstract int NewProductPrice(ProductPriceInfo ProductPrice);