Exemple #1
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);
            }
        }