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 btnSMVRate_Click(object sender, EventArgs e) { try { GridHeaderItem header = (GridHeaderItem)this.RadGridCostSheet.MasterTableView.GetItems(GridItemType.Header)[0]; TextBox txtApplySMVRate = (TextBox)header.FindControl("txtApplySMVRate"); decimal smvRate = !string.IsNullOrEmpty(txtApplySMVRate.Text) ? Convert.ToDecimal(txtApplySMVRate.Text) : 0; foreach (GridDataItem dgitem in this.RadGridCostSheet.Items) { Label lblCostSheet = (Label)dgitem.FindControl("lblCostSheet"); int costSheet = int.Parse(lblCostSheet.Text.ToString()); TextBox txtSMVRate = (TextBox)dgitem.FindControl("txtSMVRate"); txtSMVRate.Text = smvRate.ToString(); CostSheetBO objCostSheet = new CostSheetBO(this.ObjContext); objCostSheet.ID = costSheet; objCostSheet.GetObject(); objCostSheet.SMVRate = smvRate; this.ObjContext.SaveChanges(); } } catch (Exception ex) { // Log the error IndicoLogging.log.Error("Error occured while saving smvRate to the Cost Sheet from ViewCostSheets.aspx", ex); } Response.Redirect("ViewCostSheets.aspx"); }
protected void btnBulkSave_Click(object sender, EventArgs e) { try { using (TransactionScope ts = new TransactionScope()) { foreach (GridDataItem item in RadGridCostSheets.Items) { TextBox txtIndimanPrice = (TextBox)item.FindControl("txtIndimanPrice"); HiddenField hdnCSID = (HiddenField)item.FindControl("hdnCSID"); int costSheetID = int.Parse(hdnCSID.Value); if (costSheetID > 0) { CostSheetBO objCS = new CostSheetBO(this.ObjContext); objCS.ID = costSheetID; objCS.GetObject(); objCS.QuotedCIF = Convert.ToDecimal(string.IsNullOrEmpty(txtIndimanPrice.Text) ? "0.00" : txtIndimanPrice.Text); } } this.ObjContext.SaveChanges(); ts.Complete(); } Page.Response.Redirect(Request.RawUrl); } catch (Exception ex) { IndicoLogging.log.Error("Error occured while bulk saving indiman price to CostSheetBO from IndicoPriceLevels.ascx", ex); } }
protected void RadGridCostSheets_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.FilterCommandName) { this.ReBindGrid(); } else if (e.CommandName == "Save") { try { TextBox txtIndimanPrice = (TextBox)e.Item.FindControl("txtIndimanPrice"); HiddenField hdnCSID = (HiddenField)e.Item.FindControl("hdnCSID"); int costSheetID = int.Parse(hdnCSID.Value); if (costSheetID > 0) { CostSheetBO objCS = new CostSheetBO(this.ObjContext); objCS.ID = costSheetID; objCS.GetObject(); objCS.QuotedCIF = Convert.ToDecimal(string.IsNullOrEmpty(txtIndimanPrice.Text) ? "0.00" : txtIndimanPrice.Text); this.ObjContext.SaveChanges(); Page.Response.Redirect(Request.RawUrl); } } catch (Exception ex) { // Log the error IndicoLogging.log.Error("Error occured while saving indiman price to the Cost Sheet from IndicoPriceLevels.ascx", ex); } } }
protected void RadGridCostSheet_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.FilterCommandName) { this.ReBindGrid(); } else if (e.CommandName == "SaveCostSheet") { try { Label lblCostSheet = (Label)e.Item.FindControl("lblCostSheet"); int costSheet = int.Parse(lblCostSheet.Text.ToString()); TextBox txtExchangeRate = (TextBox)e.Item.FindControl("txtExchangeRate"); TextBox txtFOBCost = (TextBox)e.Item.FindControl("txtFOBCost"); TextBox txtQuotedCIF = (TextBox)e.Item.FindControl("txtQuotedCIF"); TextBox txtDutyRate = (TextBox)e.Item.FindControl("txtDutyRate"); TextBox txtSMVRate = (TextBox)e.Item.FindControl("txtSMVRate"); decimal exchangeRate = !string.IsNullOrEmpty(txtExchangeRate.Text) ? Convert.ToDecimal(txtExchangeRate.Text) : 0; decimal fobCost = !string.IsNullOrEmpty(txtFOBCost.Text) ? Convert.ToDecimal(txtFOBCost.Text) : 0; decimal quotedCIF = !string.IsNullOrEmpty(txtQuotedCIF.Text) ? Convert.ToDecimal(txtQuotedCIF.Text) : 0; decimal dutyRate = !string.IsNullOrEmpty(txtDutyRate.Text) ? Convert.ToDecimal(txtDutyRate.Text) : 0; decimal smvRate = !string.IsNullOrEmpty(txtSMVRate.Text) ? Convert.ToDecimal(txtSMVRate.Text) : 0; CostSheetBO objCostSheet = new CostSheetBO(this.ObjContext); objCostSheet.ID = costSheet; objCostSheet.GetObject(); if (this.LoggedUserRoleName == UserRole.IndimanAdministrator) { objCostSheet.IndimanModifier = this.LoggedUser.ID; objCostSheet.IndimanModifiedDate = DateTime.Now; } else if (this.LoggedUserRoleName == UserRole.FactoryAdministrator) { objCostSheet.Modifier = this.LoggedUser.ID; objCostSheet.ModifiedDate = DateTime.Now; } objCostSheet.ExchangeRate = exchangeRate; objCostSheet.QuotedCIF = quotedCIF; objCostSheet.QuotedFOBCost = fobCost; objCostSheet.DutyRate = dutyRate; objCostSheet.SMVRate = smvRate; this.ObjContext.SaveChanges(); PopulateDataGrid(); } catch (Exception ex) { // Log the error IndicoLogging.log.Error("Error occured while saving exchangeRate to the Cost Sheet from ViewCostSheets.aspx", ex); } } }
protected void btnShowToIndico_Click(object sender, EventArgs e) { int id = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["id"].ToString()); if (id > 0) { CostSheetBO objCostSheet = new CostSheetBO(this.ObjContext); objCostSheet.ID = id; objCostSheet.GetObject(); objCostSheet.ShowToIndico = !objCostSheet.ShowToIndico; this.ObjContext.SaveChanges(); this.PopulateDataGrid(); } }
protected void btnSaveChanges_Click(object sender, EventArgs e) { try { foreach (GridDataItem dgitem in this.RadGridCostSheet.Items) { Label lblCostSheet = (Label)dgitem.FindControl("lblCostSheet"); int costSheet = int.Parse(lblCostSheet.Text.ToString()); TextBox txtExchangeRate = (TextBox)dgitem.FindControl("txtExchangeRate"); TextBox txtQuotedCIF = (TextBox)dgitem.FindControl("txtQuotedCIF"); TextBox txtDutyRate = (TextBox)dgitem.FindControl("txtDutyRate"); TextBox txtSMVRate = (TextBox)dgitem.FindControl("txtSMVRate"); decimal exchangeRate = !string.IsNullOrEmpty(txtExchangeRate.Text) ? Convert.ToDecimal(txtExchangeRate.Text) : 0; decimal quotedCIF = !string.IsNullOrEmpty(txtQuotedCIF.Text) ? Convert.ToDecimal(txtQuotedCIF.Text) : 0; decimal dutyRate = !string.IsNullOrEmpty(txtDutyRate.Text) ? Convert.ToDecimal(txtDutyRate.Text) : 0; decimal smvRate = !string.IsNullOrEmpty(txtSMVRate.Text) ? Convert.ToDecimal(txtSMVRate.Text) : 0; CostSheetBO objCostSheet = new CostSheetBO(this.ObjContext); objCostSheet.ID = costSheet; objCostSheet.GetObject(); objCostSheet.ExchangeRate = exchangeRate; objCostSheet.QuotedCIF = quotedCIF; objCostSheet.DutyRate = dutyRate; objCostSheet.SMVRate = smvRate; this.ObjContext.SaveChanges(); } } catch (Exception ex) { // Log the error IndicoLogging.log.Error("Error occured while saving data to the Cost Sheet from ViewCostSheets.aspx", ex); } Response.Redirect("ViewCostSheets.aspx"); }
protected void btnDelete_Click(object sender, EventArgs e) { int Id = int.Parse(this.hdnSelectedID.Value.Trim()); if (Page.IsValid) { try { using (TransactionScope ts = new TransactionScope()) { CostSheetBO objCostSheet = new CostSheetBO(this.ObjContext); objCostSheet.ID = Id; objCostSheet.GetObject(); // delete Pattern Support Fabric //List<PatternSupportFabricBO> lstPatternSupportFabric = (new PatternSupportFabricBO()).SearchObjects().Where() foreach (PatternSupportFabricBO psf in objCostSheet.PatternSupportFabricsWhereThisIsCostSheet) { PatternSupportFabricBO objPatternSupportFabric = new PatternSupportFabricBO(this.ObjContext); objPatternSupportFabric.ID = psf.ID; objPatternSupportFabric.GetObject(); objPatternSupportFabric.Delete(); } // delete Pattern Support Accesories foreach (PatternSupportAccessoryBO psf in objCostSheet.PatternSupportAccessorysWhereThisIsCostSheet) { PatternSupportAccessoryBO objPatternSupportAccesory = new PatternSupportAccessoryBO(this.ObjContext); objPatternSupportAccesory.ID = psf.ID; objPatternSupportAccesory.GetObject(); objPatternSupportAccesory.Delete(); } //delete CostSheetRemarks foreach (CostSheetRemarksBO cr in objCostSheet.CostSheetRemarkssWhereThisIsCostSheet) { CostSheetRemarksBO objCostSheetRemarks = new CostSheetRemarksBO(this.ObjContext); objCostSheetRemarks.ID = cr.ID; objCostSheetRemarks.GetObject(); objCostSheetRemarks.Delete(); } // delete Indiman CostSheet Remarks foreach (IndimanCostSheetRemarksBO icr in objCostSheet.IndimanCostSheetRemarkssWhereThisIsCostSheet) { IndimanCostSheetRemarksBO objIndimanCostSheetRemarks = new IndimanCostSheetRemarksBO(this.ObjContext); objIndimanCostSheetRemarks.ID = icr.ID; objIndimanCostSheetRemarks.GetObject(); objIndimanCostSheetRemarks.Delete(); } // delete costsheet objCostSheet.Delete(); this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { IndicoLogging.log.Error("Error occurder while deleting Cost Sheet From ViewCostSheets.aspx page", ex); } this.PopulateDataGrid(); } }