private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e) { //Event handler for data entry row updated try { //There is no selected row when updating- at a cell level string vendorID = "", operatorName = ""; int equipmentID = 0; switch (e.Row.Band.Key) { case "DriverEquipmentTable": vendorID = e.Row.Cells["FinanceVendorID"].Value.ToString(); operatorName = e.Row.Cells["OperatorName"].Value.ToString(); equipmentID = Convert.ToInt32(e.Row.Cells["EquipmentID"].Value.ToString()); break; } //Add new or update existing terminal configuration if (vendorID.Length > 0 && operatorName.Length > 0 && equipmentID > 0) { if (e.Row.IsAddRow) { FinanceGateway.CreateDriverEquipment(vendorID, operatorName, equipmentID); } else { FinanceGateway.UpdateDriverEquipment(vendorID, operatorName, equipmentID); } } else { e.Cancel = true; } } catch (Exception ex) { reportError(ex); } }
private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e) { //Event handler for data entry row updated try { //There is no selected row when updating- at a cell level string clid = e.Row.Cells["CLID"].Value.ToString(); string format = e.Row.Cells["ExportFormat"].Value.ToString(); string path = e.Row.Cells["ExportPath"].Value.ToString(); string key = e.Row.Cells["CounterKey"].Value.ToString(); string client = e.Row.Cells["Client"].Value.ToString(); string scanner = e.Row.Cells["Scanner"].Value.ToString(); string userid = e.Row.Cells["UserID"].Value.ToString(); if (clid != "" && format != "" && path != "" && key != "" && client != "") { if (e.Row.IsAddRow) { //Add new entry bool created = EnterpriseFactory.CreateClient(clid, format, path, key, client, scanner, userid); OnRefresh(this.btnRefresh, EventArgs.Empty); } else { //Update existing bool updated = EnterpriseFactory.UpdateClient(clid, format, path, key, client, scanner, userid); OnRefresh(this.btnRefresh, EventArgs.Empty); } } else { e.Cancel = true; } } catch (Exception ex) { App.ReportError(ex); } }
private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e) { //Event handler for data entry row updated try { //There is no selected row when updating- at a cell level string agentNumber = "", agentName = "", glNumber = "", adminGLNumber = "", adminFee = "", fsBase = ""; switch (e.Row.Band.Key) { case "TerminalConfigurationTable": agentNumber = e.Row.Cells["AgentNumber"].Value.ToString(); agentName = e.Row.Cells["AgentName"].Value.ToString(); glNumber = e.Row.Cells["GLNumber"].Value.ToString(); adminGLNumber = e.Row.Cells["AdminGLNumber"].Value.ToString(); adminFee = e.Row.Cells["AdminFee"].Value.ToString(); fsBase = e.Row.Cells["FSBase"].Value.ToString(); break; } if (agentNumber.Length > 0 && glNumber.Length > 0 && adminGLNumber.Length > 0 && adminFee.Length > 0 && fsBase.Length > 0) { if (e.Row.IsAddRow) { //Add new terminal configuration //TerminalConfiguration config = this.mTerminals.Add(agentNumber,AgentName,GLNumber,AdminGLNumber,AdminFee,FSBase); //config.Create(); } else { //Update existing //TerminalConfiguration config = this.mTerminals.Item(agentNumber); //config.GLNumber = glNumber; //config.AdminGLNumber = adminGLNumber; //config.AdminFee = adminFee; //config.FSBase = fsBase; //config.Update(); } } else { e.Cancel = true; } } catch (Exception ex) { reportError(ex); } }
private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e) { //Event handler for data entry row updated try { //There is no selected row when updating- at a cell level string clid = e.Row.Cells["CLID"].Value.ToString(); string format = e.Row.Cells["ExportFormat"].Value.ToString(); string path = e.Row.Cells["ExportPath"].Value.ToString(); string key = e.Row.Cells["CounterKey"].Value.ToString(); string client = e.Row.Cells["Client"].Value.ToString(); string scanner = e.Row.Cells["Scanner"].Value.ToString(); string userid = e.Row.Cells["UserID"].Value.ToString(); if (clid != "" && format != "" && path != "" && key != "" && client != "") { ISDClient isdClient = new ISDClient(); isdClient.CLID = clid; isdClient.ExportFormat = format; isdClient.ExportPath = path; isdClient.CounterKey = key; isdClient.Client = client; isdClient.Scanner = scanner; isdClient.UserID = userid; if (e.Row.IsAddRow) { //Add new entry bool created = AgentLineHaulGateway.CreateISDClient(isdClient); OnRefresh(this.btnRefresh, EventArgs.Empty); } else { //Update existing bool updated = AgentLineHaulGateway.UpdateISDClient(isdClient); OnRefresh(this.btnRefresh, EventArgs.Empty); } } else { e.Cancel = true; } } catch (Exception ex) { App.ReportError(ex); } }
private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e) { //Event handler for data entry row updated try { //There is no selected row when updating- at a cell level int id = 0; string agent = "", route = "", maxTrigFld = ""; DateTime date; double mile = 0.0; decimal baseRate = 0.0M, rate = 0.0M; int equip = 0, status = 1, maxTrigVal = 0; decimal dayRate = 0.0M, tripRate = 0.0M, stopRate = 0.0M, ctnRate = 0.0M, palletRate = 0.0M, pickupCtnRate = 0.0M, minAmt = 0.0M, maxAmt = 0.0M, fsBase = 0.0M; switch (e.Row.Band.Key) { case "RateMileageTable": id = Convert.ToInt32(e.Row.Cells["ID"].Value); agent = e.Row.Cells["AgentNumber"].Value.ToString(); equip = Convert.ToInt32(e.Row.Cells["EquipmentTypeID"].Value); date = Convert.ToDateTime(e.Row.Cells["EffectiveDate"].Value); mile = Convert.ToDouble(e.Row.Cells["Mile"].Value); baseRate = Convert.ToDecimal(e.Row.Cells["BaseRate"].Value); rate = Convert.ToDecimal(e.Row.Cells["Rate"].Value); if (agent.Length > 0 && equip > 0 && date > DateTime.MinValue) { if (e.Row.IsAddRow) { new DriverRatingService("").CreateMileageRate(agent, equip, date, mile, baseRate, rate); } else { new DriverRatingService("").UpdateMileageRate(id, equip, mile, baseRate, rate); } } else { e.Cancel = true; } break; case "RateUnitTable": id = Convert.ToInt32(e.Row.Cells["ID"].Value); agent = e.Row.Cells["AgentNumber"].Value.ToString(); equip = Convert.ToInt32(e.Row.Cells["EquipmentTypeID"].Value); date = Convert.ToDateTime(e.Row.Cells["EffectiveDate"].Value); dayRate = Convert.ToDecimal(e.Row.Cells["DayRate"].Value); tripRate = Convert.ToDecimal(e.Row.Cells["MultiTripRate"].Value); stopRate = Convert.ToDecimal(e.Row.Cells["StopRate"].Value); ctnRate = Convert.ToDecimal(e.Row.Cells["CartonRate"].Value); palletRate = Convert.ToDecimal(e.Row.Cells["PalletRate"].Value); pickupCtnRate = Convert.ToDecimal(e.Row.Cells["PickupCartonRate"].Value); minAmt = Convert.ToDecimal(e.Row.Cells["MinimumAmount"].Value); maxAmt = Convert.ToDecimal(e.Row.Cells["MaximumAmount"].Value); maxTrigFld = e.Row.Cells["MaximumTriggerField"].Value.ToString(); maxTrigVal = Convert.ToInt32(e.Row.Cells["MaximumTriggerValue"].Value); fsBase = Convert.ToDecimal(e.Row.Cells["FSBase"].Value); if (agent.Length > 0 && equip > 0 && date > DateTime.MinValue) { if (e.Row.IsAddRow) { new DriverRatingService("").CreateUnitRate(agent, equip, date, dayRate, tripRate, stopRate, ctnRate, palletRate, pickupCtnRate, minAmt, maxAmt, maxTrigFld, maxTrigVal, fsBase); } else { new DriverRatingService("").UpdateUnitRate(id, equip, dayRate, tripRate, stopRate, ctnRate, palletRate, pickupCtnRate, minAmt, maxAmt, maxTrigFld, maxTrigVal, fsBase); } } else { e.Cancel = true; } break; case "RateMileageRouteTable": id = Convert.ToInt32(e.Row.Cells["ID"].Value); agent = e.Row.Cells["AgentNumber"].Value.ToString(); route = e.Row.Cells["Route"].Value.ToString(); date = Convert.ToDateTime(e.Row.Cells["EffectiveDate"].Value); mile = Convert.ToDouble(e.Row.Cells["Mile"].Value); baseRate = Convert.ToDecimal(e.Row.Cells["BaseRate"].Value); rate = Convert.ToDecimal(e.Row.Cells["Rate"].Value); status = Convert.ToInt32(e.Row.Cells["Status"].Value); if (agent.Length > 0 && route.Length > 0 && date > DateTime.MinValue) { if (e.Row.IsAddRow) { new DriverRatingService("").CreateMileageRouteRate(agent, route, date, mile, baseRate, rate, status); } else { new DriverRatingService("").UpdateMileageRouteRate(id, route, mile, baseRate, rate, status); } } else { e.Cancel = true; } break; case "RateUnitRouteTable": id = Convert.ToInt32(e.Row.Cells["ID"].Value); agent = e.Row.Cells["AgentNumber"].Value.ToString(); route = e.Row.Cells["Route"].Value.ToString(); date = Convert.ToDateTime(e.Row.Cells["EffectiveDate"].Value); dayRate = Convert.ToDecimal(e.Row.Cells["DayRate"].Value); tripRate = Convert.ToDecimal(e.Row.Cells["MultiTripRate"].Value); stopRate = Convert.ToDecimal(e.Row.Cells["StopRate"].Value); ctnRate = Convert.ToDecimal(e.Row.Cells["CartonRate"].Value); palletRate = Convert.ToDecimal(e.Row.Cells["PalletRate"].Value); pickupCtnRate = Convert.ToDecimal(e.Row.Cells["PickupCartonRate"].Value); minAmt = Convert.ToDecimal(e.Row.Cells["MinimumAmount"].Value); maxAmt = Convert.ToDecimal(e.Row.Cells["MaximumAmount"].Value); maxTrigFld = e.Row.Cells["MaximumTriggerField"].Value.ToString(); maxTrigVal = Convert.ToInt32(e.Row.Cells["MaximumTriggerValue"].Value); fsBase = Convert.ToDecimal(e.Row.Cells["FSBase"].Value); status = Convert.ToInt32(e.Row.Cells["Status"].Value); if (agent.Length > 0 && route.Length > 0 && date > DateTime.MinValue) { if (e.Row.IsAddRow) { new DriverRatingService("").CreateUnitRouteRate(agent, route, date, dayRate, tripRate, stopRate, ctnRate, palletRate, pickupCtnRate, minAmt, maxAmt, maxTrigFld, maxTrigVal, fsBase, status); } else { new DriverRatingService("").UpdateUnitRouteRate(id, route, dayRate, tripRate, stopRate, ctnRate, palletRate, pickupCtnRate, minAmt, maxAmt, maxTrigFld, maxTrigVal, fsBase, status); } } else { e.Cancel = true; } break; } this.mRates.Refresh(); } catch (Exception ex) { reportError(ex); } }