protected void RadGridOrderTypes_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is OrderTypeBO) { OrderTypeBO objOrderType = (OrderTypeBO)item.DataItem; HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); linkEdit.Attributes.Add("qid", objOrderType.ID.ToString()); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); linkDelete.Attributes.Add("qid", objOrderType.ID.ToString()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(0, "OrderDetail", "OrderType", objOrderType.ID.ToString()); linkDelete.Visible = objReturnInt.RetVal == 1; //linkDelete.Visible = (objOrderType.OrderDetailsWhereThisIsOrderType.Count == 0) ? true : false; //linkDelete.Visible = (objOrderType.ReservationsWhereThisIsOrderType.Count == 0); } } }
protected void btnChange_ServerClick(object sender, EventArgs e) { decimal duty = (!string.IsNullOrEmpty(this.txtDutyRate.Text) && decimal.TryParse(this.txtDutyRate.Text, out duty) == true) ? decimal.Parse(this.txtDutyRate.Text) : 0; decimal exchange = (!string.IsNullOrEmpty(this.txtExchangeRate.Text) && decimal.TryParse(this.txtExchangeRate.Text, out exchange) == true) ? decimal.Parse(this.txtExchangeRate.Text) : 0; try { ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = CostSheetBO.UpdateDutyRateExchnageRate(duty, exchange); if (objReturnInt.RetVal == 0) { IndicoLogging.log.Error("btnChange_ServerClick : Error occured while Updating the Duty Rate and Exchange Rate ViewCostSheet.aspx, SPC_UpdateDutyRateExchnageRateCostSheet"); } } catch (Exception ex) { // Log the error IndicoLogging.log.Error("btnChange_ServerClick : Error occured while Updating the Duty Rate and Exchange Rate ViewCostSheet.aspx", ex); } this.PopulateDataGrid(); this.txtDutyRate.Text = string.Empty; this.txtExchangeRate.Text = string.Empty; }
protected void RadGridPaymentTerms_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is PaymentMethodBO) { PaymentMethodBO objPaymentTerm = (PaymentMethodBO)item.DataItem; HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); linkEdit.Attributes.Add("qid", objPaymentTerm.ID.ToString()); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); linkDelete.Attributes.Add("qid", objPaymentTerm.ID.ToString()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(0, "Order", "PaymentMethod", objPaymentTerm.ID.ToString()); linkDelete.Visible = objReturnInt.RetVal == 1; //linkDelete.Visible = (objPaymentTerm.OrdersWhereThisIsPaymentMethod.Count == 0) ? true : false; //linkDelete.Visible = true;//PBD : TODO (objPaymentTerm.ReservationsWhereThisIsPaymentMethod.Count == 0); } } }
protected void btnSaveClonePriceMarkupLabel_Click(object sender, EventArgs e) { if (this.IsNotRefresh) { ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); if (this.ddlExistDistributors.SelectedValue != null && this.txtMarkupLabel.Text != string.Empty) { objReturnInt = PriceMarkupLabelBO.CloneLabelPriceMarkup(int.Parse(this.ddlExistDistributors.SelectedValue), this.txtMarkupLabel.Text); if (objReturnInt.RetVal == 1) { ViewState["ClonePriceMarkup"] = false; Response.Redirect("~/ViewPriceMarckups.aspx"); } else { CustomValidator customValidator = new CustomValidator(); customValidator.ErrorMessage = "Insertion Failed Price Markup Label"; customValidator.IsValid = false; customValidator.EnableClientScript = false; this.ClonevalidationSummary.Controls.Add(customValidator); ViewState["ClonePriceMarkup"] = true; } } } }
//protected void cvGivenName_Validate(object sender, ServerValidateEventArgs e) //{ // if (!string.IsNullOrEmpty(this.txtGivenName.Text)) // { // e.IsValid = (this.txtGivenName.Text.Length > 32) ? false : true; // } //} //protected void cvLastName_Validate(object sender, ServerValidateEventArgs e) //{ // if (!string.IsNullOrEmpty(this.txtFamilyName.Text)) // { // e.IsValid = (this.txtFamilyName.Text.Length > 32) ? false : true; // } //} //protected void cvName_ServerValidate(object source, ServerValidateEventArgs e) //{ // List<CompanyBO> lstCompany = new List<CompanyBO>(); // if (!string.IsNullOrEmpty(this.txtName.Text)) // { // lstCompany = (from o in (new CompanyBO()).GetAllObject() // where o.ID != this.QueryID && o.Name.Trim().ToLower() == this.txtName.Text.Trim().ToLower() // select o).ToList(); // } // e.IsValid = !(lstCompany.Count > 0); //} protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args) { try { ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(this.QueryID, "Company", "Name", this.txtName.Text); args.IsValid = objReturnInt.RetVal == 1; } catch (Exception ex) { IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on AddEditDistributor.aspx", ex); } }
protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args) { try { int printertypeId = int.Parse(this.hdnSelectedPrinterTypeID.Value.Trim()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(printertypeId, "PrinterType", "Name", this.txtPrinterTypeName.Text); args.IsValid = objReturnInt.RetVal == 1; } catch (Exception ex) { IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on ViewPrinterTypes.aspx", ex); } }
//protected void dgSuppliers_PageIndexChanged(object source, DataGridPageChangedEventArgs e) //{ // // Set page index // this.dgSuppliers.CurrentPageIndex = e.NewPageIndex; // this.PopulateDataGrid(); //} //protected void dgSuppliers_SortCommand(object source, DataGridSortCommandEventArgs e) //{ // string sortDirection = String.Empty; // if (!SortExpression.ToUpper().StartsWith(e.SortExpression) && !SortExpression.ToUpper().Trim().EndsWith("ASC")) // { // sortDirection = " asc"; // } // else // { // sortDirection = (SortExpression.ToUpper().EndsWith("DESC")) ? " asc" : " desc"; // } // this.SortExpression = e.SortExpression + sortDirection; // this.PopulateDataGrid(); // foreach (DataGridColumn col in this.dgSuppliers.Columns) // { // if (col.Visible && col.SortExpression == e.SortExpression) // { // col.HeaderStyle.CssClass = "selected " + ((sortDirection.ToUpper() != " DESC") ? "sortDown" : "sortUp"); // } // else // { // col.HeaderStyle.CssClass = ""; // } // } //} protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args) { try { int supplierid = int.Parse(this.hdnSelectedSupplierID.Value.Trim()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(supplierid, "Supplier", "Name", this.txtSupplierName.Text); args.IsValid = objReturnInt.RetVal == 1; } catch (Exception ex) { IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on AddEditClient.aspx", ex); } }
//protected void dataGridAgeGroup_PageIndexChanged(object source, DataGridPageChangedEventArgs e) //{ // // Set page index // this.dataGridAgeGroup.CurrentPageIndex = e.NewPageIndex; // this.PopulateDataGrid(); //} //protected void dataGridAgeGroup_SortCommand(object source, DataGridSortCommandEventArgs e) //{ // string sortDirection = String.Empty; // if (!SortExpression.ToUpper().StartsWith(e.SortExpression) && !SortExpression.ToUpper().Trim().EndsWith("ASC")) // { // sortDirection = " asc"; // } // else // { // sortDirection = (SortExpression.ToUpper().EndsWith("DESC")) ? " asc" : " desc"; // } // this.SortExpression = e.SortExpression + sortDirection; // this.PopulateDataGrid(); // foreach (DataGridColumn col in this.dataGridAgeGroup.Columns) // { // if (col.Visible && col.SortExpression == e.SortExpression) // { // col.HeaderStyle.CssClass = "selected " + ((sortDirection.ToUpper() != " DESC") ? "sortDown" : "sortUp"); // } // else // { // col.HeaderStyle.CssClass = ""; // } // } //} protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args) { try { int itemID = int.Parse(this.hdnSelectedAgeGroupID.Value.Trim()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(itemID, "OrderDetailStatus", "Name", this.txtName.Text); args.IsValid = objReturnInt.RetVal == 1; } catch (Exception ex) { IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on ViewOrderDetailStatus.aspx", ex); } }
//protected void dataGridAgeGroup_PageIndexChanged(object source, DataGridPageChangedEventArgs e) //{ // // Set page index // this.dataGridAgeGroup.CurrentPageIndex = e.NewPageIndex; // this.PopulateDataGrid(); //} //protected void dataGridAgeGroup_SortCommand(object source, DataGridSortCommandEventArgs e) //{ // string sortDirection = String.Empty; // if (!SortExpression.ToUpper().StartsWith(e.SortExpression) && !SortExpression.ToUpper().Trim().EndsWith("ASC")) // { // sortDirection = " asc"; // } // else // { // sortDirection = (SortExpression.ToUpper().EndsWith("DESC")) ? " asc" : " desc"; // } // this.SortExpression = e.SortExpression + sortDirection; // this.PopulateDataGrid(); // foreach (DataGridColumn col in this.dataGridAgeGroup.Columns) // { // if (col.Visible && col.SortExpression == e.SortExpression) // { // col.HeaderStyle.CssClass = "selected " + ((sortDirection.ToUpper() != " DESC") ? "sortDown" : "sortUp"); // } // else // { // col.HeaderStyle.CssClass = ""; // } // } //} //protected void cvDistributor_ServerValidate(object source, ServerValidateEventArgs args) //{ // if (rbClient.Checked) // { // args.IsValid = int.Parse(ddlClient.SelectedValue) > 0; // cvDistributor.ErrorMessage = "Client is required."; // } // else if (rbDistributor.Checked) // { // args.IsValid = int.Parse(ddlDistributor.SelectedValue) > 0; // cvDistributor.ErrorMessage = "Distributor is required."; // } //} protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args) { try { int shipmentaddressid = int.Parse(this.hdnSelectedShipmentAddressID.Value.Trim()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(shipmentaddressid, "DistributorClientAddress", "Address", this.txtShipToAddress.Text); args.IsValid = objReturnInt.RetVal == 1; } catch (Exception ex) { IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on ViewShipmentAddresses.aspx", ex); } }
//protected void btnCombinedSave_ServerClick(object sender, EventArgs e) //{ // ResetViewStateValues(); // if (this.IsNotRefresh) // { // int itemId = int.Parse(this.hdnSelectedFabricCodeID.Value.ToString().Trim()); // if (!string.IsNullOrEmpty(this.txtFabricCode.Text)) // { // List<FabricCodeBO> lstFabricCodes = (List<FabricCodeBO>)Session["ListFabricCodes"]; // lstFabricCodes = lstFabricCodes.Where(m => m.Code == this.txtFabricCode.Text).ToList(); // if (lstFabricCodes.Any()) // { // if (itemId == 0 || !lstFabricCodes.Select(m => m.ID).Contains(itemId)) // { // CustomValidator cv = new CustomValidator(); // cv.IsValid = false; // cv.ValidationGroup = "valCombined"; // cv.ErrorMessage = "Fabric Code exists in the system."; // Page.Validators.Add(cv); // } // } // } // if (Page.IsValid) // { // this.ProcessForm(itemId, false, false); // Response.Redirect("~/ViewFabricCodes.aspx"); // } // this.lblPopupHeaderText.Text = ((itemId > 0) ? "Edit " : "New ") + "Fabric Code"; // ViewState["IsPageValidCombined"] = (Page.IsValid); // } //} //protected void dgvAddEditFabrics_ItemDataBound(object sender, DataGridItemEventArgs e) //{ // DataGridItem item = e.Item; // if (item.ItemIndex > -1 && item.DataItem is KeyValuePair<int, KeyValuePair<int, string>>) // KeyValuePair<Tuple<int, int>, int>) // { // //KeyValuePair<Tuple<int, int>, int> kv = (KeyValuePair<Tuple<int, int>, int>)item.DataItem; // KeyValuePair<int, KeyValuePair<int, string>> kv = (KeyValuePair<int, KeyValuePair<int, string>>)item.DataItem; // //Literal litVFID = (Literal)item.FindControl("litVFID"); // Literal litID = (Literal)item.FindControl("litID"); // Literal litFabricTypeID = (Literal)item.FindControl("litFabricTypeID"); // Literal litFabricType = (Literal)item.FindControl("litFabricType"); // Literal litCode = (Literal)item.FindControl("litCode"); // Literal litFabricNickName = (Literal)item.FindControl("litFabricNickName"); // Literal litFabricSupplier = (Literal)item.FindControl("litFabricSupplier"); // TextBox txtWhere = (TextBox)item.FindControl("txtWhere"); // litFabricTypeID.Text = kv.Key.ToString(); // int value = kv.Key; // FabricType type = (FabricType)value; // litFabricType.Text = type.ToString(); // //populate FabricCodeType dropdown // //DropDownList ddlfabricCodeType = (DropDownList)item.FindControl("ddlfabricCodeType"); // //ddlfabricCodeType.Items.Add(new ListItem("Select Fabric Type", "0")); // //foreach (FabricCodeTypeBO fabCodeType in (new FabricCodeTypeBO()).SearchObjects()) // //{ // // ListItem listItemcolor = new ListItem(fabCodeType.Name, fabCodeType.ID.ToString()); // // ddlfabricCodeType.Items.Add(listItemcolor); // //} // //if (kv.Key.Item1 > 0) // //{ // // VisualLayoutFabricBO objVLF = new VisualLayoutFabricBO(); // // objVLF.ID = kv.Key.Item1; // // objVLF.GetObject(); // // litVFID.Text = objVLF.ID.ToString(); // // litID.Text = objVLF.Fabric.ToString(); // // litCode.Text = objVLF.objFabric.Code; // // litFabricNickName.Text = objVLF.objFabric.NickName; // // litFabricSupplier.Text = objVLF.objFabric.objSupplier.Name; // // ddlfabricCodeType.Items.FindByValue(kv.Key.Item2.ToString()).Selected = true; // //} // //else // //{ // FabricCodeBO objFC = new FabricCodeBO(); // objFC.ID = kv.Value.Key; // objFC.GetObject(); // txtWhere.Text = kv.Value.Value; // //litVFID.Text = "0"; // litID.Text = objFC.ID.ToString(); // litCode.Text = objFC.Code; // litFabricNickName.Text = objFC.NickName; // litFabricSupplier.Text = (objFC.Supplier.HasValue && objFC.Supplier.Value > 0) ? objFC.objSupplier.Name : string.Empty; // // ddlfabricCodeType.Items.FindByValue(kv.Key.Item2.ToString()).Selected = true; // //} // } //} //protected void dgvAddEditFabrics_ItemCommand(object source, DataGridCommandEventArgs e) //{ // ResetViewStateValues(); // string commandName = e.CommandName; // switch (commandName) // { // case "Delete": // Literal litID = (Literal)e.Item.FindControl("litID"); // int fabric = int.Parse(litID.Text.ToString()); // Literal litFabricTypeID = (Literal)e.Item.FindControl("litFabricTypeID"); // int fabricType = int.Parse(litFabricTypeID.Text); // this.PopulateFabricDataGrid(fabric, fabricType, true); // ViewState["IsPageValidCombined"] = false; // break; // default: // break; // } //} //protected void ddlFabricCodeType_SelectedIndexChanged(object sender, EventArgs e) //{ // ViewState["IsPageValidCombined"] = false; // int type = int.Parse(((System.Web.UI.WebControls.ListControl)(sender)).SelectedValue); // if (type == (int)FabricType.Lining) // { // PopulateFilteredFabrics(true); // } // else // { // PopulateFilteredFabrics(false); // } //} //protected void ddlAddFabrics_SelectedIndexChanged(object sender, EventArgs e) //{ // ViewState["IsPageValidCombined"] = false; // int fabric = int.Parse(((System.Web.UI.WebControls.ListControl)(sender)).SelectedValue); // int fabricType = int.Parse(ddlFabricCodeType.SelectedValue); // CustomValidator cv = null; // if (ddlFabricCodeType.SelectedIndex < 1) // { // cv = new CustomValidator(); // cv.IsValid = false; // cv.ValidationGroup = "valCombined"; // cv.ErrorMessage = "Fabric Type is required."; // Page.Validators.Add(cv); // } // else if (fabric > 0) // { // List<KeyValuePair<int, KeyValuePair<int, string>>> lstFabrics = (List<KeyValuePair<int, KeyValuePair<int, string>>>)Session["CombinedFabrics"]; // if (fabricType == 0 && lstFabrics.Where(o => o.Key == 0).Any()) // { // cv = new CustomValidator(); // cv.IsValid = false; // cv.ValidationGroup = "valCombined"; // cv.ErrorMessage = "Main Fabric alredy exists in the list."; // Page.Validators.Add(cv); // } // else if (lstFabrics.Where(o => o.Value.Key == fabric).Any()) // { // cv = new CustomValidator(); // cv.IsValid = false; // cv.ValidationGroup = "valCombined"; // cv.ErrorMessage = "This Fabric alredy exists in the list."; // Page.Validators.Add(cv); // } // else // { // this.PopulateFabricDataGrid(fabric, fabricType); // } // } // this.ddlAddFabrics.SelectedIndex = 0; //} //protected void linkBreakDown_Click(object sender, EventArgs e) //{ // this.ResetViewStateValues(); // this.dgvAddEditFabrics.DataSource = null; // this.dgvAddEditFabrics.DataBind(); // ViewState["IsPageValidCombined"] = false; // LinkButton linkBreakDown = (LinkButton)sender; // this.FabricID = int.Parse(linkBreakDown.Attributes["qid"]); // this.hdnSelectedFabricCodeID.Value = this.FabricID.ToString(); // this.PopulateFabricDataGrid(0, 0); //} //protected void btnNewCombinedFabric_Click(object sender, EventArgs e) //{ // this.ResetViewStateValues(); // ViewState["IsPageValidCombined"] = false; // txtFabricCode.Text = string.Empty; // txtCombinedName.Text = string.Empty; // txtCombinedNickName.Text = string.Empty; // this.FabricID = 0; // this.dgvAddEditFabrics.DataSource = null; // this.dgvAddEditFabrics.DataBind(); // this.PopulateFabricDataGrid(0, 0); //} protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args) { try { int itemId = int.Parse(this.hdnSelectedFabricCodeID.Value.ToString().Trim()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(itemId, "FabricCode", "Code", this.txtCode.Text); args.IsValid = objReturnInt.RetVal == 1; } catch (Exception ex) { IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on AddEditClient.aspx", ex); } }
protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args) { try { int accessorycolorsId = int.Parse(this.hdnSelectedAccessoryColorID.Value.Trim()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(accessorycolorsId, "AccessoryColor", "Name", this.txtColorName.Text); args.IsValid = objReturnInt.RetVal == 1; } catch (Exception ex) { IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on ViewAccessoryColors.aspx", ex); } }
protected void RadGridResolutionProfile_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is ResolutionProfileBO) { ResolutionProfileBO objResolutionProfile = (ResolutionProfileBO)item.DataItem; HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); linkEdit.Attributes.Add("qid", objResolutionProfile.ID.ToString()); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); linkDelete.Attributes.Add("qid", objResolutionProfile.ID.ToString()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(0, "VisualLayout", "ResolutionProfile", objResolutionProfile.ID.ToString()); linkDelete.Visible = objReturnInt.RetVal == 1; //linkDelete.Visible = (objResolutionProfile.VisualLayoutsWhereThisIsResolutionProfile.Any()) ? false : true; } } }
protected void cfvEmailAddress_Validate(object sender, ServerValidateEventArgs e) { //List<UserBO> lstEmailAddress = new List<UserBO>(); //if (!String.IsNullOrEmpty(this.txtEmailAddress.Text)) //{ // lstEmailAddress = (from o in (new UserBO()).GetAllObject() // where o.ID != this.QueryID && o.EmailAddress == this.txtEmailAddress.Text.Trim() // select o).ToList(); //} //e.IsValid = !(lstEmailAddress.Count > 0); try { ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(this.QueryID, "User", "EmailAddress", this.txtEmailAddress.Text); e.IsValid = objReturnInt.RetVal == 1; } catch (Exception ex) { IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on AddEditUser.aspx", ex); } }
protected void RadGridShipmentMode_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is ShipmentModeBO) { ShipmentModeBO objShipmentMode = (ShipmentModeBO)item.DataItem; HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); linkEdit.Attributes.Add("qid", objShipmentMode.ID.ToString()); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); linkDelete.Attributes.Add("qid", objShipmentMode.ID.ToString()); //linkDelete.Visible = (objShipmentMode.OrdersWhereThisIsShipmentMode.Count == 0 || // objShipmentMode.ReservationsWhereThisIsShipmentMode.Count == 0); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(0, "Order", "ShipmentMode", objShipmentMode.ID.ToString()); linkDelete.Visible = objReturnInt.RetVal == 1; } } }
protected void btnDelete_Click(object sender, EventArgs e) { int priceID = int.Parse(this.hdnSelectedID.Value.Trim()); if (Page.IsValid) { try { ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = PriceBO.DeletePrice(priceID); if (objReturnInt.RetVal == 0) { IndicoLogging.log.Error("btnDelete_Click : Error occured while Deleting the Price AddPatternFabric.aspx, SP_DeletePrice "); } // Populate active pattern fabrics this.PopulatePatternFabrics(); } catch (Exception ex) { // Log the error IndicoLogging.log.Error("btnDelete_Click : Error occured while Deleting the Price AddPatternFabric.aspx", ex); } } }
/// <summary> /// Process the page data. /// </summary> private void ProcessForm(int distributorID, bool isDelete, bool isEdit, string isType) { try { using (TransactionScope ts = new TransactionScope()) { if (isEdit) { //Delete Statment if (isDelete) { ReturnIntViewBO objReturnIntView = new ReturnIntViewBO(); if (isType == "distributor") { objReturnIntView = DistributorPriceMarkupBO.DeleteDistributorPriceMarkup(distributorID); if (objReturnIntView.RetVal == 0) { return; } } if (isType == "label") { objReturnIntView = PriceMarkupLabelBO.DeleteLabelPriceMarkup(distributorID); if (objReturnIntView.RetVal == 0) { return; } } } else { if (isType == "distributor") { foreach (RepeaterItem item in this.rptPriceLevels.Items) { HiddenField hdnCellID = (HiddenField)item.FindControl("hdnCellID"); TextBox txtCellData = (TextBox)item.FindControl("txtCellData"); int markup = int.Parse(hdnCellID.Value); DistributorPriceMarkupBO objPriceMarckup = new DistributorPriceMarkupBO(this.ObjContext); if (markup > 0) { objPriceMarckup.ID = int.Parse(hdnCellID.Value.Trim()); objPriceMarckup.GetObject(); } if (isEdit) { objPriceMarckup.Distributor = (distributorID > 0) ? distributorID : 0; } objPriceMarckup.PriceLevel = int.Parse(txtCellData.Attributes["qid"].ToString()); objPriceMarckup.Markup = Convert.ToDecimal(decimal.Parse(txtCellData.Text.Trim()).ToString("0.00")); } } if (isType == "label") { foreach (RepeaterItem item in this.rptPriceLevels.Items) { HiddenField hdnCellID = (HiddenField)item.FindControl("hdnCellID"); TextBox txtCellData = (TextBox)item.FindControl("txtCellData"); int Labelmarkup = int.Parse(hdnCellID.Value); LabelPriceMarkupBO objLabelPriceMarkup = new LabelPriceMarkupBO(this.ObjContext); if (Labelmarkup > 0) { objLabelPriceMarkup.ID = int.Parse(hdnCellID.Value.Trim()); objLabelPriceMarkup.GetObject(); } objLabelPriceMarkup.Label = distributorID; objLabelPriceMarkup.PriceLevel = int.Parse(txtCellData.Attributes["qid"].ToString()); objLabelPriceMarkup.Markup = Convert.ToDecimal(decimal.Parse(txtCellData.Text.Trim()).ToString("0.00")); } } } } else { foreach (RepeaterItem item in this.rptPriceLevels.Items) { int distributor = int.Parse(this.ddlDistributors.SelectedValue); HiddenField hdnCellID = (HiddenField)item.FindControl("hdnCellID"); TextBox txtCellData = (TextBox)item.FindControl("txtCellData"); int markup = int.Parse(hdnCellID.Value); DistributorPriceMarkupBO objPriceMarckup = new DistributorPriceMarkupBO(this.ObjContext); if (markup > 0) { objPriceMarckup.ID = int.Parse(hdnCellID.Value.Trim()); objPriceMarckup.GetObject(); } if (distributor > 0) { objPriceMarckup.Distributor = (int?)distributor; } objPriceMarckup.PriceLevel = int.Parse(txtCellData.Attributes["qid"].ToString()); objPriceMarckup.Markup = Convert.ToDecimal(decimal.Parse(txtCellData.Text.Trim()).ToString("0.00")); } } this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { // Log the error IndicoLogging.log.Error("Error occured while Adding, upadting and deleting the PriceMarkups", ex); } }