public static Income GetIncomeByIncomeID(int IncomeID) { Income income = new Income(); SqlIncomeProvider sqlIncomeProvider = new SqlIncomeProvider(); income = sqlIncomeProvider.GetIncomeByIncomeID(IncomeID); return income; }
public void Income_Copy() { var first = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; var second = first.Copy(); Assert.AreNotSame(first, second); Assert.IsTrue(first.Equals(second)); Assert.IsTrue(second.Equals(first)); }
public static IncomeDto createIncomeDTO(Income obj) { IncomeDto inc = new IncomeDto(); inc.IncomeId = obj.IncomeId; inc.IncomeDescription = obj.IncomeDescription; return inc; }
private void AddTaxes(Millicents GrossForFICA, Millicents GrossForFed, Millicents GrossForState, Millicents GrossForLocal, Income income, Person person) { person.UpdateIncomeTaxStatusByDate(0/*JulianDay*/); IncomeTaxStatus status = person.IncomeTaxStatus; TaxTable federal = TaxTable.CreateFederal(status); TaxTable state = TaxTable.CreateState(status, person.Location); TaxTable local = TaxTable.CreateLocal(status, person.Location); double AnnualPayPeriods = income.Frequency.ToAnnualPeriods(); // FICA double GrossFICA = GrossForFICA.ToDouble(); double SocSecWages = Math.Min(GrossFICA, Math.Max(TaxTable.MaxSocSecWages - GrossFICA, 0)); double SocSec = Math.Round(SocSecWages * TaxTable.SocSecPercent, 2); double Medicare = Math.Round(GrossFICA * TaxTable.MedicarePercent, 2); // Federal double FederalGross = GrossForFed.ToDouble() * AnnualPayPeriods; double FederalExemptions = federal.Exemptions(status.FederalExemptions); double FederalTaxableGross = Math.Max(FederalGross - FederalExemptions, 0); double FederalTaxTotal = Math.Round(federal.Compute(FederalTaxableGross), 2); double FederalTax = Math.Round(FederalTaxTotal / AnnualPayPeriods, 2); // State double StateGross = GrossForState.ToDouble() * AnnualPayPeriods; double StateExemptions = state.Exemptions(status.StateLocalExemptions); double StateTaxableGross = Math.Max(StateGross - StateExemptions, 0); double StateTaxTotal = Math.Round(state.Compute(StateTaxableGross), 2); double StateTax = Math.Round(StateTaxTotal / AnnualPayPeriods, 2); // Local double LocalGross = GrossForLocal.ToDouble() * AnnualPayPeriods; double LocalExemptions = local.Exemptions(status.StateLocalExemptions); double LocalTaxableGross = Math.Max(LocalGross - LocalExemptions, 0); double LocalTaxTotal = Math.Round(local.Compute(LocalTaxableGross), 2); double LocalTax = Math.Round(LocalTaxTotal / AnnualPayPeriods, 2); // Other calculations //double NetPay = GrossFed - SocSec - Medicare - FedTax - StateTax; //double AvgTaxRate = (SocSec + Medicare + FedTax + StateTax) / GrossFed; //double CompanyPayrollTaxes = FedTax + (2*SocSec )+ (2*Medicare); //double CompanyLiability = GrossFed + SocSec + Medicare; // If the income is not exempt, add the tax transactions if (!income.TaxExempt.FICA && SocSec != 0) income.Transactions.Add(NewTaxTransaction("Tax: SS", SocSec.ToMillicents(), income.Frequency, income.TargetAccount)); if (!income.TaxExempt.FICA && Medicare != 0) income.Transactions.Add(NewTaxTransaction("Tax: Medicare", Medicare.ToMillicents(), income.Frequency, income.TargetAccount)); if (!income.TaxExempt.Federal && FederalTax != 0) income.Transactions.Add(NewTaxTransaction("Tax: Federal", FederalTax.ToMillicents(), income.Frequency, income.TargetAccount)); if (!income.TaxExempt.State && StateTax != 0) income.Transactions.Add(NewTaxTransaction("Tax: State", StateTax.ToMillicents(), income.Frequency, income.TargetAccount)); if (!income.TaxExempt.Local && LocalTax != 0) income.Transactions.Add(NewTaxTransaction("Tax: Local", LocalTax.ToMillicents(), income.Frequency, income.TargetAccount)); }
private void OnLoaded(object sender, RoutedEventArgs e) { base.Loaded -= OnLoaded; m_RootIncome = m_RootIncomeOrig.DeepClone(); m_RootIncome.Transactions.Clear(); // Transactions will be rebuilt when the income is run base.DataContext = m_RootIncome; x_ListControl.ItemsSource = m_RootIncome.Deductions; string titleFormat = (m_bCreateNew ? "Add" : "Edit") + " the '{0}' income source"; x_Title.Text = string.Format(titleFormat, m_RootIncome.Name); }
public Boolean deleteIncome(Income obj) { try { IIncomeSvc svc = (IIncomeSvc)this.getService(typeof(IIncomeSvc).Name); return svc.deleteIncome(obj); } catch (ServiceLoadException ex) { return false; } }
public Income selectIncomeById(Income obj) { try { IIncomeSvc svc = (IIncomeSvc)this.getService(typeof(IIncomeSvc).Name); return svc.selectIncomeById(obj); } catch (ServiceLoadException ex) { return null; } }
public Income selectIncomeById(Income obj) { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Incomes.SqlQuery("dbo.SelectIncomeById @IncomeId='" + obj.IncomeId.ToString() + "'").Single(); } catch (Exception ex) { return null; } }
public Boolean insertIncome(Income obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { db.Incomes.Add(obj); db.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
public IncomeDialog(Income income, bool bCreateNew) : base() { InitializeComponent(); InitializeDialogPanel(true/*bModal*/, x_StartDate); base.Loaded += OnLoaded; base.Closed += OnDialogClosed; base.DataContext = null; m_RootIncomeOrig = income; m_bCreateNew = bCreateNew; if (bCreateNew) { ProfileDate startProfileDate = ProfileCode.StartOfPlan.ToProfileDate();// or App.Model.ProfileHolder.Profile.StartProfileDate, or DateTime.Now.ToJulian() ProfileDate endProfileDate = ProfileCode.EndOfPlan.ToProfileDate();// or App.Model.ProfileHolder.Profile.EndProfileDate; m_RootIncomeOrig.SetDates(startProfileDate, endProfileDate); } }
public Boolean deleteIncome(Income obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Income Income = db.Incomes.SqlQuery("dbo.SelectIncomeById @IncomeId='" + obj.IncomeId.ToString() + "'").Single(); if (Income != null) { db.Incomes.Remove(Income); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public void UpdateIncome(Income income) { _repository.Income.Update(income); }
public static void TransferFromMssqlToMysql() { var mssqlData = new SupermarketChainMssqlData(); var mySqlData = new SupermarketChainMySqlData(); var mySqlVendors = mssqlData.Vendors.All().ToList(); var mySqlMeasure = mssqlData.Measures.All().ToList(); var mySqlProducts = mssqlData.Products.All().ToList(); var mySqlIncomes = mssqlData.Sales .All() .Select(s => new { Income = (s.Quantity * s.Product.Price), ProductId = s.ProductId }) .ToList(); foreach (var vendor in mySqlVendors) { var vendors = new Vendor() { Name = vendor.Name }; mySqlData.Vendors.Add(vendors); mySqlData.SaveChanges(); } foreach (var measure in mySqlMeasure) { var measures = new Measure() { Name = measure.Name }; mySqlData.Measures.Add(measures); mySqlData.SaveChanges(); } foreach (var product in mySqlProducts) { var products = new Product() { Name = product.Name, Price = product.Price, VendorId = mySqlData.Vendors.All().FirstOrDefault(v => v.Name == product.Vendor.Name).Id, MeasureId = mySqlData.Measures.All().FirstOrDefault(m => m.Name == product.Measure.Name).Id }; mySqlData.Products.Add(products); mySqlData.SaveChanges(); } foreach (var income in mySqlIncomes) { var incomes = new Income() { IncomeValue = income.Income, ProductId = income.ProductId }; mySqlData.Incomes.Add(incomes); mySqlData.SaveChanges(); } }
public void IssuingToSubdivisionTest() { var ask = Substitute.For <IInteractiveQuestion>(); ask.Question(string.Empty).ReturnsForAnyArgs(true); var baseParameters = Substitute.For <BaseParameters>(); baseParameters.ColDayAheadOfShedule.Returns(0); using (var uow = UnitOfWorkFactory.CreateWithoutRoot()) { var warehouse = new Warehouse(); uow.Save(warehouse); var sizeType = new SizeType(); uow.Save(sizeType); var nomenclatureType = new ItemsType { Name = "Тестовый тип номенклатуры", SizeType = sizeType }; uow.Save(nomenclatureType); var nomenclature = new Nomenclature { Name = "Тестовая номеклатура", Type = nomenclatureType }; uow.Save(nomenclature); var size = new Size { SizeType = sizeType }; var height = new Size(); uow.Save(size); uow.Save(height); var position1 = new StockPosition(nomenclature, 0, size, height); var subdivision = new Subdivision { Name = "Тестовое подразделение" }; uow.Save(subdivision); var place = new SubdivisionPlace { Name = "Тестовое место", Subdivision = subdivision }; uow.Save(place); var income = new Income { Warehouse = warehouse, Date = new DateTime(2017, 1, 1), Operation = IncomeOperations.Enter }; var incomeItem1 = income.AddItem(nomenclature); incomeItem1.Amount = 10; income.UpdateOperations(uow, ask); uow.Save(income); var expense = new Expense { Operation = ExpenseOperations.Object, Warehouse = warehouse, Subdivision = subdivision, Date = new DateTime(2018, 10, 22) }; var item1 = expense.AddItem(position1, 1); item1.SubdivisionPlace = place; //Обновление операций expense.UpdateOperations(uow, baseParameters, ask); uow.Save(expense); uow.Commit(); var listed = SubdivisionRepository.ItemsBalance(uow, subdivision); var balance = listed.First(); Assert.That(balance.Amount, Is.EqualTo(1)); Assert.That(balance.NomeclatureName, Is.EqualTo("Тестовая номеклатура")); Assert.That(balance.Place, Is.EqualTo("Тестовое место")); Assert.That(balance.WearPercent, Is.EqualTo(0m)); } }
public void Create(Income income) { _db.Incomes.Add(income); _db.SaveChanges(); }
public int InsertIncome(Income income) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("InsertIncome", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@IncomeID", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@IncomeName", SqlDbType.NVarChar).Value = income.IncomeName; connection.Open(); int result = cmd.ExecuteNonQuery(); return (int)cmd.Parameters["@IncomeID"].Value; } }
private void btnTouzhu_Click(object sender, EventArgs e) { Dictionary <String, List <SelectedTouzhu> > dic = new Dictionary <string, List <SelectedTouzhu> >(); SelectedTouzhu touzhu = null; foreach (DataGridViewRow row in dgPeilv.Rows) { //为什么要设置这个标志位,看不懂了 bool flag = false; if (row.Cells[5].Selected == true) { touzhu = new SelectedTouzhu(); touzhu.Zhudui = row.Cells[2].Value.ToString(); touzhu.Kedui = row.Cells[3].Value.ToString(); touzhu.Rangqiu = row.Cells[4].Value.ToString(); touzhu.Result = "胜"; touzhu.Peilv = Convert.ToDouble(row.Cells[5].Value); touzhu.Riqi = row.Cells[8].Value.ToString(); flag = true; if (flag) { String key = row.Cells[2].Value.ToString() + row.Cells[3].Value.ToString() + row.Cells[8].Value.ToString(); List <SelectedTouzhu> sel = null; if (dic.TryGetValue(key, out sel)) { sel.Add(touzhu); } else { sel = new List <SelectedTouzhu>(); sel.Add(touzhu); dic[key] = sel; } } } if (row.Cells[6].Selected == true) { touzhu = new SelectedTouzhu(); touzhu.Zhudui = row.Cells[2].Value.ToString(); touzhu.Kedui = row.Cells[3].Value.ToString(); touzhu.Rangqiu = row.Cells[4].Value.ToString(); touzhu.Result = "平"; touzhu.Peilv = Convert.ToDouble(row.Cells[6].Value); touzhu.Riqi = row.Cells[8].Value.ToString(); flag = true; if (flag) { String key = row.Cells[2].Value.ToString() + row.Cells[3].Value.ToString() + row.Cells[8].Value.ToString(); List <SelectedTouzhu> sel = null; if (dic.TryGetValue(key, out sel)) { sel.Add(touzhu); } else { sel = new List <SelectedTouzhu>(); sel.Add(touzhu); dic[key] = sel; } } } if (row.Cells[7].Selected == true) { touzhu = new SelectedTouzhu(); touzhu.Zhudui = row.Cells[2].Value.ToString(); touzhu.Kedui = row.Cells[3].Value.ToString(); touzhu.Rangqiu = row.Cells[4].Value.ToString(); touzhu.Result = "负"; touzhu.Peilv = Convert.ToDouble(row.Cells[7].Value); touzhu.Riqi = row.Cells[8].Value.ToString(); flag = true; if (flag) { String key = row.Cells[2].Value.ToString() + row.Cells[3].Value.ToString() + row.Cells[8].Value.ToString(); List <SelectedTouzhu> sel = null; if (dic.TryGetValue(key, out sel)) { sel.Add(touzhu); } else { sel = new List <SelectedTouzhu>(); sel.Add(touzhu); dic[key] = sel; } } } //if (flag) //{ // String key = row.Cells[2].Value.ToString() + row.Cells[3].Value.ToString()+row.Cells[8].Value.ToString(); // List<SelectedTouzhu> sel = null; // if (dic.TryGetValue(key, out sel)) // { // sel.Add(touzhu); // } // else // { // sel = new List<SelectedTouzhu>(); // sel.Add(touzhu); // dic[key] = sel; // } //} } long batchid = Convert.ToInt64(DateTime.Now.ToString("MMddhhmmss") + DateTime.Now.Millisecond); for (int i = 0; i < clbChuanJiang.Items.Count; i++) { if (clbChuanJiang.GetItemChecked(i)) { string chuanjiang = clbChuanJiang.GetItemText(clbChuanJiang.Items[i]); int chuan = Convert.ToInt32(chuanjiang.Substring(0, 1)); SaveTouzhu(dic, chuan, batchid); } } //这里插入income数据 Income income = new Income(); income.Amount = Convert.ToDouble(txtTouru.Text); income.IncomeType = "购奖"; income.OperateTime = DateTime.Now; income.Operator = "吴林"; income.TouzhuType = "竞彩足球"; income.TouzhuID = batchid; new IncomeDAL().InsertIncome(income); MessageBox.Show("投注成功!"); #region old code //int arrayCount = dic.Keys.Count; //int[] peilvCount = new int[arrayCount]; //List<SelectedTouzhu>[] selectedTouzhus = new List<SelectedTouzhu>[arrayCount]; //int counter = 0; //foreach (String key in dic.Keys) //{ // peilvCount[counter] = dic[key].Count; // selectedTouzhus[counter] = dic[key]; // counter++; //} //double maxNumber = Math.Pow(10, arrayCount); //int chuan = 2; //for (int i = 0; i < maxNumber; i++) //{ // int[] digits = new int[arrayCount]; // if (GetNoZeroCount(i,ref digits) == chuan) // { // //所在位置不大于对应数组的值 // if (NotLargeThanArray(i, peilvCount)) // { // List<SelectedTouzhu> composite = new List<SelectedTouzhu>(); // for (int j = 0; j < digits.Length; j++) // { // int digit = digits[j]; // if (digit != 0) // { // composite.Add(selectedTouzhus[j][digit-1]); // } // } // //将组合数据保存在数据库中 // string riqi = ""; // string zhudui=""; // string kedui=""; // string result = ""; // string peilv=""; // string beishu=""; // string rangqiu=""; // string jiangjin=""; // string Operator = ""; // string operatetime = ""; // foreach (SelectedTouzhu tou in composite) // { // riqi += tou.Riqi + ","; // zhudui += tou.Zhudui + ","; // kedui += tou.Kedui + ","; // result += tou.Result + ","; // peilv += tou.Peilv + ","; // rangqiu += tou.Rangqiu + ","; // } // zhudui = zhudui.Trim(','); // kedui = kedui.Trim(','); // result = result.Trim(','); // peilv = peilv.Trim(','); // rangqiu = rangqiu.Trim(','); // riqi = riqi.Trim(','); // TouzhuSpf touspf = new TouzhuSpf(); // touspf.Beishu = Convert.ToInt32(txtBeishu.Text); // touspf.Lucky = -1; //-1表示未验证是否中奖 // touspf.Operator = "吴林"; // touspf.OperateTime = DateTime.Now; // touspf.Jiangjin = "0"; // touspf.Zhudui = zhudui; // touspf.Kedui = kedui; // touspf.Result = result; // touspf.Peilv = peilv; // touspf.Rangqiu = rangqiu; // touspf.Riqi = riqi; // new TouzhuSpfDAL().InsertTouzhuSpf(touspf); // } // } //} //int[] peilvCount = new int[8]; //peilvCount[0] = 1; //peilvCount[1] = 1; //peilvCount[2] = 1; //peilvCount[3] = 1; //peilvCount[4] = 1; //peilvCount[5] = 1; //peilvCount[6] = 2; //peilvCount[7] = 1; ; //int peilvLenth = peilvCount.Length; //double maxNumber = Math.Pow(10, peilvLenth); //int chuan = 2; //for (int i = 0; i < maxNumber; i++) //{ // if (GetNoZeroCount(i) == chuan) // { // //所在位置不大于对应数组的值 // if (NotLargeThanArray(i, peilvCount)) // { // Console.WriteLine(i); // } // } //} #endregion }
public void UpdateOperations_IssuingMultipleRows_TwoNomenclatureSameNeedsTest() { var ask = Substitute.For <IInteractiveQuestion>(); ask.Question(string.Empty).ReturnsForAnyArgs(true); using (var uow = UnitOfWorkFactory.CreateWithoutRoot()) { var warehouse = new Warehouse(); uow.Save(warehouse); var sizeType = new SizeType(); var heightType = new SizeType(); uow.Save(sizeType); uow.Save(heightType); var nomenclatureType = new ItemsType { Name = "Тестовый тип номенклатуры", SizeType = sizeType }; uow.Save(nomenclatureType); var nomenclature = new Nomenclature { Type = nomenclatureType }; uow.Save(nomenclature); var size = new Size { SizeType = sizeType }; var height = new Size { SizeType = heightType }; uow.Save(size); uow.Save(height); var position1 = new StockPosition(nomenclature, 0, size, height); var nomenclature2 = new Nomenclature { Type = nomenclatureType }; uow.Save(nomenclature2); var position2 = new StockPosition(nomenclature2, 0, size, height); var protectionTools = new ProtectionTools { Name = "СИЗ для тестирования" }; protectionTools.AddNomeclature(nomenclature); protectionTools.AddNomeclature(nomenclature2); uow.Save(protectionTools); var norm = new Norm(); var normItem = norm.AddItem(protectionTools); normItem.Amount = 1; normItem.NormPeriod = NormPeriodType.Year; normItem.PeriodCount = 1; uow.Save(norm); var employee = new EmployeeCard(); employee.AddUsedNorm(norm); uow.Save(employee); uow.Commit(); var employeeSize = new EmployeeSize { Size = size, SizeType = sizeType, Employee = employee }; var employeeHeight = new EmployeeSize { Size = height, SizeType = heightType, Employee = employee }; employee.Sizes.Add(employeeSize); employee.Sizes.Add(employeeHeight); var income = new Income { Warehouse = warehouse, Date = new DateTime(2017, 1, 1), Operation = IncomeOperations.Enter }; var incomeItem1 = income.AddItem(nomenclature); incomeItem1.Amount = 10; var incomeItem2 = income.AddItem(nomenclature2); incomeItem2.Amount = 5; income.UpdateOperations(uow, ask); uow.Save(income); var expense = new Expense { Operation = ExpenseOperations.Employee, Warehouse = warehouse, Employee = employee, Date = new DateTime(2018, 10, 22) }; expense.AddItem(position1, 1); expense.AddItem(position2, 1); var baseParameters = Substitute.For <BaseParameters>(); baseParameters.ColDayAheadOfShedule.Returns(0); //Обновление операций expense.UpdateOperations(uow, baseParameters, ask); uow.Save(expense); uow.Commit(); expense.UpdateEmployeeWearItems(); //Тут ожидаем предложение перенести дату использование второй номенклатуры на год. ask.ReceivedWithAnyArgs().Question(String.Empty); Assert.That(employee.WorkwearItems[0].NextIssue, Is.EqualTo(new DateTime(2020, 10, 22)) ); } }
public void GetHashCode_Two_Objects() { var first = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; var second = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; Assert.AreNotSame(first, second); Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); }
public Income GetIncomeFromReader(IDataReader reader) { try { Income income = new Income ( DataAccessObject.IsNULL<int>(reader["IncomeID"]), DataAccessObject.IsNULL<string>(reader["IncomeName"]) ); return income; } catch(Exception ex) { return null; } }
internal static void Load(Document document) { // Load the income packages foreach (Income income in m_IncomePackages) { Income newIncome = new Income(income); document.Incomes.Add(newIncome); } // Load the spending packages foreach (Package package in m_SpendingPackages) { Package newPackage = new Package(package); document.Packages.Add(newPackage); } }
public static bool UpdateIncome(Income income) { SqlIncomeProvider sqlIncomeProvider = new SqlIncomeProvider(); return sqlIncomeProvider.UpdateIncome(income); }
public static int InsertIncome(Income income) { SqlIncomeProvider sqlIncomeProvider = new SqlIncomeProvider(); return sqlIncomeProvider.InsertIncome(income); }
private void SaveTouzhu(Dictionary <string, List <SelectedTouzhu> > dic, int chuanShu, string type) { int arrayCount = dic.Keys.Count; int[] peilvCount = new int[arrayCount]; List <SelectedTouzhu>[] selectedTouzhus = new List <SelectedTouzhu> [arrayCount]; int counter = 0; int touru = 1; foreach (String key in dic.Keys) { peilvCount[counter] = dic[key].Count; selectedTouzhus[counter] = dic[key]; counter++; touru = touru * dic[key].Count; } double maxNumber = Math.Pow(10, arrayCount); int chuan = chuanShu; long batchid = Convert.ToInt64(DateTime.Now.ToString("MMddhhmmss") + DateTime.Now.Millisecond); for (int i = 0; i < maxNumber; i++) { int[] digits = new int[arrayCount]; if (GetNoZeroCount(i, ref digits) == chuan) { //所在位置不大于对应数组的值 if (NotLargeThanArray(i, peilvCount)) { List <SelectedTouzhu> composite = new List <SelectedTouzhu>(); for (int j = 0; j < digits.Length; j++) { int digit = digits[j]; if (digit != 0) { composite.Add(selectedTouzhus[j][digit - 1]); } } //将组合数据保存在数据库中 string riqi = ""; string zhudui = ""; string kedui = ""; string result = ""; string peilv = ""; string beishu = ""; string rangqiu = ""; string jiangjin = ""; string Operator = ""; string operatetime = ""; foreach (SelectedTouzhu tou in composite) { riqi += tou.Riqi + ","; zhudui += tou.Zhudui + ","; kedui += tou.Kedui + ","; result += tou.Result + ","; peilv += tou.Peilv + ","; rangqiu += tou.Rangqiu + ","; } zhudui = zhudui.Trim(','); kedui = kedui.Trim(','); result = result.Trim(','); peilv = peilv.Trim(','); rangqiu = rangqiu.Trim(','); riqi = riqi.Trim(','); TouzhuSpf touspf = new TouzhuSpf(); touspf.Beishu = 1000; touspf.Lucky = -1; //-1表示未验证是否中奖 touspf.Operator = "吴林"; touspf.OperateTime = DateTime.Now; touspf.Jiangjin = "0"; touspf.Zhudui = zhudui; touspf.Kedui = kedui; touspf.Result = result; touspf.Peilv = peilv; touspf.Rangqiu = rangqiu; touspf.Riqi = riqi; touspf.BatchID = batchid; new TouzhuSpfDAL().InsertTouzhuSpf(touspf); } } } //这里插入income数据 Income income = new Income(); //income.Amount = Convert.ToDouble(txtTouru.Text); income.Amount = touru * 1000.0 * 2; income.IncomeType = "购奖"; income.OperateTime = DateTime.Now; income.Operator = "吴林"; income.TouzhuType = type; income.TouzhuID = batchid; new IncomeDAL().InsertIncome(income); }
public string Info() { return("Firma: " + Title + "\nOsoite: " + Address + "\nPuhelinnumero: " + Phone.ToString() + "\nTulot: " + Income.ToString() + "\nMenot: " + Expense.ToString()); }
public void UpdateEmployeeWearItems_NextIssueDiffIdsTest() { NewSessionWithSameDB(); var ask = Substitute.For <IInteractiveQuestion>(); ask.Question(string.Empty).ReturnsForAnyArgs(true); using (var uow = UnitOfWorkFactory.CreateWithoutRoot()) { var warehouse = new Warehouse(); uow.Save(warehouse); var sizeType = new SizeType(); var heightType = new SizeType(); uow.Save(sizeType); uow.Save(heightType); var nomenclatureType = new ItemsType { Name = "Тестовый тип номенклатуры", SizeType = sizeType }; uow.Save(nomenclatureType); //Поднимаем id номенклатуры до 2. uow.Save(new Nomenclature()); var nomenclature = new Nomenclature { Type = nomenclatureType }; uow.Save(nomenclature); var size = new Size { SizeType = sizeType }; var height = new Size { SizeType = heightType }; uow.Save(size); uow.Save(height); var position1 = new StockPosition(nomenclature, 0, size, height); //Поднимаем id сиза до 3. uow.Save(new ProtectionTools { Name = "Id = 1" }); uow.Save(new ProtectionTools { Name = "Id = 2" }); var protectionTools = new ProtectionTools { Name = "СИЗ для тестирования" }; protectionTools.AddNomeclature(nomenclature); uow.Save(protectionTools); var norm = new Norm(); var normItem = norm.AddItem(protectionTools); normItem.Amount = 1; normItem.NormPeriod = NormPeriodType.Month; normItem.PeriodCount = 1; uow.Save(norm); var employee = new EmployeeCard(); employee.AddUsedNorm(norm); uow.Save(employee); uow.Commit(); var income = new Income { Warehouse = warehouse, Date = new DateTime(2017, 1, 1), Operation = IncomeOperations.Enter }; var incomeItem1 = income.AddItem(nomenclature); incomeItem1.Amount = 10; income.UpdateOperations(uow, ask); uow.Save(income); var expense = new Expense { Operation = ExpenseOperations.Employee, Warehouse = warehouse, Employee = employee, Date = new DateTime(2018, 10, 22) }; expense.AddItem(position1, 1); var baseParameters = Substitute.For <BaseParameters>(); baseParameters.ColDayAheadOfShedule.Returns(0); //Обновление операций expense.UpdateOperations(uow, baseParameters, ask); uow.Save(expense); uow.Commit(); expense.UpdateEmployeeWearItems(); uow.Commit(); using (var uow2 = UnitOfWorkFactory.CreateWithoutRoot()) { var employeeTest = uow2.GetById <EmployeeCard>(employee.Id); Assert.That(employeeTest.WorkwearItems[0].NextIssue, Is.EqualTo(new DateTime(2018, 11, 22))); } } }
public List <Income> GetFilteredList(Income model) { throw new NotImplementedException(); }
public void Update(Income item) { dbContext.Entry(item).State = EntityState.Modified; dbContext.SaveChanges(); }
private void DrawCharts() { App.Current.Dispatcher.Invoke((System.Action) delegate { IncomeSeries = new SeriesCollection { new LineSeries { Title = "Income", Values = Income.AsChartValues(), Stroke = Brushes.LightGray, }, }; FluidLevelSeries = new SeriesCollection { new LineSeries { Title = "Fluid level", Values = FluidLevel.AsChartValues(), Stroke = Brushes.LightGray }, }; if (Hours.Count > 0) { WorkingSeries1 = new SeriesCollection { new LineSeries { Title = "Time", Values = Hours[0].Hours.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Hours.Count > 1) { WorkingSeries2 = new SeriesCollection { new LineSeries { Title = "Time", Values = Hours[1].Hours.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Hours.Count > 2) { WorkingSeries3 = new SeriesCollection { new LineSeries { Title = "Time", Values = Hours[2].Hours.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Flows.Count > 0) { FlowSeries1 = new SeriesCollection { new LineSeries { Title = "Flow", Values = Flows[0].Flows.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Flows.Count > 1) { FlowSeries2 = new SeriesCollection { new LineSeries { Title = "Flow", Values = Flows[1].Flows.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Flows.Count > 2) { FlowSeries3 = new SeriesCollection { new LineSeries { Title = "Flow", Values = Flows[2].Flows.AsChartValues(), Stroke = Brushes.LightGray }, }; } }); }
public void Delete(Income income) { this.dbContext.Incomes.Remove(income); this.dbContext.SaveChanges(); }
public void Post([FromForm] Income value) { unitOfWork.RegisterNewObject(value); unitOfWork.Commit(); }
//修改收入 public bool SaveEdit(Income income) { return(incomeService.SaveEdit(income)); }
public void alljisuan(Model.Orders orders, OleDbTransaction tr) { BLL.OrdersBLL orderBLL = new BLL.OrdersBLL(); DAL.IncomeDal incomeDal = new DAL.IncomeDal(); //Step 1 #region 首先取出这个人的信息 Agents agents = DataBase.Base_getFirst <Agents>("select * from Agents where Id = '" + orders.AgentId + "' and State != 0", tr); agents.State = Convert.ToInt32(MyData.AgentsState.正常); Model.Income income = new Income(); income = incomeDal.getIncomebyId(orders.YearMonth, agents.Id, tr); bool isinsert = false; //判断数据是插入还是修改 bool isTrue = false; //推荐人或者代理人或者合伙人是否存在 if (income == null || String.IsNullOrWhiteSpace(income.AgentId)) { isinsert = true; income.YearMonth = orders.YearMonth; income.AgentId = agents.Id; income.AgentName = agents.Name; income.CareerStatus = agents.CareerStatus; income.Rank = agents.Rank; income.RefereeId = agents.RefereeId; income.RefereeName = agents.RefereeName; income.AgencyName = agents.AgencyName; income.AgencyId = agents.AgencyId; income.CreateTime = DateTime.Now; income.CreatePerson = orders.CreatePerson; income.LastMonthMoney = orderBLL.getOneMonthPrice(agents.Id, tr); income.NearlyTwoMonthsMoney = orderBLL.getTwoMonthPrice(agents.Id, tr); income.NearlyThreeMonthsMoney = orderBLL.getThreeMonthPrice(agents.Id, tr); income.NearlyFiveMonthsMoney = orderBLL.getFiveMonthPrice(agents.Id, tr); income.NearlySixMonthsMoney = orderBLL.getSixMonthPrice(agents.Id, tr); income.AllMonthMoney = orderBLL.getAllMonthPrice(agents.Id, tr); income.State = Convert.ToInt32(MyData.IncomeState.正常); } income.AllMonthMoney += orders.Price; //计算截至目前当月个人订单分成 income.UpdateTime = DateTime.Now; income.UpdatePerson = orders.UpdatePerson; income.PersonalMoney += orders.Price; //计算个人订单分成 jisuanGerenDingdanFencheng(income); //计算总收入=VIP顾客销售奖金+个人订单返利+市场推广服务费+区域管理服务费+业绩分红 income.IncomeMoney = income.SalesServiceMoney + income.PersonalServiceMoney + income.MarketServiceMoney + income.RegionServiceMoney + income.RegionServiceYum; incomeDal.InsertOrUpdateIncome(tr, income, isinsert); #endregion //Step 2 #region 计算推荐人的销售奖金 if (!String.IsNullOrWhiteSpace(agents.RefereeId)) { Model.Income income_t = new Income(); income_t = incomeDal.getIncomebyId(orders.YearMonth, agents.RefereeId, tr); isinsert = false; if (income_t == null || String.IsNullOrWhiteSpace(income_t.AgentId)) { isinsert = true; Agents agents_t = DataBase.Base_getFirst <Agents>("select * from Agents where Id = '" + agents.RefereeId + "' and State != 0", tr); if (agents_t != null && !String.IsNullOrWhiteSpace(agents_t.Id)) { isTrue = true; income_t.YearMonth = orders.YearMonth; income_t.AgentId = agents_t.Id; income_t.AgentName = agents_t.Name; income_t.CareerStatus = agents_t.CareerStatus; income_t.Rank = agents_t.Rank; income_t.RefereeId = agents_t.RefereeId; income_t.RefereeName = agents_t.RefereeName; income_t.AgencyName = agents_t.AgencyName; income_t.AgencyId = agents_t.AgencyId; income_t.CreateTime = DateTime.Now; income_t.CreatePerson = orders.CreatePerson; income_t.LastMonthMoney = orderBLL.getOneMonthPrice(agents_t.Id, tr); income_t.NearlyTwoMonthsMoney = orderBLL.getTwoMonthPrice(agents_t.Id, tr); income_t.NearlyThreeMonthsMoney = orderBLL.getThreeMonthPrice(agents_t.Id, tr); income_t.NearlyFiveMonthsMoney = orderBLL.getFiveMonthPrice(agents_t.Id, tr); income_t.NearlySixMonthsMoney = orderBLL.getSixMonthPrice(agents_t.Id, tr); income_t.AllMonthMoney = orderBLL.getAllMonthPrice(agents_t.Id, tr); income_t.AllSalesMoney = incomeDal.getLastAllSalesMoney(" and YearMonth<=" + MyData.Utils.getLastYearMonth(), tr); income_t.State = Convert.ToInt32(MyData.IncomeState.正常); } } else { isTrue = true; } if (isTrue == true) { income_t.UpdateTime = DateTime.Now; income_t.UpdatePerson = orders.UpdatePerson; income_t.SalesMoney += orders.Price; income_t.AllSalesMoney += orders.Price; //计算个人VIP顾客销售奖金 jisuanTuijianrenVipJiangjin(income_t, tr); //如果为代理商,由此订单产生的市场推广服务费加到个人身上 if (agents.Rank.StartsWith("P") || agents.Rank.StartsWith("D")) { income_t.MarketMoney += orders.Price; jisuanShichangTuiguangFuwufei(income_t); } //计算总收入=VIP顾客销售奖金+个人订单返利+市场推广服务费+区域管理服务费+业绩分红 income_t.IncomeMoney = income_t.SalesServiceMoney + income_t.PersonalServiceMoney + income_t.MarketServiceMoney + income_t.RegionServiceMoney + income_t.RegionServiceYum; incomeDal.InsertOrUpdateIncome(tr, income_t, isinsert); } } #endregion //Step 3 #region 计算市场服务费分成 Agents agents_s = new Agents(); if (!String.IsNullOrWhiteSpace(agents.AgencyId)) { if (agents.Rank.StartsWith("S"))//如果为代理人,市场推广服务费添加到资深代理商身上 { agents_s = DataBase.Base_getFirst <Agents>("select * from Agents where Id = '" + agents.AgencyId + "' and State != 0", tr); Model.Income income_s = new Income(); income_s = incomeDal.getIncomebyId(orders.YearMonth, agents.AgencyId, tr); isinsert = false; isTrue = false; if (income_s == null || String.IsNullOrWhiteSpace(income_s.AgentId)) { isinsert = true; if (agents_s != null && !String.IsNullOrWhiteSpace(agents_s.Id)) { isTrue = true; income_s.YearMonth = orders.YearMonth; income_s.AgentId = agents_s.Id; income_s.AgentName = agents_s.Name; income_s.CareerStatus = agents_s.CareerStatus; income_s.Rank = agents_s.Rank; income_s.RefereeId = agents_s.RefereeId; income_s.RefereeName = agents_s.RefereeName; income_s.AgencyName = agents_s.AgencyName; income_s.AgencyId = agents_s.AgencyId; income_s.CreateTime = DateTime.Now; income_s.UpdateTime = DateTime.Now; income_s.LastMonthMoney = orderBLL.getOneMonthPrice(agents_s.Id, tr); income_s.NearlyTwoMonthsMoney = orderBLL.getTwoMonthPrice(agents_s.Id, tr); income_s.NearlyThreeMonthsMoney = orderBLL.getThreeMonthPrice(agents_s.Id, tr); income_s.NearlyFiveMonthsMoney = orderBLL.getFiveMonthPrice(agents_s.Id, tr); income_s.NearlySixMonthsMoney = orderBLL.getSixMonthPrice(agents_s.Id, tr); income_s.AllMonthMoney = orderBLL.getAllMonthPrice(agents_s.Id, tr); income_s.State = Convert.ToInt32(MyData.IncomeState.正常); } } else { isTrue = true; } if (isTrue == true) { income_s.UpdateTime = DateTime.Now; income_s.UpdatePerson = orders.UpdatePerson; income_s.MarketMoney += orders.Price; jisuanShichangTuiguangFuwufei(income_s); //计算总收入=VIP顾客销售奖金+个人订单返利+市场推广服务费+区域管理服务费+业绩分红 income_s.IncomeMoney = income_s.SalesServiceMoney + income_s.PersonalServiceMoney + income_s.MarketServiceMoney + income_s.RegionServiceMoney + income_s.RegionServiceYum; incomeDal.InsertOrUpdateIncome(tr, income_s, isinsert); } } //如果为代理商则加到自己身上 //写在了step2 } #endregion //step 4 //计算区域管理服务费 //只有当前订单所有人是代理人才会计算区域管理服务费 if (agents_s != null && !String.IsNullOrWhiteSpace(agents_s.AgencyId))//判断资深代理商是否存在 { isinsert = false; isTrue = false; //查找资深代理商的资深代理商(A),添加到A的一级区域管理服务费 Agents agents_s1 = DataBase.Base_getFirst <Agents>("select * from Agents where Id = '" + agents_s.AgencyId + "' and State != 0", tr); if (agents_s1 != null && !String.IsNullOrWhiteSpace(agents_s1.Id)) { //计算一级区域管理费,如果为初级代理商,则不计算一级二级和三级区域管理费 if ((agents_s1.Rank.StartsWith("D") || agents_s1.Rank.StartsWith("P")) && agents_s1.Rank != "D1") { isTrue = true; Model.Income income_s1 = new Income(); income_s1 = incomeDal.getIncomebyId(orders.YearMonth, agents_s1.Id, tr); if (income_s1 == null || String.IsNullOrWhiteSpace(income_s1.AgentId)) { isinsert = true; income_s1.YearMonth = orders.YearMonth; income_s1.AgentId = agents_s1.Id; income_s1.AgentName = agents_s1.Name; income_s1.CareerStatus = agents_s1.CareerStatus; income_s1.Rank = agents_s1.Rank; income_s1.RefereeId = agents_s1.RefereeId; income_s1.RefereeName = agents_s1.RefereeName; income_s1.AgencyName = agents_s1.AgencyName; income_s1.AgencyId = agents_s1.AgencyId; income_s1.CreateTime = DateTime.Now; income_s1.UpdateTime = DateTime.Now; income_s1.LastMonthMoney = orderBLL.getOneMonthPrice(agents_s1.Id, tr); income_s1.NearlyTwoMonthsMoney = orderBLL.getTwoMonthPrice(agents_s1.Id, tr); income_s1.NearlyThreeMonthsMoney = orderBLL.getThreeMonthPrice(agents_s1.Id, tr); income_s1.NearlyFiveMonthsMoney = orderBLL.getFiveMonthPrice(agents_s1.Id, tr); income_s1.NearlySixMonthsMoney = orderBLL.getSixMonthPrice(agents_s1.Id, tr); income_s1.AllMonthMoney = orderBLL.getAllMonthPrice(agents_s1.Id, tr); income_s1.State = Convert.ToInt32(MyData.IncomeState.正常); } income_s1.UpdateTime = DateTime.Now; income_s1.UpdatePerson = orders.UpdatePerson; income_s1.OneMoney += orders.Price; jisuanQuyuGuanliFuwufei(income_s1); //计算总收入=VIP顾客销售奖金+个人订单返利+市场推广服务费+区域管理服务费+业绩分红 income_s1.IncomeMoney = income_s1.SalesServiceMoney + income_s1.PersonalServiceMoney + income_s1.MarketServiceMoney + income_s1.RegionServiceMoney + income_s1.RegionServiceYum; incomeDal.InsertOrUpdateIncome(tr, income_s1, isinsert); } //计算二级区域管理费 if (!String.IsNullOrWhiteSpace(agents_s1.AgencyId)) { Agents agents_s2 = DataBase.Base_getFirst <Agents>("select * from Agents where Id = '" + agents_s1.AgencyId + "' and State != 0", tr); if (agents_s2 != null && !String.IsNullOrWhiteSpace(agents_s2.Id)) { //如果为高级代理商及以下,则不计算二级和三级区域管理费 if ((agents_s2.Rank.StartsWith("D") || agents_s2.Rank.StartsWith("P")) && agents_s2.Rank != "D1" && agents_s2.Rank != "D2") { isTrue = true; Model.Income income_s2 = new Income(); income_s2 = incomeDal.getIncomebyId(orders.YearMonth, agents_s2.Id, tr); if (income_s2 == null || String.IsNullOrWhiteSpace(income_s2.AgentId)) { isinsert = true; income_s2.YearMonth = orders.YearMonth; income_s2.AgentId = agents_s2.Id; income_s2.AgentName = agents_s2.Name; income_s2.CareerStatus = agents_s2.CareerStatus; income_s2.Rank = agents_s2.Rank; income_s2.RefereeId = agents_s2.RefereeId; income_s2.RefereeName = agents_s2.RefereeName; income_s2.AgencyName = agents_s2.AgencyName; income_s2.AgencyId = agents_s2.AgencyId; income_s2.CreateTime = DateTime.Now; income_s2.UpdateTime = DateTime.Now; income_s2.LastMonthMoney = orderBLL.getOneMonthPrice(agents_s2.Id, tr); income_s2.NearlyTwoMonthsMoney = orderBLL.getTwoMonthPrice(agents_s2.Id, tr); income_s2.NearlyThreeMonthsMoney = orderBLL.getThreeMonthPrice(agents_s2.Id, tr); income_s2.NearlyFiveMonthsMoney = orderBLL.getFiveMonthPrice(agents_s2.Id, tr); income_s2.NearlySixMonthsMoney = orderBLL.getSixMonthPrice(agents_s2.Id, tr); income_s2.AllMonthMoney = orderBLL.getAllMonthPrice(agents_s2.Id, tr); income_s2.State = Convert.ToInt32(MyData.IncomeState.正常); } income_s2.UpdateTime = DateTime.Now; income_s2.UpdatePerson = orders.UpdatePerson; income_s2.OneMoney += orders.Price; jisuanQuyuGuanliFuwufei(income_s2); //计算总收入=VIP顾客销售奖金+个人订单返利+市场推广服务费+区域管理服务费+业绩分红 income_s2.IncomeMoney = income_s2.SalesServiceMoney + income_s2.PersonalServiceMoney + income_s2.MarketServiceMoney + income_s2.RegionServiceMoney + income_s2.RegionServiceYum; incomeDal.InsertOrUpdateIncome(tr, income_s2, isinsert); } //计算三级区域管理费 Agents agents_s3 = DataBase.Base_getFirst <Agents>("select * from Agents where Id = '" + agents_s2.AgencyId + "' and State != 0", tr); if (agents_s3 != null && !String.IsNullOrWhiteSpace(agents_s3.Id)) { //如果为区域代理商及以下,则不计算三级区域管理费 if ((agents_s3.Rank.StartsWith("D") || agents_s3.Rank.StartsWith("P")) && agents_s3.Rank != "D1" && agents_s2.Rank != "D1" && agents_s2.Rank != "D2" && agents_s2.Rank != "D3") { isTrue = true; Model.Income income_s3 = new Income(); income_s3 = incomeDal.getIncomebyId(orders.YearMonth, agents_s3.Id, tr); if (income_s3 == null || String.IsNullOrWhiteSpace(income_s3.AgentId)) { isinsert = true; income_s3.YearMonth = orders.YearMonth; income_s3.AgentId = agents_s3.Id; income_s3.AgentName = agents_s3.Name; income_s3.CareerStatus = agents_s3.CareerStatus; income_s3.Rank = agents_s3.Rank; income_s3.RefereeId = agents_s3.RefereeId; income_s3.RefereeName = agents_s3.RefereeName; income_s3.AgencyName = agents_s3.AgencyName; income_s3.AgencyId = agents_s3.AgencyId; income_s3.CreateTime = DateTime.Now; income_s3.UpdateTime = DateTime.Now; income_s3.LastMonthMoney = orderBLL.getOneMonthPrice(agents_s3.Id, tr); income_s3.NearlyTwoMonthsMoney = orderBLL.getTwoMonthPrice(agents_s3.Id, tr); income_s3.NearlyThreeMonthsMoney = orderBLL.getThreeMonthPrice(agents_s3.Id, tr); income_s3.NearlyFiveMonthsMoney = orderBLL.getFiveMonthPrice(agents_s3.Id, tr); income_s3.NearlySixMonthsMoney = orderBLL.getSixMonthPrice(agents_s3.Id, tr); income_s3.AllMonthMoney = orderBLL.getAllMonthPrice(agents_s3.Id, tr); income_s3.State = Convert.ToInt32(MyData.IncomeState.正常); } income_s3.UpdateTime = DateTime.Now; income_s3.UpdatePerson = orders.UpdatePerson; income_s3.OneMoney += orders.Price; jisuanQuyuGuanliFuwufei(income_s3); //计算总收入=VIP顾客销售奖金+个人订单返利+市场推广服务费+区域管理服务费+业绩分红 income_s3.IncomeMoney = income_s3.SalesServiceMoney + income_s3.PersonalServiceMoney + income_s3.MarketServiceMoney + income_s3.RegionServiceMoney + income_s3.RegionServiceYum; incomeDal.InsertOrUpdateIncome(tr, income_s3, isinsert); } } } } } } //step 6 修改agents UpdateAgents(agents, income, tr); }
public void Add(Income income) { context.Income.Add(income); this.LastAddedObject = income; }
public void AddNewItem(Income newIncome) { unitOfWork.RegisterNewObject(newIncome); unitOfWork.Commit(); }
public UserDto Handle(NewUserCommand request) { using (var context = new BoilerDbContext()) { var newUser = new User(); var balance = new Balance(); #region Handle expense // var expense = _dbContext.Expenses.Where(item => item.UserId == request.) #endregion using (var trans = context.Database.BeginTransaction()) { try { newUser = new User() { Firstname = request.Firstname, Middlename = request.Middlename, Lastname = request.Lastname, Age = request.Age }; _dbContext.Users.Add(newUser); _dbContext.SaveChanges(); var income = new Income() { UserId = newUser.Id, Date = request.IncomeDate, Description = request.Description, Total = request.Total, Remarks = request.Remarks }; _dbContext.Incomes.Add(income); _dbContext.SaveChanges(); balance = new Balance() { UserId = newUser.Id, BalanceDate = request.IncomeDate, TotalBalance = request.Total, CarriedOver = false }; _dbContext.Balances.Add(balance); _dbContext.SaveChanges(); } catch (Exception error) { throw new Exception("Something went wrong"); } } var newUserDto = new UserDto() { Firstname = request.Firstname, Lastname = request.Lastname, Middlename = request.Middlename, Age = request.Age, TotalIncome = request.Total, Balance = balance.TotalBalance, Id = newUser.Id }; return(newUserDto); } }
public void GetHashCode_One_Object() { var Income = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; Assert.AreEqual(Income.GetHashCode(), Income.GetHashCode()); }
public void DeleteIncome(Income income) { _repository.Income.Delete(income); }
// Invoice // Income // Recievable // Sales // Stock // StockOut // Transaction public async Task <WrapperSalesListVM> AddSalesAsync(SalesVM salesVM) { // Invoice Invoice invoiceToAdd = new Invoice(); invoiceToAdd = _utilService.Mapper.Map <SalesVM, Invoice>(salesVM); _repositoryWrapper.Invoice.Create(invoiceToAdd); // Setting Up Invoice Id salesVM.InvoiceId = invoiceToAdd.Id; foreach (var item in salesVM.ItemList) { item.InvoiceId = invoiceToAdd.Id; } // Income Income incomeToAdd = new Income(); incomeToAdd = this._utilService.Mapper.Map <SalesVM, Income>(salesVM); _repositoryWrapper.Income.Create(incomeToAdd); // Recievable Recievable recievableToAdd = new Recievable(); recievableToAdd = _utilService.Mapper.Map <SalesVM, Recievable>(salesVM); _repositoryWrapper.Recievable.Create(recievableToAdd); // Sales List <Sales> listOfSalesToAdd = new List <Sales>(); listOfSalesToAdd = _utilService.Mapper.Map <List <SalesItemVM>, List <Sales> >(salesVM.ItemList); _repositoryWrapper.Sales.CreateAll(listOfSalesToAdd); // Stock Stock stockToAdd = new Stock(); IEnumerable <Stock> stockList = await _repositoryWrapper.Stock.FindByConditionAsync(x => x.FactoryId == salesVM.FactoryId); for (int i = 0; i < salesVM.ItemList.Count; i++) { Stock existingStock = stockList.ToList().Where(x => x.ItemId == salesVM.ItemList[i].Item.Id && x.ItemStatusId == salesVM.ItemList[i].ItemStatus.Id).FirstOrDefault(); if (existingStock == null) { var getDatalistVM2 = new GetDataListVM() { FactoryId = salesVM.FactoryId, PageNumber = 1, PageSize = 10 }; WrapperSalesListVM dataToReturn = await GetAllSalesAsync(getDatalistVM2); dataToReturn.HasMessage = true; dataToReturn.Message = "Stock Is Empty"; return(dataToReturn); // _utilService.Log("Stock Is Empty. Not Enough Stock available"); // throw new StockEmptyException(); } else { if (existingStock.Quantity >= salesVM.ItemList[i].Quantity) { existingStock.Quantity -= salesVM.ItemList[i].Quantity; _repositoryWrapper.Stock.Update(existingStock); } else { _utilService.Log("Stock Is Empty"); return(new WrapperSalesListVM()); } } } // StockOut List <StockOut> stockOutsToAdd = new List <StockOut>(); stockOutsToAdd = _utilService.Mapper.Map <List <SalesItemVM>, List <StockOut> >(salesVM.ItemList); _repositoryWrapper.StockOut.CreateAll(stockOutsToAdd); // Transaction TblTransaction transactionRecieved = new TblTransaction(); transactionRecieved = _utilService.Mapper.Map <SalesVM, TblTransaction>(salesVM); transactionRecieved.Amount = salesVM.PaidAmount; transactionRecieved.PaymentStatus = PAYMENT_STATUS.CASH_RECIEVED.ToString(); transactionRecieved.TransactionType = TRANSACTION_TYPE.CREDIT.ToString(); _repositoryWrapper.Transaction.Create(transactionRecieved); //TblTransaction transactionRecievable = new TblTransaction(); //transactionRecievable = _utilService.Mapper.Map<SalesVM, TblTransaction>(salesVM); //transactionRecievable.Amount = salesVM.DueAmount; //transactionRecievable.PaymentStatus = PAYMENT_STATUS.CASH_RECIEVABLE.ToString(); //transactionRecievable.TransactionType = TRANSACTION_TYPE.NOT_YET_EXECUTED.ToString(); //transactionRecievable.TransactionId = transactionRecieved.TransactionId; //_repositoryWrapper.Transaction.Create(transactionRecievable); Task <int> Invoice = _repositoryWrapper.Invoice.SaveChangesAsync(); Task <int> Income = _repositoryWrapper.Income.SaveChangesAsync(); Task <int> Recievable = _repositoryWrapper.Recievable.SaveChangesAsync(); Task <int> Sales = _repositoryWrapper.Sales.SaveChangesAsync(); Task <int> Stock = _repositoryWrapper.Stock.SaveChangesAsync(); Task <int> StockOut = _repositoryWrapper.StockOut.SaveChangesAsync(); Task <int> Transaction = _repositoryWrapper.Transaction.SaveChangesAsync(); await Task.WhenAll(Invoice, Income, Recievable, Sales, Stock, StockOut, Transaction); var getDatalistVM = new GetDataListVM() { FactoryId = salesVM.FactoryId, PageNumber = 1, PageSize = 10 }; return(await GetAllSalesAsync(getDatalistVM)); }
//Income public void AddIncome(Income income) { _repository.Income.Add(income); }
private void btnOK_Click(object sender, RoutedEventArgs e) { using (ApplicationDBContext context = new ApplicationDBContext()) { #region if ((Convert.ToInt32(txtPlastik.Text) + Convert.ToInt32(txtNaqt.Text) + Convert.ToInt32(txtQarz.Text)) == Convert.ToInt32(_SkidkaSum)) { if (checkQarz.IsChecked == true) { if (txtQarz.Text != "0" && txtQarz.Text != "") { var q = (from a in context.DebtInfos where a.FIO == txtFIO_Qarzdor.Text select a).FirstOrDefault(); if (q != null) { Income i = new Income() { CashIncome = Convert.ToDecimal(txtNaqt.Text), PlasticIncome = Convert.ToDecimal(txtPlastik.Text), DateTimeNow = DateTime.Now, DebtIncome = 0, DebtOut = Convert.ToDecimal(txtQarz.Text), SaleProductPrice = Convert.ToDecimal(_AllSum), SaleProductWithDiscountPrice = Convert.ToDecimal(_SkidkaSum), Vozvrat = 0, WorkerId = Properties.Settings.Default.UserId }; Debt d = new Debt() { dateTimeFrom = DateTime.Now, dateTimeUntil = (DateTime)date1.SelectedDate, Price = Convert.ToDecimal(txtQarz.Text), DebtInfoId = q.Id }; context.Incomes.Add(i); context.Debts.Add(d); var o = (from b in context.Kassas .Include(x => x.Partiya) .Include(x => x.Partiya.Product) .Include(x => x.Partiya.Product.Massa) .Include(x => x.Partiya.Product.Types) .Include(x => x.Partiya.Provider) where b.WorkerID == Properties.Settings.Default.UserId select b).ToList(); /* * Check chiqarish uchun kod */ if (checkPrintCheck.IsChecked == true) { Print(); } /* */ foreach (var t in o) { Sold s = new Sold() { ProductId = t.Partiya.Product.Id, Shtrix = t.Partiya.Product.Shtrix, NameOfProduct = t.Partiya.Product.NameOfProduct, PartiyaId = t.Partiya.Id, BazaPrice = t.Partiya.BazaPrice, SalePrice = t.Partiya.SalePrice, CountProduct = t.CountProduct, ProviderId = t.Partiya.Provider.Id, ProviderName = t.Partiya.Provider.ProviderName, MassaId = t.Partiya.Product.Massa.Id, MassaName = t.Partiya.Product.Massa.Name, TypeId = t.Partiya.Product.Types.Id, TypeName = t.Partiya.Product.Types.TypeName, AllSumma = t.AllPrice, WorkerId = Properties.Settings.Default.UserId, dateTimeNow = DateTime.Now }; context.Solds.Add(s); var y = (from c in context.Partiyas .Include(x => x.Product) where t.Partiya.Id == c.Id select c).FirstOrDefault(); y.CountProduct -= t.CountProduct; context.Kassas.Remove(t); } MainWindow m = new MainWindow(); m.labSkidka.Text = "0"; m.txtSkidkaSumm.Text = "0"; context.SaveChanges(); this.Close(); } } else { MessageBox.Show("Ошибка с долгом!"); } } else { Income i = new Income() { CashIncome = Convert.ToDecimal(txtNaqt.Text), PlasticIncome = Convert.ToDecimal(txtPlastik.Text), DateTimeNow = DateTime.Now, DebtIncome = 0, DebtOut = Convert.ToDecimal(txtQarz.Text), SaleProductPrice = Convert.ToDecimal(_AllSum), SaleProductWithDiscountPrice = Convert.ToDecimal(_SkidkaSum), Vozvrat = 0, WorkerId = Properties.Settings.Default.UserId }; context.Incomes.Add(i); var o = (from b in context.Kassas .Include(x => x.Partiya) .Include(x => x.Partiya.Product) .Include(x => x.Partiya.Product.Massa) .Include(x => x.Partiya.Product.Types) .Include(x => x.Partiya.Provider) where b.WorkerID == Properties.Settings.Default.UserId select b).ToList(); /* * Check chiqarish uchun kod */ if (checkPrintCheck.IsChecked == true) { Print(); } /* */ foreach (var t in o) { Sold s = new Sold() { ProductId = t.Partiya.Product.Id, Shtrix = t.Partiya.Product.Shtrix, NameOfProduct = t.Partiya.Product.NameOfProduct, PartiyaId = t.Partiya.Id, BazaPrice = t.Partiya.BazaPrice, SalePrice = t.Partiya.SalePrice, CountProduct = t.CountProduct, ProviderId = t.Partiya.Provider.Id, ProviderName = t.Partiya.Provider.ProviderName, MassaId = t.Partiya.Product.Massa.Id, MassaName = t.Partiya.Product.Massa.Name, TypeId = t.Partiya.Product.Types.Id, TypeName = t.Partiya.Product.Types.TypeName, AllSumma = t.AllPrice, WorkerId = Properties.Settings.Default.UserId, dateTimeNow = DateTime.Now }; context.Solds.Add(s); var y = (from c in context.Partiyas .Include(x => x.Product) where t.Partiya.Id == c.Id select c).FirstOrDefault(); y.CountProduct -= t.CountProduct; context.Kassas.Remove(t); } MainWindow m = new MainWindow(); m.labSkidka.Text = "0"; m.txtSkidkaSumm.Text = "0"; this.Close(); context.SaveChanges(); } } #endregion } }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var builder = new AlertDialog.Builder(Activity); var inflater = Activity.LayoutInflater; var dialogView = inflater.Inflate(Resource.Layout.IncomeDetailsDialogView, null); if (dialogView != null) { editDate = dialogView.FindViewById <EditText>(Resource.Id.editIncomeDateDialog); editAmount = dialogView.FindViewById <EditText>(Resource.Id.editIncomeAmountDialog); editDetails = dialogView.FindViewById <EditText>(Resource.Id.editIncomeDetailsDialog); using (var db = new IncomeManager()) { income = db.GetItem(id); } editDate.Text = income.Date.ToShortDateString(); editAmount.Text = income.Amount.ToString(); editDetails.Text = income.Details; editAmount.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) { double doubleValue; bool isDouble = Double.TryParse (editAmount.Text.ToString().Replace('.', ','), out doubleValue); if (isDouble) { income.Amount = doubleValue; InputMethodManager inputManager = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService); inputManager.HideSoftInputFromWindow(editAmount.WindowToken, HideSoftInputFlags.None); e.Handled = true; } else { Toast.MakeText(this.Activity, string.Format("Nieprawidłowa kwota"), ToastLength.Short).Show(); } } }; editDate.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) { string str = editDate.Text; if (DateTime.TryParse(str, out DateTime dt)) { income.Date = dt; InputMethodManager inputManager = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService); inputManager.HideSoftInputFromWindow(editDate.WindowToken, HideSoftInputFlags.None); e.Handled = true; } else { Toast.MakeText(this.Activity, string.Format("Nieprawidłowa data"), ToastLength.Short).Show(); } } }; editDetails.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) { income.Details = editDetails.Text; InputMethodManager inputManager = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService); inputManager.HideSoftInputFromWindow(editDetails.WindowToken, HideSoftInputFlags.None); e.Handled = true; } }; builder.SetView(dialogView); builder.SetPositiveButton("Zapisz zmiany", HandlePositiveButtonClick); builder.SetNeutralButton("Wróć", HandleNeutralButtonClick); builder.SetNegativeButton("Usuń", HandleNegativeButtonClick); } var dialog = builder.Create(); return(dialog); }
partial void ToModelPostprocessing(IncomeDto dto, ref Income model) { model.Bucket = this.bucketRepo.GetByCode(dto.BudgetBucketCode); }
public void IssueAndCreateIssuanceSheetTest() { var ask = Substitute.For <IInteractiveQuestion>(); ask.Question(string.Empty).ReturnsForAnyArgs(true); var baseParameters = Substitute.For <BaseParameters>(); baseParameters.ColDayAheadOfShedule.Returns(0); using (var uow = UnitOfWorkFactory.CreateWithoutRoot()) { var warehouse = new Warehouse(); uow.Save(warehouse); var sizeType = new SizeType(); var heightType = new SizeType(); uow.Save(sizeType); uow.Save(heightType); var nomenclatureType = new ItemsType { Name = "Тестовый тип номенклатуры", SizeType = sizeType, HeightType = heightType }; uow.Save(nomenclatureType); var nomenclature = new Nomenclature { Type = nomenclatureType }; uow.Save(nomenclature); var protectionTools = new ProtectionTools { Name = "СИЗ для тестирования" }; protectionTools.AddNomeclature(nomenclature); uow.Save(protectionTools); var size = new Size { SizeType = sizeType }; var height = new Size { SizeType = heightType }; uow.Save(size); uow.Save(height); var position1 = new StockPosition(nomenclature, 0, size, height); var norm = new Norm(); var normItem = norm.AddItem(protectionTools); normItem.Amount = 1; normItem.NormPeriod = NormPeriodType.Year; normItem.PeriodCount = 1; uow.Save(norm); var employee = new EmployeeCard(); employee.AddUsedNorm(norm); uow.Save(employee); uow.Commit(); var income = new Income { Warehouse = warehouse, Date = new DateTime(2017, 1, 1), Operation = IncomeOperations.Enter }; var incomeItem1 = income.AddItem(nomenclature); incomeItem1.Amount = 10; income.UpdateOperations(uow, ask); uow.Save(income); var expense = new Expense { Operation = ExpenseOperations.Employee, Warehouse = warehouse, Employee = employee, Date = new DateTime(2018, 10, 22) }; var expenseItem = expense.AddItem(position1, 1); expense.CreateIssuanceSheet(null); //Обновление операций expense.UpdateOperations(uow, baseParameters, ask); expense.UpdateIssuanceSheet(); uow.Save(expense.IssuanceSheet); uow.Save(expense); uow.Commit(); expense.UpdateEmployeeWearItems(); uow.Commit(); Assert.That(expense.IssuanceSheet, Is.Not.Null); var issuanceItem = expense.IssuanceSheet.Items.First(); Assert.That(issuanceItem.ExpenseItem, Is.EqualTo(expenseItem)); } }
public void Equals_Method_Differs() { var first = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Other_Method" } }; var second = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; Assert.AreNotSame(first, second); Assert.IsFalse(first.Equals(second)); Assert.IsFalse(second.Equals(first)); }
public void Create(Income item) { dbContext.Set <Income>().Add(item); dbContext.SaveChanges(); }
internal static void AddTaxTransactions(Millicents GrossForFICA, Millicents GrossForFed, Millicents GrossForState, Millicents GrossForLocal, Income income, Person person) { Tax tax = new Tax(); tax.AddTaxes(GrossForFICA, GrossForFed, GrossForState, GrossForLocal, income, person); }
private void Save_Button_Click(object sender, EventArgs e) { this.Save_Button.Enabled = false; this.Invoke((MethodInvoker) delegate() { using (MuhasebeEntities m_Context = new MuhasebeEntities()) { this.Account = m_Context.Accounts.Where(q => q.ID == this.Account.ID).FirstOrDefault(); DateTime m_BeginsAt = DateTime.MinValue; DateTime m_EndsAt = DateTime.MaxValue; string m_IntervalExp = ""; if (this.Last_Month_Radio.Checked) { m_EndsAt = DateTime.Now; m_BeginsAt = m_EndsAt.Subtract(TimeSpan.FromDays(30)); m_IntervalExp = string.Format("Son 1 Ay: {0} - {1}", m_BeginsAt.ToShortDateString(), m_EndsAt.ToShortDateString()); } else if (this.Last_6Months_Radio.Checked) { m_EndsAt = DateTime.Now; m_BeginsAt = m_EndsAt.Subtract(TimeSpan.FromDays(180)); m_IntervalExp = string.Format("Son 6 Ay: {0} - {1}", m_BeginsAt.ToShortDateString(), m_EndsAt.ToShortDateString()); } else if (this.Last_2Years_Radio.Checked) { m_EndsAt = DateTime.Now; m_BeginsAt = m_EndsAt.Subtract(TimeSpan.FromDays(365 * 2)); m_IntervalExp = string.Format("Son 24 Ay: {0} - {1}", m_BeginsAt.ToShortDateString(), m_EndsAt.ToShortDateString()); } else if (this.Specific_Radio.Checked) { m_EndsAt = EndsAt_Picker.Value; m_BeginsAt = BeginsAt_Picker.Value; m_IntervalExp = string.Format("Belirli Tarih Aralığı: {0} - {1}", m_BeginsAt.ToString(), m_EndsAt.ToString()); } List <AccountMovement> m_List = m_Context.AccountMovements.Where(q => q.AccountID == this.Account.ID && (q.CreatedAt >= m_BeginsAt && q.CreatedAt <= m_EndsAt)).ToList(); m_List = m_List.OrderBy(q => q.CreatedAt).ToList(); string m_Data = ""; string m_SummaryTemplate = "Yukarıdaki işlemler sonucunda firmamız <strong>{0}</strong>"; string m_BaseTemplate = "<tr class=\"movement\">" + "<td class=\"id\">{0}</td>" + "<td class=\"mtype\">{1}</td>" + "<td class=\"date\">{2}</td>" + "<td class=\"author\">{3}</td>" + "<td class=\"payment\">{4}</td>" + "<td class=\"desc\">{5}</td> " + "<td class=\"price\">{6}</td>" + "</tr>"; m_List.All(delegate(AccountMovement movement) { string m_Description = ""; if (movement.MovementTypeID != 3) // ürün tedariğinde yorum yok { if (movement.MovementTypeID == 1 && movement.PaymentTypeID != 3) // Vadeli satış değilse { Income m_Income = m_Context.Incomes.Where(q => q.InvoiceID == movement.ContractID).FirstOrDefault(); if (m_Income != null) { m_Description = m_Income.Description; } } else if (movement.MovementTypeID == 2) // Alacak tahsilatı, gelir { Income m_Income = m_Context.Incomes.Where(q => q.ID == movement.ContractID).FirstOrDefault(); if (m_Income != null) { m_Description = m_Income.Description; } } else if (movement.MovementTypeID == 4) // Borç ödemesi, gider { Expenditure m_Expenditure = m_Context.Expenditures.Where(q => q.ID == movement.ContractID).FirstOrDefault(); if (m_Expenditure != null) { m_Description = m_Expenditure.Description; } } } string m_Formatted = string.Format(m_BaseTemplate, movement.ID, movement.MovementType.Name, movement.CreatedAt.ToString("dd/MM/yyyy"), movement.Author.FullName, movement.PaymentType.Name, m_Description, ItemHelper.GetFormattedPrice(movement.Value)); m_Data += m_Formatted; return(true); }); AccountSummary m_Summary = this.Account.GetSummary(m_Context.AccountMovements.Where(q => q.AccountID == this.Account.ID).ToList()); if (m_Summary.Net < 0) { m_SummaryTemplate = string.Format(m_SummaryTemplate, string.Format("sizden {0} alacaklıdır.", ItemHelper.GetFormattedPrice(Math.Abs(m_Summary.Net)))); } else if (m_Summary.Net > 0) { m_SummaryTemplate = string.Format(m_SummaryTemplate, string.Format("size {0} borçludur.", ItemHelper.GetFormattedPrice(Math.Abs(m_Summary.Net)))); } else { m_SummaryTemplate = "Herhangi bir alacak/borç bulunmamaktadır."; } this.Save_Dialog.FileName = string.Format("{0} - Hesap Özeti.pdf", this.Account.Name); if (this.Save_Dialog.ShowDialog() == DialogResult.OK) { string m_SavePath = this.Save_Dialog.FileName; string html = ""; string m_LocalPath = Application.StartupPath; string m_IndexPath = Path.Combine(m_LocalPath, "View\\AccountSummaryForm\\index.html"); string m_AbsPath = Path.Combine(m_LocalPath, "View\\AccountSummaryForm\\"); using (StreamReader m_Reader = new StreamReader(m_IndexPath, Encoding.UTF8, true)) { html = m_Reader.ReadToEnd(); } html = html.Replace("{PATH}", m_AbsPath); html = html.Replace("{BASEPATH}", m_LocalPath); html = html.Replace("{COMPANY-NAME}", Program.User.WorksAt.Name); html = html.Replace("{TAXID}", Program.User.WorksAt.TaxID); html = html.Replace("{TAXPLACE}", Program.User.WorksAt.TaxDepartment); html = html.Replace("{ADDRESS}", Program.User.WorksAt.Address); html = html.Replace("{DISTRICT}", Program.User.WorksAt.District); html = html.Replace("{PROVINCE}", Program.User.WorksAt.Province); html = html.Replace("{TELEPHONE}", Program.User.WorksAt.Phone); html = html.Replace("{EMAIL}", Program.User.WorksAt.Email); html = html.Replace("{DATA}", m_Data); html = html.Replace("{SUMMARY}", m_SummaryTemplate); html = html.Replace("{ACCOUNT-NAME}", this.Account.Name); html = html.Replace("{ACCOUNT-TAXOFFICE}", this.Account.TaxDepartment); html = html.Replace("{ACCOUNT-TAXID}", this.Account.TaxID); html = html.Replace("{ACCOUNT-ADDRESS}", this.Account.Address); html = html.Replace("{ACCOUNT-CITY}", this.Account.City.Name); html = html.Replace("{ACCOUNT-PROVINCE}", this.Account.Province.Name); html = html.Replace("{ACCOUNT-PHONE}", this.Account.Phone); html = html.Replace("{ACCOUNT-GSM}", this.Account.Gsm); html = html.Replace("{ACCOUNT-EMAIL}", this.Account.Email); html = html.Replace("{SELL-VOLUME}", ItemHelper.GetFormattedPrice(m_Summary.SellVolume)); html = html.Replace("{BUY-VOLUME}", ItemHelper.GetFormattedPrice(m_Summary.BuyVolume)); html = html.Replace("{TOTAL-LOAN}", ItemHelper.GetFormattedPrice(m_Summary.LoanTotal)); html = html.Replace("{TOTAL-DEBT}", ItemHelper.GetFormattedPrice(m_Summary.DebtTotal)); html = html.Replace("{CHARGED}", ItemHelper.GetFormattedPrice(m_Summary.Charged)); html = html.Replace("{PAID}", ItemHelper.GetFormattedPrice(m_Summary.Paid)); html = html.Replace("{NET-LOAN}", ItemHelper.GetFormattedPrice(m_Summary.LoanNet)); html = html.Replace("{NET-DEBT}", ItemHelper.GetFormattedPrice(m_Summary.DebtNet)); html = html.Replace("{TIME-INTERVAL}", m_IntervalExp); try { var pdf = Pdf .From(html) .OfSize(PaperSize.A4) .WithTitle("Title") .WithMargins(0.8.Centimeters()) .WithoutOutline() .Portrait() .Comressed() .Content(); FileStream m_Stream = new FileStream(m_SavePath, FileMode.Create); using (BinaryWriter m_Writer = new BinaryWriter(m_Stream)) { m_Writer.Write(pdf, 0, pdf.Length); } m_Stream.Close(); m_Stream.Dispose(); MessageBox.Show("Pdf dosyası oluşturuldu.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Logger.Enqueue(ex); MessageBox.Show("Oluşan bir hata nedeniyle pdf dosyası yazılamadı. Lütfen tekrar deneyin.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }); this.Save_Button.Enabled = true; this.Close(); }
public IActionResult BookingIncome(Income income) { _Context.Income.Add(income); _Context.SaveChanges(); return(RedirectToAction("BookingIncomeList")); }
public void Add(Income income) { this.dbContext.Incomes.Add(income); this.dbContext.SaveChanges(); }
//添加收入 public bool AddIncome(Income newIncome) { return(incomeService.AddIncome(newIncome)); }
public async Task AddIncome(Income income) { await _incomeRepository.AddAsync(income); }
public bool UpdateIncome(Income income) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateIncome", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@IncomeID", SqlDbType.Int).Value = income.IncomeID; cmd.Parameters.Add("@IncomeName", SqlDbType.NVarChar).Value = income.IncomeName; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
partial void ToDtoPostprocessing(ref IncomeDto dto, Income model) { dto.BudgetBucketCode = model.Bucket.Code; }
private async Task AddSingleIncomeRequest(CreateIncomeCommand request) { var income = new Income(Guid.NewGuid().ToString(), request.Title, request.Amount, request.Date, request.UserId, request.Description, request.AccountId); await _unitOfWork.Incomes.InsertAsync(income); }
/// <summary> /// Update Income and Total Yearly Table's insert or update data /// </summary> /// <param name="income"></param> /// <returns></returns> private int SaveViewClassForDetailsTable(Income income, double incomeAmount, string inMonth, string inYear) { ViewClassForDetails viewClassForDetails = new ViewClassForDetails(); string dobdat = income.IncomeDate; int ddateln = dobdat.Length; string month = dobdat[ddateln - 5].ToString() + dobdat[ddateln - 4].ToString(); string dYear = dobdat[ddateln - 10].ToString() + dobdat[ddateln - 9].ToString() + dobdat[ddateln - 8].ToString() + dobdat[ddateln - 7].ToString(); // string month,string dYear if (month == "01") { viewClassForDetails.Month = "January"; } else if (month == "02") { viewClassForDetails.Month = "February"; } else if (month == "03") { viewClassForDetails.Month = "March"; } else if (month == "04") { viewClassForDetails.Month = "April"; } else if (month == "05") { viewClassForDetails.Month = "May"; } else if (month == "06") { viewClassForDetails.Month = "June"; } else if (month == "07") { viewClassForDetails.Month = "July"; } else if (month == "08") { viewClassForDetails.Month = "August"; } else if (month == "09") { viewClassForDetails.Month = "September"; } else if (month == "10") { viewClassForDetails.Month = "October"; } else if (month == "11") { viewClassForDetails.Month = "November"; } else if (month == "12") { viewClassForDetails.Month = "December"; } viewClassForDetails.Year = dYear; viewClassForDetails.TotalInc = Totalincome(viewClassForDetails.Month, viewClassForDetails.Year, incomeAmount); viewClassForDetails.TotalExp = TotalExpence(viewClassForDetails.Month, viewClassForDetails.Year); viewClassForDetails.Profit = (viewClassForDetails.TotalInc) - (viewClassForDetails.TotalExp); viewClassForDetails.Year = viewClassForDetails.Year; viewClassForDetails.Month = viewClassForDetails.Month; var registration = new ViewClassForDetails { TotalInc = viewClassForDetails.TotalInc, TotalExp = viewClassForDetails.TotalExp, Profit = viewClassForDetails.Profit, Month = viewClassForDetails.Month, Year = viewClassForDetails.Year }; if (inMonth != viewClassForDetails.Month && inYear != viewClassForDetails.Year) { //_context.ViewClassForDetailsTable.Add(registration); int saveDetails = GetUpSave(viewClassForDetails.TotalInc, viewClassForDetails.TotalExp, viewClassForDetails.Profit, viewClassForDetails.Month, viewClassForDetails.Year); if (saveDetails > 0) { return(1); } else { return(0); } } else if (inMonth != viewClassForDetails.Month && inYear == viewClassForDetails.Year) { ////// _context.ViewClassForDetailsTable.Add(registration); ////_context.Add(registration); ////_context.SaveChanges(); int saveDetails = GetUpSave(viewClassForDetails.TotalInc, viewClassForDetails.TotalExp, viewClassForDetails.Profit, viewClassForDetails.Month, viewClassForDetails.Year); if (saveDetails > 0) { return(1); } else { return(0); } } else if (inMonth == viewClassForDetails.Month && inYear != viewClassForDetails.Year) { // _context.ViewClassForDetailsTable.Add(registration); //_context.Add(registration); //_context.SaveChanges(); int saveDetails = GetUpSave(viewClassForDetails.TotalInc, viewClassForDetails.TotalExp, viewClassForDetails.Profit, viewClassForDetails.Month, viewClassForDetails.Year); if (saveDetails > 0) { return(1); } else { return(0); } } else if (inMonth == viewClassForDetails.Month && inYear == viewClassForDetails.Year) { int upDetails = GetUpDate(viewClassForDetails.TotalInc, viewClassForDetails.TotalExp, viewClassForDetails.Profit, viewClassForDetails.Month, viewClassForDetails.Year); if (upDetails > 0) { return(1); } else { return(0); } } if (registration != null) { return(1); } else { return(0); } }
/// <summary> /// End /// </summary> /// <param name="income"></param> /// <returns></returns> //[Authorize(Roles = "JrA")] private int SaveIncomeDataBase(Income income) { string Dobdat = income.IncomeDate; int Ddateln = Dobdat.Length; string Month = Dobdat[Ddateln - 5].ToString() + Dobdat[Ddateln - 4].ToString(); string DYear = Dobdat[Ddateln - 10].ToString() + Dobdat[Ddateln - 9].ToString() + Dobdat[Ddateln - 8].ToString() + Dobdat[Ddateln - 7].ToString(); if (Month == "01") { income.InMonth = "January"; } else if (Month == "02") { income.InMonth = "February"; } else if (Month == "03") { income.InMonth = "March"; } else if (Month == "04") { income.InMonth = "April"; } else if (Month == "05") { income.InMonth = "May"; } else if (Month == "06") { income.InMonth = "June"; } else if (Month == "07") { income.InMonth = "July"; } else if (Month == "08") { income.InMonth = "August"; } else if (Month == "09") { income.InMonth = "September"; } else if (Month == "10") { income.InMonth = "October"; } else if (Month == "11") { income.InMonth = "November"; } else if (Month == "12") { income.InMonth = "December"; } income.InYear = DYear; var registration = new Income { IncomeDate = income.IncomeDate, //UserUId = income.UserUId, IncomeType = income.IncomeType, IncomeAmount = income.IncomeAmount, IncomeChequeNumber = income.IncomeChequeNumber, IncomeBankName = income.IncomeBankName, IncomeParticular = income.IncomeParticular, InMonth = income.InMonth, InYear = income.InYear, IncomeApprove = income.IncomeApprove }; if (registration != null) { _context.IncomeTable.Add(registration); return(1); } else { return(0); } }
public IncomeDto selectIncomeById(String IncomeId) { IncomeManager mgr = new IncomeManager(); Income obj = new Income(); obj.IncomeId = IncomeId; obj = mgr.selectIncomeById(obj); if (obj != null) { return IncomeDto.createIncomeDTO(obj); } else { return null; } }
// Income Numbers public Income GetIncome() { var income = new Income(); return TileList.Aggregate(income, (current, tile) => current + tile.GetIncome()); }