public void UpdateImportDetail(ImportDetail importDetail) { dbSet.Attach(importDetail); _appDbContext.Entry(importDetail).State = EntityState.Modified; _appDbContext.SaveChanges(); }
public List <ImportDetail> GetCompletedImportDetailList(DataTypes dataType) { List <ImportDetail> ret = new List <ImportDetail>(); try { SqlConnection dbCon = new SqlConnection(ConnectionString); dbCon.Open(); string sql = "SELECT FILETYPE, LOCALFILE, LASTRECORDNUM, ID, URL FROM IMPORTDETAIL WHERE ISCOMPLETE = TRUE AND FILETYPE = '" + dataType.ToString("g") + "'"; SqlCommand dbCmd = new SqlCommand(sql, dbCon); var r = dbCmd.ExecuteReader(); while (r.Read()) { ImportDetail id = new ImportDetail(); id.FileType = r.GetValue(0).ToString(); id.LocalFile = r.GetValue(1).ToString(); id.LastRecordNum = Convert.ToInt32(r.GetValue(2)); id.ID = Convert.ToInt32(r.GetValue(3)); id.URL = r.GetValue(4).ToString(); ret.Add(id); } dbCon.Close(); } catch { ret = null; } return(ret); }
public ImportDetail GetImportDetail(string url) { ImportDetail ret = null; try { SqlConnection dbCon = new SqlConnection(ConnectionString); dbCon.Open(); SqlCommand dbCmd = new SqlCommand("SELECT FILETYPE, LOCALFILE, LASTRECORDNUM, ID, ISCOMPLETE FROM IMPORTDETAIL WHERE URL = '" + url + "'", dbCon); var r = dbCmd.ExecuteReader(); while (r.Read()) { ret = new ImportDetail(); ret.URL = url; ret.FileType = r.GetValue(0).ToString(); ret.LocalFile = r.GetValue(1).ToString(); ret.LastRecordNum = Convert.ToInt32(r.GetValue(2)); ret.ID = Convert.ToInt32(r.GetValue(3)); ret.IsComplete = Convert.ToBoolean(r.GetValue(4)); break; } dbCon.Close(); } catch { ret = null; } return(ret); }
public ActionResult addProduct(int id, int amount, int unitPrice, int discount) { List <_1bite.Models.ImportDetail> idl = new List <ImportDetail>(); if (System.Web.HttpContext.Current.Session["nhaphangg"] != null) { idl = (List <ImportDetail>)System.Web.HttpContext.Current.Session["nhaphangg"]; } ImportDetail importDetail; if (idl.ToList().Any(m => m.productId == id)) { importDetail = idl.Find(m => m.productId == id); importDetail.amount += amount; importDetail.discounted = discount; importDetail.paid = (importDetail.amount * importDetail.unitPrice) - discount; } else { importDetail = new ImportDetail { productId = id, productName = AccountDAO.GetProductNameWithID(id), amount = amount, discounted = discount, unitPrice = unitPrice, paid = (amount * unitPrice) - discount }; idl.Add(importDetail); } System.Web.HttpContext.Current.Session["nhaphangg"] = idl; mymodel.importDetail = idl; return(PartialView(mymodel)); }
public HttpResponseMessage CreateDetail(HttpRequestMessage request, string importDetailViewModels) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } else { if (importDetailViewModels != null) { var newImportDetail = new ImportDetail(); var listImportDetailViewModels = new JavaScriptSerializer().Deserialize <List <ImportDetailViewModel> >(importDetailViewModels); foreach (var importDetailViewModel in listImportDetailViewModels) { newImportDetail.UpdateImportDetail(importDetailViewModel); _importDetailService.Add(newImportDetail); _importDetailService.Save(); } } //var responseData = Mapper.Map<Import, ImportViewModel>(newImport); response = request.CreateResponse(HttpStatusCode.Created); } return response; })); }
/// <summary> /// 清除引用 /// </summary> /// <param name="model"></param> public static void ClearReferences(this ImportDetail model) { model.tb_admin = null; model.tb_device = null; model.tb_import = null; model.tb_product = null; }
public static void UpdateImportDetail(this ImportDetail importDetail, ImportDetailViewModel importDetailViewModel) { importDetail.ImportID = importDetailViewModel.ImportID; importDetail.ProductID = importDetailViewModel.ProductID; importDetail.WarehouseId = importDetailViewModel.WarehouseId; importDetail.Quantity = importDetailViewModel.Quantity; importDetail.Price = importDetailViewModel.Price; }
public async Task <IActionResult> Add([FromBody] CreateImport model) { var details = model.Details; // Validate for (int i = 0; i < details.Count; i++) { var id = details[i].StockId; var stock = await _stockRepository.FirstOrDefault(c => c.Id == id); if (stock == null) { return(Ok(ResponseDTO.BadRequest($"Not found stockId: {id}"))); } else { stock.Instock += details[i].Quantity; await _stockRepository.Update(stock); } } float totalCost = 0; int totalQuantity = 0; foreach (var detail in details) { totalCost += detail.Quantity * detail.OriginalPrice; totalQuantity += detail.Quantity; } var importDetails = new List <ImportDetail>(); foreach (var detail in details) { var importDetail = new ImportDetail { Quantity = detail.Quantity, OriginalPrice = detail.OriginalPrice, StockId = detail.StockId, }; importDetails.Add(importDetail); } var import = new Import { ImportDate = DateTime.Now, TotalQuantity = totalQuantity, TotalCost = totalCost, ProviderId = model.ProviderId, ImportDetails = importDetails }; return(await this._AddItem(import)); }
public int Update(ImportDetail model) { SqlParameter[] sqlParameters = new SqlParameter[] { new SqlParameter("ImportId", model.ImportId), new SqlParameter("BookId", model.BookId), new SqlParameter("Quantity", model.Quantity), new SqlParameter("Price", model.Price) }; return(db.Database.SqlQuery <int>("uspUpdateImportDetail @ImportId, @BookId, @Quantity, @Price", sqlParameters).SingleOrDefault()); }
public async Task <IActionResult> Create(ImportDetail importDetail) { ViewBag.Imports = _importRepository.GetAll(); ViewBag.Categories = _categoryRepository.GetAll(); if (ModelState.IsValid) { await _importDetailRepository.CreateImportDetail(importDetail); return(RedirectToAction("Index")); } return(View(importDetail)); }
public static void UpdateImportDetail(this ImportDetail importDetail, ImportDetailModel importDetailModel) { importDetail.ProductId = importDetailModel.ProductId; importDetail.ImportId = importDetailModel.ImportId; importDetail.ProductName = importDetailModel.ProductName; importDetail.Quantity = importDetailModel.Quantity; importDetail.Price = importDetailModel.Price; importDetail.Total = importDetailModel.Total; importDetail.Total = importDetailModel.Total; importDetail.WareHouseId = importDetailModel.WareHouseId; importDetail.ColorCode = importDetailModel.ColorCode; importDetail.SizeCode = importDetailModel.SizeCode; importDetail.ColorId = importDetailModel.ColorId; importDetail.SizeId = importDetailModel.SizeId; importDetail.ComponentCode = importDetailModel.ComponentCode; }
public JsonResult Insert(ImportDetail model) { try { long status = dao.Insert(model); return(Json(new { status = status })); } catch (Exception) { return(Json(new { status = 0 })); } }
public JsonResult Update(ImportDetail model) { try { int status = dao.Update(model); return(Json(new { status = status })); } catch (Exception) { return(Json(new { status = 0 })); } }
public JsonResult Get(long importId, string book) { try { ImportDetail data = dao.Get(importId, book); return(Json(new { data = data }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { data = DBNull.Value.ToString() }, JsonRequestBehavior.AllowGet)); } }
public HttpResponseMessage Create(HttpRequestMessage request, ImportViewModel importViewModel) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } else { var newImportModel = new Import(); var newImportDetailModel = new ImportDetail(); var identity = (ClaimsIdentity)User.Identity; IEnumerable <Claim> claims = identity.Claims; newImportModel.UpdateImport(importViewModel); _importService.Add(newImportModel); _importService.Save(); foreach (var item in importViewModel.ImportDetails) { newImportDetailModel.UpdateImportDetail(item); _importDetailService.Add(newImportDetailModel); _importDetailService.Save(); } Log log = new Log() { AppUserId = claims.FirstOrDefault().Value, Content = Notification.CREATE_IMPORT, Created = DateTime.Now }; _logService.Create(log); _logService.Save(); var responseData = Mapper.Map <Import, ImportViewModel>(newImportModel); response = request.CreateResponse(HttpStatusCode.OK, responseData); } return response; })); }
public IActionResult Edit(ImportDetail importDetail) { ViewBag.Imports = _importRepository.GetAll(); ViewBag.Categories = _categoryRepository.GetAll(); //if(importDetail.CategoryId == 0) //{ // importDetail.CategoryId = int.Parse(null); //} //if (importDetail.ImportId == 0) //{ // importDetail.ImportId = int.Parse(null); //} if (ModelState.IsValid) { _importDetailRepository.UpdateImportDetail(importDetail); return(RedirectToAction("Index")); } return(View(importDetail)); }
/// <summary> /// 计算 /// </summary> /// <param name="details"></param> /// <param name="import"></param> /// <param name="IgnoreError"></param> /// <param name="OnlyTotal"></param> private void Calc(out List <ImportDetail> details, out Import import, bool IgnoreError = true, bool OnlyTotal = false) { bool IsError = false; details = new List <ImportDetail>(); import = new Import(); if (!OnlyTotal) { for (int i = krpdgList.Rows.Count - 1; i >= 0; i--) { ImportDetail importDetails = new ImportDetail(); //只有有改动才可以继续 if (krpdgList.Rows[i].Cells["krpcmEdit"].Value.Equals("*")) { try { string productName = krpdgList.Rows[i].Cells["krpcmProductName"].Value.ToString(); Product product = null; if (Resources.GetRes().MainLangIndex == 0) { product = Resources.GetRes().Products.Where(x => x.ProductName0 == productName && (x.HideType == 0 || x.HideType == 3)).FirstOrDefault(); } else if (Resources.GetRes().MainLangIndex == 1) { product = Resources.GetRes().Products.Where(x => x.ProductName1 == productName && (x.HideType == 0 || x.HideType == 3)).FirstOrDefault(); } else if (Resources.GetRes().MainLangIndex == 2) { product = Resources.GetRes().Products.Where(x => x.ProductName2 == productName && (x.HideType == 0 || x.HideType == 3)).FirstOrDefault(); } importDetails.ProductId = product.ProductId; importDetails.Count = Math.Round(double.Parse(krpdgList.Rows[i].Cells["krpcmCount"].Value.ToString()), 3); krpdgList.Rows[i].Cells["krpcmCostPrice"].Value = importDetails.Price = Math.Round(double.Parse(krpdgList.Rows[i].Cells["krpcmCostPrice"].Value.ToString()), 2); krpdgList.Rows[i].Cells["krpcmTotalPrice"].Value = importDetails.TotalPrice = Math.Round(importDetails.Price * importDetails.Count, 2); importDetails.OriginalTotalPrice = Math.Round(product.CostPrice * importDetails.Count, 2); krpdgList.Rows[i].Cells["krpcmPrice"].Value = importDetails.SalePrice = Math.Round(double.Parse(krpdgList.Rows[i].Cells["krpcmPrice"].Value.ToString()), 2); importDetails.OriginalSalePrice = product.Price; details.Add(importDetails); } catch #if DEBUG (Exception ex) #endif { krpdgList.Rows[i].Cells["krpcmCostPrice"].Value = "?"; krpdgList.Rows[i].Cells["krpcmTotalPrice"].Value = "?"; krpdgList.Rows[i].Cells["krpcmPrice"].Value = "?"; // 产品名空时这种错误很常见, 所以暂时去掉 #if DEBUG ExceptionPro.ExpLog(ex, null, true); #endif IsError = true; if (!IgnoreError) { krpdgList.Rows[i].Selected = true; throw new OybabException(string.Format(Resources.GetRes().GetString("LineDataError"), i + 1)); } else { break; } } } } if (IsError) { return; } } if (IsError) { return; } if (!OnlyTotal) { krplTotalPriceValue.Text = (import.TotalPrice = Math.Round(details.Sum(x => x.TotalPrice), 2)).ToString(); import.OriginalTotalPrice = Math.Round(details.Sum(x => x.OriginalTotalPrice), 2); } else { return; } // 显示客显(实际客户需要支付的赊账) Common.GetCommon().OpenPriceMonitor(Math.Round(import.TotalPaidPrice - import.TotalPrice, 2).ToString()); import.Remark = GetValueOrNull(krptbRemark.Text); DateTime importDateTime = DateTime.Now; try { importDateTime = krptbImportTime.Value; import.ImportTime = long.Parse(importDateTime.ToString("yyyyMMddHHmmss")); } catch (Exception ex) { ExceptionPro.ExpLog(ex); IsError = true; if (!IgnoreError) { krptbImportTime.Focus(); throw new OybabException(string.Format(Resources.GetRes().GetString("PropertyError"), Resources.GetRes().GetString("Time"))); } } if (IsError) { return; } ShowOrHideSave(); }
public void Update(ImportDetail importDetail) { _importDetailRepository.Update(importDetail); }
public ImportDetail Add(ImportDetail importDetail) { return(_importDetailRepository.Add(importDetail)); }
private static DetailedReturn ImportTigerData(ISQL toDatabase, DataTypes dataType, string fileToImport, int recordsPerBatch, string referenceURL, string referenceZipFile) { DetailedReturn ret = new DetailedReturn(); // CREATE the IMPORTDETAIL table in the Database if it doesnt already exist toDatabase.CreateImportDetailTable(); // Make sure the file exists that we wish to import... if (File.Exists(fileToImport)) { // Read the dbfFile contents into a DbfTable object using (var dbfTable = new DbfTable(fileToImport, Encoding.UTF8)) { var header = dbfTable.Header; var versionDescription = header.VersionDescription; var hasMemo = dbfTable.Memo != null; var recordCount = header.RecordCount; int rowsAffected = 0; ret.TotalRecordsInFile = recordCount; // Get the IMPORTDETAIL record that matches the URL/File we are going to import ImportDetail importDetail = toDatabase.GetImportDetail(referenceURL); if (importDetail == null) { // If no matching IMPORTDETAIL file was found, create one toDatabase.InsertImportDetails(referenceURL, referenceZipFile, dataType); importDetail = toDatabase.GetImportDetail(referenceURL); //new ImportDetail { URL = referenceURL, LocalFile = referenceZipFile, FileType = dataType.ToString("g"), LastRecordNum = 0 }; } ret.TotalRecordsAlreadyInDB = importDetail.LastRecordNum; // Proceed only if the record count in the file exceeds that which we have already imported if (recordCount > importDetail.LastRecordNum) { // The DataTypes enum name is going to be our TABLE name string tableName = dataType.ToString("g"); // Generate a CREATE TABLE script representing the DbfTable string tableCreate = toDatabase.GetCreateTableScript(dbfTable, tableName); Debug.WriteLine(tableCreate); // CREATE IF NOT EXISTS our TABLE in the DB toDatabase.ExecuteNonQuery(tableCreate); // Create the first part of our INSERT statement string insertHeader = toDatabase.GetInsertHeader(dbfTable, tableName); // Get the records from the DbfTable var dbfRecord = new DbfRecord(dbfTable); // We are going to INSERT multiple records with each DB Command to dramatically speed things up StringBuilder multiInsert = new StringBuilder(); multiInsert.Append(insertHeader); // Loop through each of our records... while (dbfTable.Read(dbfRecord)) { try { // We only want to start INSERTing records where we last left off if (ret.TotalRecordsImported >= importDetail.LastRecordNum) { // Skip the record if it is marked as deleted if (dbfRecord.IsDeleted) { continue; } int col = -1; StringBuilder rowPart = new StringBuilder(); // Loop through each of the values in our record foreach (var dbfValue in dbfRecord.Values) { col++; // Get the column type of this value DbfColumn c = dbfTable.Columns[col]; // Format the value properly for our INSERT statment rowPart.Append(toDatabase.FormatValueForInsert(c.ColumnType, dbfValue.ToString()) + ","); } // Add the Import Detail ID for our last column value rowPart.Append(importDetail.ID); // Append the record values to our INSERT statement multiInsert.Append("(" + rowPart.ToString() + "),"); // If we have collected xxx records... if (ret.TotalRecordsImported % recordsPerBatch == 0) { // Its time to execute the INSERT rowsAffected = toDatabase.ExecuteNonQuery(multiInsert.ToString().TrimEnd(',')); // If the INSERT was successful if (rowsAffected > 0) { // UPDATE the IMPORTDETAILS table toDatabase.UpdateImportDetails(referenceURL, ret.TotalRecordsImported, ret.TotalRecordsImported == recordCount); } // Prepare the next mass INSERT statement multiInsert.Clear(); multiInsert.Append(insertHeader); } } // Update the record count ret.TotalRecordsImported++; } catch (Exception ex) { //Debug.WriteLine(ex.Message); ret.Errors.Add(new ErrorDetail(ErrorTypes.Exception, dataType, ex.Message, referenceURL, fileToImport)); } } ret.TotalRecordsImported -= importDetail.LastRecordNum; // If we have a remaining INSERT compiled.... if (multiInsert.ToString() != "" && multiInsert.ToString() != insertHeader) { // execute the INSERT rowsAffected = toDatabase.ExecuteNonQuery(multiInsert.ToString().TrimEnd(',')); // If the INSERT was successful if (rowsAffected > 0) { // UPDATE the IMPORTDETAILS table toDatabase.UpdateImportDetails(referenceURL, ret.TotalRecordsImported, ret.TotalRecordsImported == recordCount); } } } else // If we already appeared to have imported all the records in this file { toDatabase.UpdateImportDetails(referenceURL, recordCount, true); } } } else // If the file does not exist { ret.Errors.Add(new ErrorDetail(ErrorTypes.BadOrMissingLocalFile, dataType, "File not found", referenceURL, fileToImport)); } return(ret); }
//public async Task CreateImportDetail(ImportDetail importDetail) //{ // dbSet.Add(importDetail); // await _appDbContext.SaveChangesAsync(); //} public async Task CreateImportDetail(ImportDetail importDetail) { dbSet.Add(importDetail); await _appDbContext.SaveChangesAsync(); }
public async Task DeleteImportDetail(ImportDetail importDetail) { dbSet.Remove(importDetail); await _appDbContext.SaveChangesAsync(); }
/// <summary> /// 计算 /// </summary> /// <param name="details"></param> /// <param name="import"></param> /// <param name="IgnoreError"></param> /// <param name="OnlyTotal"></param> /// <param name="IgnoreNotConfirm"></param> /// <param name="IgnoreCanceld"></param> /// <param name="IgnoreCancelId"></param> private void Calc(out List <ImportDetail> details, out Import import, bool IgnoreError = true, bool OnlyTotal = false, bool IgnoreNotConfirm = true, bool IgnoreCanceld = true, long IgnoreCancelId = -999) { details = new List <ImportDetail>(); List <ImportDetail> detailsAll = new List <ImportDetail>(); import = new Import(); if (!OnlyTotal) { foreach (var item in Selected.CurrentSelectedList) { ImportDetail importDetails = new ImportDetail(); importDetails.ProductId = item.Product.ProductId; importDetails.Count = item.OrderDetail.Count; if (item.NewPrice.HasValue) { importDetails.Price = item.NewPrice.Value; } else { importDetails.Price = item.OrderDetail.Price; } importDetails.TotalPrice = item.TotalPrice; importDetails.OriginalTotalPrice = Math.Round(item.OrderDetail.Price * item.OrderDetail.Count); importDetails.ImportDetailId = item.OrderDetail.OrderDetailId; importDetails.State = item.OrderDetail.State; if (item.IsNew) { details.Add(importDetails); } detailsAll.Add(importDetails); } } IEnumerable <ImportDetail> totalDetails = detailsAll; if (IgnoreNotConfirm) { totalDetails = totalDetails.Where(x => x.State != 1); } if (IgnoreCanceld) { totalDetails = totalDetails.Where(x => x.State != 3); } lastTotal = Math.Round(totalDetails.Sum(x => x.TotalPrice), 2); lastOriginalTotalPrice = Math.Round(totalDetails.Sum(x => x.OriginalTotalPrice), 2); if (IgnoreCancelId != -999 && totalDetails.Where(x => x.ImportDetailId == IgnoreCancelId).Count() > 0) { lastTotal = Math.Round(lastTotal - totalDetails.Where(x => x.ImportDetailId == IgnoreCancelId).FirstOrDefault().TotalPrice, 2); lastOriginalTotalPrice = Math.Round(lastOriginalTotalPrice - totalDetails.Where(x => x.ImportDetailId == IgnoreCancelId).FirstOrDefault().OriginalTotalPrice, 2); } import.TotalPaidPrice = Math.Round(import.SupplierPaidPrice + import.PaidPrice, 2); import.ImportTime = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss")); Selected.TotalPrice = import.TotalPrice = lastTotal; import.OriginalTotalPrice = lastOriginalTotalPrice; double balancePrice = 0; balancePrice = Math.Round(import.TotalPaidPrice - import.TotalPrice, 2); if (balancePrice > 0) { import.KeepPrice = balancePrice; import.BorrowPrice = 0; } else if (balancePrice < 0) { import.BorrowPrice = balancePrice; import.KeepPrice = 0; } else if (balancePrice == 0) { import.BorrowPrice = 0; import.KeepPrice = 0; } // 显示客显(实际客户需要支付的赊账) Common.GetCommon().OpenPriceMonitor(import.BorrowPrice.ToString()); // 刷新第二屏幕 if (FullScreenMonitor.Instance._isInitialized) { //FullScreenMonitor.Instance.RefreshSecondMonitorList(new Res.View.Models.BillModel(import, details, null)); } if (OnlyTotal) { return; } }
/// <summary> /// 计算 /// </summary> /// <param name="details"></param> /// <param name="import"></param> /// <param name="IgnoreError"></param> /// <param name="OnlyTotal"></param> private void Calc(out List <ImportDetail> details, out Import import, bool IgnoreError = true, bool OnlyTotal = false, bool IgnoreNotConfirm = true, bool IgnoreCanceld = true, long IgnoreCancelId = -999) { details = new List <ImportDetail>(); List <ImportDetail> detailsAll = new List <ImportDetail>(); import = new Import(); if (!OnlyTotal) { foreach (var item in Selected.CurrentSelectedList) { ImportDetail orderDetails = new ImportDetail(); orderDetails.ProductId = item.Product.ProductId; orderDetails.Count = item.OrderDetail.Count; if (item.NewPrice.HasValue) { orderDetails.Price = item.NewPrice.Value; } else { orderDetails.Price = item.OrderDetail.Price; } orderDetails.TotalPrice = item.TotalPrice; orderDetails.OriginalTotalPrice = Math.Round(item.OrderDetail.Price * item.OrderDetail.Count); orderDetails.ImportDetailId = item.OrderDetail.OrderDetailId; orderDetails.State = item.OrderDetail.State; if (item.IsNew) { details.Add(orderDetails); } detailsAll.Add(orderDetails); } } //if (!OnlyTotal) //{ IEnumerable <ImportDetail> totalDetails = detailsAll; if (IgnoreNotConfirm) { totalDetails = totalDetails.Where(x => x.State != 1); } if (IgnoreCanceld) { totalDetails = totalDetails.Where(x => x.State != 3); } lastTotal = Math.Round(totalDetails.Sum(x => x.TotalPrice), 2); lastOriginalTotalPrice = Math.Round(totalDetails.Sum(x => x.OriginalTotalPrice), 2); if (IgnoreCancelId != -999 && totalDetails.Where(x => x.ImportDetailId == IgnoreCancelId).Count() > 0) { lastTotal = Math.Round(lastTotal - totalDetails.Where(x => x.ImportDetailId == IgnoreCancelId).FirstOrDefault().TotalPrice, 2); lastOriginalTotalPrice = Math.Round(lastOriginalTotalPrice - totalDetails.Where(x => x.ImportDetailId == IgnoreCancelId).FirstOrDefault().OriginalTotalPrice, 2); } //} import.TotalPaidPrice = Math.Round(import.SupplierPaidPrice + import.PaidPrice, 2); import.ImportTime = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss")); Selected.TotalPrice = import.TotalPrice = lastTotal; import.OriginalTotalPrice = lastOriginalTotalPrice; double balancePrice = 0; balancePrice = Math.Round(import.TotalPaidPrice - import.TotalPrice, 2); if (balancePrice > 0) { import.KeepPrice = balancePrice; import.BorrowPrice = 0; } else if (balancePrice < 0) { import.BorrowPrice = balancePrice; import.KeepPrice = 0; } else if (balancePrice == 0) { import.BorrowPrice = 0; import.KeepPrice = 0; } if (OnlyTotal) { return; } }