private void tsmDeductionType_Click(object sender, EventArgs e) { try { foreach (TabPage _tab in this.tbcNSites_V.TabPages) { if (_tab.Text == "DeductionType List") { tbcNSites_V.SelectedTab = _tab; return; } } DeductionType _DeductionType = new DeductionType(); Type _Type = typeof(DeductionType); ListFormPayrollUI _ListForm = new ListFormPayrollUI((object)_DeductionType, _Type); TabPage _ListFormTab = new TabPage(); _ListFormTab.ImageIndex = 24; _ListForm.ParentList = this; displayControlOnTab(_ListForm, _ListFormTab); } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "tsmDeductionType_Click"); em.ShowDialog(); return; } }
public DeductionTypeDetailUI() { InitializeComponent(); lId = ""; lOperation = GlobalVariables.Operation.Add; loDeductionType = new DeductionType(); }
public DeductionTypeDetailUI(string[] pRecords) { InitializeComponent(); lId = ""; lOperation = GlobalVariables.Operation.Edit; loDeductionType = new DeductionType(); lRecords = pRecords; }
//匹配扣点 public List <PolicyCache> DeductionSetting(string code, List <AVHData> avhList, List <PolicyCache> pclist) { PlatformDeductionParam pfDp = new PlatformDeductionParam(); foreach (AVHData leg in avhList) { pfDp.FlyLineList.Add(new FlyLine() { CarrayCode = leg.QueryParam.CarrierCode, FromCityCode = leg.QueryParam.FromCode, ToCityCode = leg.QueryParam.ToCode }); } DomesticService domesticService = ObjectFactory.GetInstance <DomesticService>(); UserRelation userRealtion = domesticService.GetUserRealtion(code); DeductionGroup deductionGroup = userRealtion.deductionGroup; List <string> codeList = ObjectFactory.GetAllInstances <IPlatform>().Select(p => p.Code).ToList(); DeductionType deductionType = DeductionType.Interface; EnumPolicySourceType PolicySourceType = EnumPolicySourceType.Interface; //本地运营的下级供应code List <string> LocalSupplierCodeList = userRealtion.SupplierList.Where(p => p.CarrierCode == userRealtion.carrier.Code).Select(p => p.Code).ToList(); for (int i = 0; i < pclist.Count; i++) { PolicyCache pc = pclist[i]; if (codeList.Contains(pc.PlatformCode)) { deductionType = DeductionType.Interface; PolicySourceType = EnumPolicySourceType.Interface; } else { if (userRealtion.carrier.Code == pc.PlatformCode || LocalSupplierCodeList.Contains(pc.PlatformCode)) { deductionType = DeductionType.Local; PolicySourceType = EnumPolicySourceType.Local; } else { deductionType = DeductionType.Share; PolicySourceType = EnumPolicySourceType.Share; } } pc.Point = domesticService.MatchDeductionRole(PolicyCacheToPolicy(pc, PolicySourceType), pfDp, pc.CarrierCode, deductionGroup, userRealtion, deductionType); } return(pclist); }
private void button_Click(object sender, RoutedEventArgs e) { try { using (var db = new DMSIPayrollEntities()) { if (tbDeductionCode.Text == "" || tbDescription.Text == "") { MessageBox.Show("Required fields cannot be empty.", "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (mode == 1) { DeductionType deductionType = new DeductionType(); deductionType.DeductionCode = tbDeductionCode.Text; deductionType.Description = tbDescription.Text; db.DeductionTypes.Add(deductionType); db.SaveChanges(); MessageBox.Show("Add Succesful", "System Succes!", MessageBoxButton.OK, MessageBoxImage.Information); clear(); } else if (mode == 2) { var deductiontype = db.DeductionTypes.Where(m => m.DeductionTypeID == deductiontypeid).FirstOrDefault(); deductiontype.DeductionCode = tbDeductionCode.Text; deductiontype.Description = tbDescription.Text; db.SaveChanges(); MessageBox.Show("Update Succesful", "System Succes!", MessageBoxButton.OK, MessageBoxImage.Information); } } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void SeedTestCases(SupportContext context, string userId) { // Get some Income Type objects IncomeType it1 = context.IncomeTypes.Where(c => c.Code == "wages").First(); IncomeType it2 = context.IncomeTypes.Where(c => c.Code == "bonuses").First(); IncomeType it3 = context.IncomeTypes.Where(c => c.Code == "winnings").First(); IncomeType it4 = context.IncomeTypes.Where(c => c.Code == "milretire").First(); // Get some Deduction Type objects // ~TODO~ Add the Deduction Types to the SeedCodeTables.sql DeductionType dt1 = context.DeductionTypes.Where(c => c.Code == "Alimony").First(); DeductionType dt2 = context.DeductionTypes.Where(c => c.Code == "Trad401").First(); DeductionType dt3 = context.DeductionTypes.Where(c => c.Code == "TradIRA").First(); DeductionType dt4 = context.DeductionTypes.Where(c => c.Code == "LifeIns").First(); // Get some CityTax objects CityTax ct1 = context.CityTaxes.Where(c => c.Name == "No City Tax").First(); CityTax ct2 = context.CityTaxes.Where(c => c.Name == "Hudson (Resident)").First(); CityTax ct3 = context.CityTaxes.Where(c => c.Name == "Lansing (Non-Resident)").First(); CityTax ct4 = context.CityTaxes.Where(c => c.Name == "Portland (Non-Resident)").First(); CityTax ct5 = context.CityTaxes.Where(c => c.Name == "Saginaw (Resident)").First(); // Get some FilingStatus objects FilingStatus fs1 = context.FilingStatus.Where(c => c.Code == "Single").First(); FilingStatus fs2 = context.FilingStatus.Where(c => c.Code == "Head").First(); FilingStatus fs3 = context.FilingStatus.Where(c => c.Code == "Jointly").First(); FilingStatus fs4 = context.FilingStatus.Where(c => c.Code == "Seperately").First(); FilingStatus fs5 = context.FilingStatus.Where(c => c.Code == "Widow").First(); // Get some PartyType objects PartyType ptA = context.PartyTypes.Where(c => c.Code == "A").First(); PartyType ptB = context.PartyTypes.Where(c => c.Code == "B").First(); PartyType pt3 = context.PartyTypes.Where(c => c.Code == "3").First(); // Create some cases Random rnd = new Random(); int caseNo1A = rnd.Next(10, 99); int caseNo1B = rnd.Next(10, 99); int caseNo2A = rnd.Next(16238, 99999); int caseNo2B = rnd.Next(16238, 99999); var case1 = new Case() { AspNetUserId = userId, CaseNumber = caseNo1A + "-" + caseNo2B + "-Test" }; var case2 = new Case() { AspNetUserId = userId, CaseNumber = caseNo1B + "-" + caseNo2A + "-Test" }; context.Cases.Add(case1); context.Cases.Add(case2); SaveChanges(context); // Create some Child objects Child ch11 = new Child() { Case = case1, Name = "John", Overnights = 93.0m }; Child ch12 = new Child() { Case = case1, Name = "Jack", Overnights = 57.4m }; Child ch13 = new Child() { Case = case1, Name = "Amber", Overnights = 180m }; Child ch14 = new Child() { Case = case1, Name = "Mary", Overnights = 180m }; Child ch15 = new Child() { Case = case1, Name = "Daron", Overnights = 180m }; Child ch21 = new Child() { Case = case2, Name = "Aaron", Overnights = 220m }; Child ch22 = new Child() { Case = case2, Name = "Bob", Overnights = 220m }; Child ch23 = new Child() { Case = case2, Name = "Jim", Overnights = 220m }; Child ch24 = new Child() { Case = case2, Name = "Chuck", Overnights = 220m }; Child ch25 = new Child() { Case = case2, Name = "Lisa", Overnights = 200m }; context.Children.Add(ch11); context.Children.Add(ch12); context.Children.Add(ch13); context.Children.Add(ch14); context.Children.Add(ch15); context.Children.Add(ch21); context.Children.Add(ch22); context.Children.Add(ch23); context.Children.Add(ch24); context.Children.Add(ch25); SaveChanges(context); // Create some Party objects Party p1 = new Party() { Case = case1, Name = "Brad Benix", AdditionalChildren = 0, ChildCareAmount = 0, Exemptions = 5, ExemptionsUnder17 = 3, HealthCareAmount = 0, PartyType = ptA, CityTax = ct1, FilingStatus = fs1 }; Party p2 = new Party() { Case = case1, Name = "Alison Benix", AdditionalChildren = 0, ChildCareAmount = 0, Exemptions = 5, ExemptionsUnder17 = 3, HealthCareAmount = 0, PartyType = ptB, CityTax = ct2, FilingStatus = fs2 }; Party p3 = new Party() { Case = case2, Name = "Harry Marly", AdditionalChildren = 0, ChildCareAmount = 0, Exemptions = 5, ExemptionsUnder17 = 3, HealthCareAmount = 0, PartyType = ptA, CityTax = ct3, FilingStatus = fs3 }; Party p4 = new Party() { Case = case2, Name = "Mary Marly", AdditionalChildren = 0, ChildCareAmount = 0, Exemptions = 5, ExemptionsUnder17 = 3, HealthCareAmount = 0, PartyType = ptB, CityTax = ct4, FilingStatus = fs4 }; context.Parties.Add(p1); context.Parties.Add(p2); context.Parties.Add(p3); context.Parties.Add(p4); SaveChanges(context); // Create some Deduction objects Deduction d1 = new Deduction() { DeductionType = dt1, Party = p1, Amount = 1000m }; Deduction d2 = new Deduction() { DeductionType = dt2, Party = p2, Amount = 1200m }; Deduction d3 = new Deduction() { DeductionType = dt3, Party = p3, Amount = 1300m }; Deduction d4 = new Deduction() { DeductionType = dt4, Party = p4, Amount = 2000m }; context.Deductions.Add(d1); context.Deductions.Add(d2); context.Deductions.Add(d3); context.Deductions.Add(d4); SaveChanges(context); // Create some Income objects Income i1 = new Income() { IncomeType = it1, Party = p1, Amount = 54000m }; Income i2 = new Income() { IncomeType = it2, Party = p2, Amount = 43000m }; Income i3 = new Income() { IncomeType = it3, Party = p3, Amount = 62000m }; Income i4 = new Income() { IncomeType = it4, Party = p4, Amount = 38000m }; context.Incomes.Add(i1); context.Incomes.Add(i2); context.Incomes.Add(i3); context.Incomes.Add(i4); SaveChanges(context); }
public override object Execute() { //记录时间 StringBuilder sbLog = new StringBuilder(); Stopwatch watch = new Stopwatch(); try { watch.Start(); string platformCode = getParame("platformCode").ToString(); string policyId = getParame("policyId").ToString(); string operatorName = getParame("operatorName").ToString(); string source = getParame("source").ToString(); PolicyDto policyUI = source != "back" ? (getParame("policy") as PolicyDto) : null; decimal TotlePaidPirce = 0m; OldOutOrderId = order.OutOrderId; string innerPlatformCode = "系统"; DataBill databill = new DataBill(); DomesticService domesticService = ObjectFactory.GetInstance <DomesticService>(); UserRelation userRealtion = domesticService.GetUserRealtion(order.BusinessmanCode); bool IspolicyIsNull = false; if (policyUI != null) { //赋值 order.Policy = PolicyDtoPolicy(policyUI, order.Policy, source); } else { #region 原获取政策 PolicyParam policyParam = new PolicyParam(); policyParam.code = order.BusinessmanCode; policyParam.PnrContent = order.PnrContent; policyParam.OrderId = order.OrderId; policyParam.OrderType = order.OrderType; policyParam.OrderSource = order.OrderSource; policyParam.IsChangePnrTicket = order.IsChangePnrTicket; policyParam.IsDestine = order.OrderSource == EnumOrderSource.WhiteScreenDestine ? true : false; Passenger pasData = order.Passengers.Where(p => p.PassengerType != EnumPassengerType.Baby).FirstOrDefault(); if (pasData != null) { policyParam.defFare = pasData.SeatPrice.ToString(); policyParam.defTAX = pasData.ABFee.ToString(); policyParam.defRQFare = pasData.RQFee.ToString(); } if (order.Policy == null) { IspolicyIsNull = true; order.Policy = new Policy(); } Policy localPolicy = null; PlatformPolicy policy = null; PlatformOrder platformOrder = null; PolicyService policyService = ObjectFactory.GetInstance <PolicyService>(); watch.Stop(); sbLog.AppendFormat("初始话变量时间:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (platformCode != innerPlatformCode) { PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent); policy = PlatformFactory.GetPlatformByCode(platformCode).GetPoliciesByPnrContent(order.PnrContent, order.IsLowPrice, pnrData).Find((p) => p.Id == policyId); watch.Stop(); sbLog.AppendFormat("0.调用方法【GetPlatformByCode】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (policy == null) { localPolicy = GetLocalPolicy(policyParam, policyId, innerPlatformCode, userRealtion, IspolicyIsNull, policyService, localPolicy); watch.Stop(); sbLog.AppendFormat("1.调用方法【GetLocalPolicy】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (localPolicy != null) { order.Policy = localPolicy; } else { throw new OrderCommException("政策发生变动,请重新获取政策!!!"); } } else { SetInterface(platformCode, operatorName, source, ref TotlePaidPirce, policy, userRealtion, ref platformOrder, pnrData); watch.Stop(); sbLog.AppendFormat("2.调用方法【SetInterface】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); } } else { localPolicy = GetLocalPolicy(policyParam, policyId, innerPlatformCode, userRealtion, IspolicyIsNull, policyService, localPolicy); watch.Stop(); sbLog.AppendFormat("3.调用方法【GetLocalPolicy】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (localPolicy == null) { PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent); localPolicy = policyService.GetInterfacePolicy(policyParam, "", userRealtion, pnrData).Find((p) => p.PolicyId == policyId); watch.Stop(); sbLog.AppendFormat("4.调用方法【GetInterfacePolicy】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (localPolicy != null) { policy.AreaCity = localPolicy.AreaCity; policy.Id = localPolicy.PolicyId; policy.PolicyPoint = localPolicy.PolicyPoint; if (source != "back") { policy.PolicyPoint = localPolicy.PaidPoint; } policy.ReturnMoney = localPolicy.ReturnMoney; policy.IsLow = localPolicy.IsLow; policy.SeatPrice = localPolicy.SeatPrice; policy.ABFee = localPolicy.ABFee; policy.RQFee = localPolicy.RQFee; policy.Remark = localPolicy.Remark; policy.IsChangePNRCP = localPolicy.IsChangePNRCP; policy.IsSp = localPolicy.IsSp; policy.PolicyType = localPolicy.PolicyType; policy.WorkTime = localPolicy.WorkTime; policy.ReturnTicketTime = localPolicy.ReturnTicketTime; policy.AnnulTicketTime = localPolicy.AnnulTicketTime; policy.CPOffice = localPolicy.CPOffice; policy.IssueSpeed = localPolicy.IssueSpeed; TotlePaidPirce = platformOrder.TotlePaidPirce; SetInterface(platformCode, operatorName, source, ref TotlePaidPirce, policy, userRealtion, ref platformOrder, pnrData); watch.Stop(); sbLog.AppendFormat("5.调用方法【GetInterfacePolicy】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); } else { if (localPolicy == null) { throw new OrderCommException("政策发生变动,请重新获取政策!"); } } } else { //赋值 order.Policy = localPolicy; } } #endregion } decimal _OrderMoney = 0m; if (source != "back") { //扣点组类型 DeductionType deductionType = order.Policy.PolicySourceType == EnumPolicySourceType.Local ? DeductionType.Local : (order.Policy.PolicySourceType == EnumPolicySourceType.Share ? DeductionType.Share : DeductionType.Interface); if (policyUI != null) { order.Policy.PolicyPoint = order.Policy.PaidPoint; } PlatformDeductionParam pfDp = new PlatformDeductionParam(); foreach (SkyWay leg in order.SkyWays) { pfDp.FlyLineList.Add(new FlyLine() { CarrayCode = leg.CarrayCode, FromCityCode = leg.FromCityCode, ToCityCode = leg.ToCityCode }); } //匹配扣点规则 domesticService.MatchDeductionRole(order.Policy, pfDp, order.SkyWays[0].CarrayCode, userRealtion.deductionGroup, userRealtion, deductionType); watch.Stop(); sbLog.AppendFormat("6.调用方法【MatchDeductionRole】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); //佣金 order.Policy.Commission = databill.GetCommission(order.Policy.PolicyPoint, order.Policy.SeatPrice, order.Policy.ReturnMoney); //单人支付金额 根据选择的政策 设置价格 for (int i = 0; i < order.Passengers.Count; i++) { Passenger p = order.Passengers[i]; if (p.PassengerType != EnumPassengerType.Baby) { p.SeatPrice = order.Policy.SeatPrice; p.ABFee = order.Policy.ABFee; p.RQFee = order.Policy.RQFee; p.PayMoney = databill.GetPayPrice(order.Policy.SeatPrice, order.Policy.ABFee, order.Policy.RQFee, order.Policy.PolicyPoint, order.Policy.ReturnMoney); } else { p.PayMoney = databill.GetPayPrice(p.SeatPrice, p.ABFee, p.RQFee, 0, 0); } } _OrderMoney = order.Passengers.Sum(p => p.PayMoney); order.OrderCommissionTotalMoney = order.Passengers.Sum(p => p.PassengerType != EnumPassengerType.Baby ? databill.GetCommission(order.Policy.PolicyPoint, order.Policy.SeatPrice, order.Policy.ReturnMoney) : 0); } #region 支付信息 if (order.OrderPay == null) { order.OrderPay = new OrderPay(); } order.OrderPay.OrderId = order.OrderId; order.OrderPay.PaidMoney = TotlePaidPirce; if (source != "back") { order.OrderPay.PayMoney = _OrderMoney; order.OrderMoney = _OrderMoney; order.OrderPay.PayStatus = EnumPayStatus.NoPay; } order.OrderPay.PaidStatus = EnumPaidStatus.NoPaid; order.OrderPay.TradePoundage = 0m; order.OrderPay.SystemFee = 0m; order.CpOffice = order.Policy.CPOffice; #endregion #region 根据政策扣点明细计算支付分润 if (source != "back") { domesticService.CreateBillDetails(order, userRealtion); watch.Stop(); sbLog.AppendFormat("7.调用方法【CreateBillDetails】用时:{0}\r\n", watch.Elapsed.ToString()); } #endregion order.WriteLog(new OrderLog() { OperationContent = string.Format("{0}选择政策,政策:{1},编号:{2},订单号:{3},出票速度:{4}", source, order.Policy.PolicyPoint, order.Policy.PolicyId, order.OrderId, order.Policy.IssueSpeed), OperationDatetime = DateTime.Now, OperationPerson = operatorName, IsShowLog = false }); order.WriteLog(new OrderLog() { OperationContent = string.Format("选择政策,订单号:{0},出票速度:{1}", order.OrderId, order.Policy.IssueSpeed), OperationDatetime = DateTime.Now, OperationPerson = operatorName, IsShowLog = true }); if (source == "back") { //order.ChangeStatus(EnumOrderStatus.WaitAndPaid); order.ChangeStatus(EnumOrderStatus.PayWaitCreatePlatformOrder); } else { order.ChangeStatus(EnumOrderStatus.NewOrder); } } finally { if (sbLog.ToString() != "") { new CommLog().WriteLog("NewSelectPolicyBehavior", sbLog.ToString()); } } if (order.Policy.PolicySourceType == EnumPolicySourceType.Interface) { order.Policy.Code = string.Empty; order.Policy.Name = string.Empty; order.Policy.CashbagCode = string.Empty; } return(null); }
public string updateDeductionType([FromBody] DeductionType pDeductionType) { return(loDeductionType.updateDeductionType(pDeductionType)); }
public string insertDeductionType([FromBody] DeductionType pDeductionType) { return(loDeductionType.insertDeductionType(pDeductionType)); }
public DeductionTypeForm(DeductionType type) { InitializeComponent(); this.DeductionType = type; }
public EditDeductionType(DeductionType type) { this.type = type; }