public void UpdateBill(IBill bill) { IBill savedBill = GetBill(bill.RecordId); savedBill.DateOwed = bill.DateOwed; savedBill.MonthlyPayment = bill.MonthlyPayment; }
public void TestBlueSky_CopyFrom() { //set-up IBill bill1 = CreateBill(); IBill bill2 = CreateBill(); IAccount account = new Account(); account.CompanyName = CompanyName; account.AccountBalance = AccountBalance; account.InterestRate = InterestRate; account.RecordId = RecordIdIs0; account.AddBill(bill1); account.AddBill(bill2); //pre-conditions Assert.IsNull(Model.Bills); Assert.AreNotEqual(Model.AccountBalance, account.AccountBalance); Assert.AreNotEqual(Model.CompanyName, account.CompanyName); Assert.AreNotEqual(Model.InterestRate, account.InterestRate); //exercise Model.CopyFrom(account); //post-conditions Assert.AreEqual(Model.Bills.Length, account.GetBills().Length); Assert.AreEqual(Model.AccountBalance, account.AccountBalance); Assert.AreEqual(Model.CompanyName, account.CompanyName); Assert.AreEqual(Model.InterestRate, account.InterestRate); }
public void ExecuteCreationTest() { Bank bank = Bank.Init(); IBill oneHundred = bank.ExecuteCreation(Bills.OneHundred); Assert.AreEqual(100, oneHundred.GetAmount()); }
public decimal CalculateNetPayableAmount(IBill bill) { var percentageDiscount = PercentageDiscountCalculator.ApplyDiscount(bill.Order); var fixedDiscount = FixedDiscountCalculator.ApplyDiscount(bill.BillAmount - percentageDiscount); return(bill.BillAmount - percentageDiscount - fixedDiscount); }
public BillDetailController(IBillDetail billDetail, IBill bill, IProduct product, ICustomer customer) { _billDetail = billDetail; _bill = bill; _product = product; _customer = customer; }
public void Add(IBill bill) { if (!historicalBills.Contains(bill) && bill != null) { historicalBills.Add(bill); } }
private BillModel GetBill(IBill bill) { BillModel model = new BillModel(); model.CopyFrom(bill); return(model); }
public static IBill GetReversedBill(IBill bill) { //string revStr; //int index = Array.IndexOf(AllBills, bill); //// even = rise, odd = reduce //if ((index & 1) == 1) { // revStr = AllBillsNameStr[index - 1]; //} else { // revStr = AllBillsNameStr[index + 1]; //} //var ms = typeof(Bills).GetField(revStr, System.Reflection.BindingFlags.Static); //return ms.GetValue(null) as IBill; IBill revBill; int index = Array.IndexOf(AllBills, bill); // even = rise, odd = reduce if ((index & 1) == 1) { revBill = AllBills[index - 1]; } else { revBill = AllBills[index + 1]; } return(revBill); }
public CheckoutController(IProduct product, ITypeProduct typeProduct, ICustomer customer, IBill bill, IBillDetail billDetail) { _Product = product; _TypeProduct = typeProduct; _Customer = customer; _Bill = bill; _BillDetail = billDetail; }
public IBill DbBillToIBill(DbAccess.Entities.Bill entity) { IBill bill = _factory.BillFactory.NewBill(entity.BillId, entity.RecipientId, entity.BillTypeDictId, entity.Description, entity.DueAmount, entity.DueDate, entity.Periodical, entity.Period, entity.Paid); bill.Recipient = _factory.RecipientFactory.NewRecipient(entity.Recipient.RecipientId, entity.Recipient.CompanyName, entity.Recipient.Address, entity.Recipient.Account, entity.Recipient.CustomerServiceUrl, entity.Recipient.Active); bill.BillType = _factory.BillFactory.NewBillType(entity.BillTypeDict.BillTypeDictId, entity.BillTypeDict.Name); return(bill); }
public void CopyFrom(IBill bill) { ConfirmationNumber = bill.ConfirmationNumber; DateOwed = bill.DateOwed; MonthlyPayment = bill.MonthlyPayment; Paid = bill.Paid; RecordId = bill.RecordId; }
public void CopyProperties(IBill other) { Date = other.Date; Id = other.Id; Description = other.Description; Friends = other.Friends; Title = other.Title; Currency = other.Currency; }
public VoteResult GetBillAttitude(IBill bill) { if (this.BillAttitudes.ContainsKey(bill)) { return(this.BillAttitudes[bill]); } // dont wanna Party know VoteResult... return(null); }
public void CopyProperties(IBill other) { //other.CheckArgument(nameof(other)); Id = other.Id; Date = other.Date; Title = other.Title; Description = other.Description; Currency = other.Currency; Friends = other.Friends; }
public void UpdateBill(IBill bill) { // guard clause - invalid input if (bill == null) { return; } Update(bill); }
public void CopyProperties(IBill other) { base.CopyProperties(other); Date = other.Date; Title = other.Title; Description = other.Description; Currency = other.Currency; Friends = other.Friends; }
public void AddBill(IBill bill) { // guard clause - invalid input if (bill == null) { return; } Save(bill); }
public void AddBill(IBill bill, IAccount account) { if (bill == null) { return; } account.AddBill(bill); Save(bill); }
public void EditBill(BillModel model) { IBill bill = Service.GetBill(model.RecordId); bill.ConfirmationNumber = model.ConfirmationNumber; bill.DateOwed = model.DateOwed; bill.MonthlyPayment = model.MonthlyPayment; bill.Paid = model.Paid; Service.UpdateBill(bill); }
public void DeleteBillStateHistory(IBill bill, long bhid) { ExceptionHelper.ThrowIfNull(bill, "bill"); ExceptionHelper.ThrowIfNotId(bhid, "bhid"); _BillStateHistoryRepository.Update(h => h.bid == bill.Bid && h.bhid == bhid, h => new Data.BillStateHistory { enabled = false }); }
public EditModel(BillAuthority authority, IBill service) : this() { Bill = new BillEditModel(service); IsAllowUpdateState = authority.AllowUpdateState; IsReadOnly = !authority.AllowUpdateMinorInfo; IsSenderAndReceiverReadOnly = !authority.AllowUpdateSenderOrReceiver; IsAllowSetAgent = authority.AllowSetAgent; IsAllowSetCreateDate = authority.AllowSetCreateDate; }
public IBill GetBill(int recordId) { // guard clause - not found IBill billTobuild = Get <IBill>(recordId); if (billTobuild == null) { return(null); } return(billTobuild); }
public CreateBillVM(IBill bill) { this.BillId = bill.BillId; this.BillTypeId = bill.BillTypeId; this.RecipientId = bill.RecipientId; this.Description = bill.Description; this.DueAmount = bill.DueAmount; this.DueDate = bill.DueDate; this.Periodical = bill.Periodical; this.Period = bill.Period; this.Paid = bill.Paid; }
public void DeleteBill(int recordId) { // guard clause - not found IBill foundBill = Get <IBill>(recordId); if (foundBill == null) { return; } Delete(foundBill); }
public void Calculate(Cart cart) { _productList = cart.GetItemsFromCart(); foreach (Product p in _productList) { _bill = GetBill(_country); decimal productTax = _bill.CalculateTax(p.Price, p.GetTaxValue(_country)); decimal taxedCost = _bill.CalcTotalProductCost(p.Price, productTax); p.TaxedCost = taxedCost; } }
public static IBill GetAnotherBill(IBill bill) { for (; bill.IsImplementable() == false; bill = GetRandomBill()) { ; } return(bill); #region old codes //System.Random rand = new System.Random(); //// 8 is a id of non-exist bill //int avoidIdx0 = 8; //int avoidIdx1 = 8; //int avoidIdx2 = 8; //int avoidIdx3 = 8; //if (Politics.residentTax >= 20) { // avoidIdx0 = 0; //} else if (Politics.residentTax <= 1) { // avoidIdx0 = 1; //} //if (Politics.commercialTax >= 20) { // avoidIdx2 = 4; //} else if (Politics.commercialTax <= 1) { // avoidIdx2 = 5; //} //if (Politics.industryTax >= 20) { // avoidIdx3 = 6; //} else if (Politics.industryTax <= 1) { // avoidIdx3 = 7; //} //if (Politics.benefitOffset >= 100) { // avoidIdx1 = 2; //} else if (Politics.benefitOffset <= 0) { // avoidIdx1 = 3; //} //if ((orgIdx == avoidIdx0) || (orgIdx == avoidIdx1) || (orgIdx == avoidIdx2) || (orgIdx == avoidIdx3)) { // while (true) { // byte returnValue = (byte)rand.Next(8); // if (!((returnValue == avoidIdx0) || (returnValue == avoidIdx1) || (returnValue == avoidIdx2) || (returnValue == avoidIdx3))) { // return returnValue; // } // } //} else { // return orgIdx; //} #endregion }
public ActionResult Create([Bind(Include = "BillId,DueAmount,DueDate,Period,Description,BillTypeId,RecipientId")] CreateBillVM bill) { if (ModelState.IsValid) { IBill item = _billFactory.NewBill(bill.BillId, bill.RecipientId, bill.BillTypeId, bill.Description, bill.DueAmount, bill.DueDate, bill.Periodical, bill.Period, false); _billService.CreateBill(item); TempData["ResultMessage"] = "Utworzono rachunek"; var recipient = _recipientService.GetRecepient(bill.RecipientId); log.Info("Utworzono rachunek " + "Id:" + bill.RecipientId + ", Odbiorca: " + recipient.CompanyName + ", Kwota: " + bill.DueAmount); return(RedirectToAction("Index")); } return(View(bill)); }
public void UpdateBill(IBill bill) { DbAccess.Entities.Bill dbbill = this.repo.GetById(bill.BillId); dbbill.Description = bill.Description; dbbill.DueAmount = bill.DueAmount; dbbill.DueDate = bill.DueDate; dbbill.Periodical = bill.Periodical; dbbill.BillTypeDictId = bill.BillTypeId; dbbill.RecipientId = bill.RecipientId; dbbill.Paid = bill.Paid; repo.Update(dbbill); repo.Save(); }
public void TestBlueSky_Get() { // set-up IBill bill = CreateBill(); Service.AddBill(bill); // exercise IBill persistedBill = Service.GetBill(bill.RecordId); // post-conditions Assert.AreEqual(persistedBill, bill); }
public void TestNonBlueSky_AddInvalidBill() { // set-up IBill bill = null; // pre-conditions Assert.AreEqual(0, Service.GetBills().Length); // exercise Service.AddBill(bill); // post-conditions Assert.AreEqual(0, Service.GetBills().Length); }
public IActionResult ProducerBill(string billId) { IBill bill = _context.ProducerBills.Include(x => x.AdherentStolon).ThenInclude(x => x.Adherent).AsNoTracking().First(x => x.BillId.ToString() == billId); bill.BillEntries = _context.BillEntrys.Include(x => x.ProductStock).Where(x => x.ProducerBillId.ToString() == billId).AsNoTracking().ToList(); foreach (BillEntry billEntry in bill.BillEntries) { billEntry.ConsumerBill = _context.ConsumerBills.Include(x => x.BillEntries).ThenInclude(x => x.ProductStock).ThenInclude(x => x.Product).Include(x => x.AdherentStolon).ThenInclude(x => x.Adherent).AsNoTracking().First(x => x.BillId == billEntry.ConsumerBillId); billEntry.ProductStock = _context.ProductsStocks.First(x => x.Id == billEntry.ProductStockId); billEntry.ProductStock.Product = _context.Products.First(x => x.Id == billEntry.ProductStock.ProductId); } return(Json(bill)); }
// GET: Bills/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IBill bill = _billService.GetBill(CommonFunctions.NullableIntToInt(id)); if (bill == null) { return(HttpNotFound()); } return(View(new CreateBillVM(bill))); }
/////////////////////////////////////////////////////////////////////////////////////////////// ////// // Function Name : <AddBill> // Summary : <To add a generated bill to the database by calling the corresponding DB Function> // Input Parameters : <Object of bill class> // Output Parameters :<Integer value billId> // Return Value : <Unique value of autogenerated bill id> // /////////////////////////////////////////////////////////////////////////////////////////////// public Int64 AddBill(IBill obj) { Int64 billId = 0; IBillDB billDBobj = BillDBFactory.CreateBillDB(); try { billId = billDBobj.AddBill(obj); } catch (Exception ex) { throw ex; } return billId; }
/////////////////////////////////////////////////////////////////////////////////////////////// /////// // Function Name : <AddBill> // Summary : <To add a generated bill to the database by calling the corresponding DB Stored Procedure> // Input Parameters : <Object of bill class> // Output Parameters :<Integer value billId> // Return Value : <Unique value of autogenerated bill id> // /////////////////////////////////////////////////////////////////////////////////////////////// public int AddBill(IBill obj) { int rows, billId; SqlConnection connect = null; try { connect = DBUTILITY.getConnection(); SqlCommand comm = new SqlCommand(); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "insertbill_TeamE_TMS65"; comm.Connection = connect; connect.Open(); comm.Parameters.AddWithValue("@Customer_id", obj.CustomerId); comm.Parameters.AddWithValue("@Connection_id", obj.ConnectionId); comm.Parameters.AddWithValue("@amount", obj.Amount); comm.Parameters.AddWithValue("@generatedate", obj.GenerateDate); comm.Parameters.AddWithValue("@year", obj.Year); comm.Parameters.AddWithValue("@month", obj.Month); comm.Parameters.AddWithValue("@arrears", obj.Arrears); comm.Parameters.AddWithValue("@advanced_payment", obj.AdvancedPayment); comm.Parameters.AddWithValue("@Discount_Amount", obj.Discount); comm.Parameters.AddWithValue("@total_amount", obj.Total); comm.Parameters.AddWithValue("@Bill_Id", 0); comm.Parameters["@Bill_Id"].Direction = ParameterDirection.Output; rows = comm.ExecuteNonQuery(); billId = Convert.ToInt32(comm.Parameters["@Bill_Id"].Value); } catch (Exception ex) { throw ex; } finally { if (connect.State == ConnectionState.Open) connect.Close(); } if (rows == 0) return rows; else return billId; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <GenerateBill> // Summary : <To generate a bill for a single connection of a particular user> // Input Parameters : <Object of bill class containing customer id,connection Number,year,month and generation date> // Output Parameters <Integer value billId> // Return Value : <Unique value of autogenerated bill id> // /////////////////////////////////////////////////////////////////////////////////////////////// public Int64 GenerateBill(IBill bill) { double amount = 0; double arrears = 0; double advance = 0; double discount = 0; double totalAmount = 0; amount = GetAmount(bill); IBill adjustment = GetAdjustment(bill); arrears = adjustment.Arrears; advance = adjustment.AdvancedPayment; string paymode = CheckDiscount(bill); if (paymode.ToUpper().Equals("EBILL")) { discount = (.02 * amount); } totalAmount = GetTotalAmount(amount, arrears, advance, discount); IBill billobj = BillFactory.CreateBill(bill.BillId, bill.CustomerId, bill.ConnectionId, amount, bill.GenerateDate, bill.Year, bill.Month, arrears, advance, discount, totalAmount); Int64 billId = AddBill(billobj); return billId; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <GetAdjustment> // Summary : <To get the arrears and advance payments of the bill> // Input Parameters : <Object of bill class containing customer id,connection Number,year,month and generation date> // Output Parameters <Object of bill class containing arrears and advance payments> // Return Value : <Arrears and advance payments value> // /////////////////////////////////////////////////////////////////////////////////////////////// public IBill GetAdjustment(IBill bill) { IBill billNew = null; IBillDB billDBobj = BillDBFactory.CreateBillDB(); try { billNew = billDBobj.GetAdjustment(bill); } catch (Exception ex) { throw ex; } return billNew; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <UpdateBill> // Summary : <To update the bill amount of a bill by calling the corresponding DB Stored Procedure > // Input Parameters : <Object of bill class> // Output Parameters <integer value rowsupdated> // Return Value : < number of rows updated > // /////////////////////////////////////////////////////////////////////////////////////////////// public int UpdateBill(IBill obj) { int rows; SqlConnection connect = null; try { connect = DBUTILITY.getConnection(); SqlCommand comm = new SqlCommand(); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "update_bill_TeamE_TMS65"; comm.Connection = connect; connect.Open(); comm.Parameters.AddWithValue("@bill_id", obj.BillId); comm.Parameters.AddWithValue("@Customer_id", obj.CustomerId); comm.Parameters.AddWithValue("@Connection_id", obj.ConnectionId); comm.Parameters.AddWithValue("@amount", obj.Amount); comm.Parameters.AddWithValue("@generatedate", obj.GenerateDate); comm.Parameters.AddWithValue("@year", obj.Year); comm.Parameters.AddWithValue("@month", obj.Month); comm.Parameters.AddWithValue("@arrears", obj.Arrears); comm.Parameters.AddWithValue("@advanced_payment", obj.AdvancedPayment); comm.Parameters.AddWithValue("@Discount_Amount", obj.Discount); comm.Parameters.AddWithValue("@total_amount", obj.Total); rows = comm.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { if (connect.State == ConnectionState.Open) connect.Close(); } return rows; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <ViewUpdateBill> // Summary : <To view a particular bill by its billid by calling the corresponding DBFunction> // Input Parameters : <Object of bill class containing bill id> // Output Parameters <Object of the bill class> // Return Value : < Entire Bill details > // /////////////////////////////////////////////////////////////////////////////////////////////// public IBill ViewUpdateBill(IBill obj) { IBill bill = null; IBill newBill = null; IBillDB billDBobj = BillDBFactory.CreateBillDB(); try { bill = billDBobj.ViewBill(obj); newBill = BillFactory.CreateBill(bill.BillId, bill.CustomerId, bill.ConnectionId, bill.Amount, bill.GenerateDate, bill.Year,bill.Month, bill.Arrears, bill.AdvancedPayment, bill.Discount, bill.Total); } catch (Exception ex) { throw ex; } return newBill; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <CheckDiscount> // Summary : <To find the mode of payment the customer uses to pay> // Input Parameters : <Object of bill class containing customer id,connection Number,year,month and generation date> // Output Parameters <String value paymode> // Return Value : <Payment mode value> // /////////////////////////////////////////////////////////////////////////////////////////////// public string CheckDiscount(IBill bill) { IBillDB billDBobj = BillDBFactory.CreateBillDB(); string paymode = ""; try { paymode = billDBobj.CheckDiscount(bill); } catch (Exception ex) { throw ex; } return paymode; }
public void UpdateAgent(IBill bill, long? agentUid) { ExceptionHelper.ThrowIfNull(bill, "bill"); if(agentUid.HasValue) ExceptionHelper.ThrowIfNotId(agentUid, "agentUid"); if(Nullable.Compare(agentUid, bill.AgentUid) != 0) { bill.AgentUid = agentUid; _BillRepository.SaveChanges(); } }
public void UpdateBillState(IBill bill, BillStates state, string remarks, DateTime? date = null) { ExceptionHelper.ThrowIfNull(bill, "bill"); if (state == bill.State) { UpdateLastStateHistoryRemarksIfMatchState(bill, state, remarks); return; } using (var scope = new System.Transactions.TransactionScope()) { bill.UpdateState(_User, state); _BillRepository.SaveChanges(); InsertBillStateHistory(bill, state, remarks, date); scope.Complete(); } }
public void UpdateBill(IBill bill, ContactInfo sender, ContactInfoWithAddress receiver, decimal insurance, string goods, string remarks) { ExceptionHelper.ThrowIfNull(bill, "bill"); bill.UpdateInfo(sender, receiver); bill.UpdateInfo(insurance, goods, remarks); _BillRepository.SaveChanges(); }
public static string GetUrl(IBill bill) { string url = GetUrl(bill.User is Consumer ? Configurations.ConsumersBillsStockagePath : Configurations.ProducersBillsStockagePath); url += "/" + bill.User.Id + "/" + bill.BillNumber + ".xlsx"; return url; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <UpdateBill> // Summary : <To update the bill amount of a bill by calling the corresponding DBFunction> // Input Parameters : <Object of bill class> // Output Parameters <integer value rowsupdated> // Return Value : < number of rows updated > // /////////////////////////////////////////////////////////////////////////////////////////////// public int UpdateBill(IBill obj) { int rowsUpdated = 0; IBillDB billDBobj = BillDBFactory.CreateBillDB(); try { rowsUpdated = billDBobj.UpdateBill(obj); } catch (Exception ex) { throw ex; } return rowsUpdated; }
public void InsertBillStateHistory(IBill bill, BillStates state, string remarks, DateTime? date = null) { ExceptionHelper.ThrowIfNull(bill, "bill"); var entity = new Data.BillStateHistory { bid = bill.Bid, created = DateTime.Now, state_updated = date ?? DateTime.Now, creater = _User.Uid, remarks = remarks.SafeTrim().GetSafeDbString(), state = state, enabled = true, }; _BillStateHistoryRepository.Add(entity); _BillStateHistoryRepository.SaveChanges(); }
public void DeleteBill(IBill bill) { ExceptionHelper.ThrowIfNull(bill, "bill"); bill.Delete(); _BillRepository.SaveChanges(); }
private void UpdateLastStateHistoryRemarksIfMatchState(IBill bill, BillStates currentState, string remarks) { if (String.IsNullOrWhiteSpace(remarks)) return; var entity = _BillStateHistoryRepository.Entities .Where(h => h.enabled && h.bid == bill.Bid) .OrderByDescending(h => h.state_updated) .FirstOrDefault(); if (entity.state == currentState) { entity.remarks = remarks.Trim(); _BillStateHistoryRepository.SaveChanges(); } }
public void UpdateCreated(IBill bill, DateTime created) { ExceptionHelper.ThrowIfNull(bill, "bill"); if (bill.Created != created) { bill.UpdateCreated(_User, created); _BillRepository.SaveChanges(); } }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <GetAdjustment> // Summary : <To get the arrears and advance payments of the bill> // Input Parameters : <Object of bill class containing customer id,connection Number,year,month and generation date> // Output Parameters <Object of bill class containing arrears and advance payments> // Return Value : <Arrears and advance payments value> // /////////////////////////////////////////////////////////////////////////////////////////////// public IBill GetAdjustment(IBill obj) { IBill bill = null; SqlConnection conn = null; try { conn = DBUTILITY.getConnection(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "get_asjustment_teamE_TMS_65"; conn.Open(); cmd.Parameters.AddWithValue("@customerid", obj.CustomerId); cmd.Parameters.AddWithValue("@connectionNo", obj.ConnectionId); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { double arrears = Convert.ToDouble(sdr["Arrears"]); double advance = Convert.ToDouble(sdr["Advanced_Payment"]); bill = BillFactory.CreateBill(arrears, advance); } } catch (Exception ex) { throw ex; } finally { if (conn.State == ConnectionState.Open) conn.Close(); } return bill; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <CheckConnection> // Summary : <To check if a particular connection number exists and is active by calling the corresponding DBFunction> // Input Parameters : <Object of bill class containing connection number> // Output Parameters <integer value flag> // Return Value : < 0/1 > // /////////////////////////////////////////////////////////////////////////////////////////////// public int CheckConnection(IBill obj) { int isValid = 0; SqlConnection conn = null; try { conn = DBUTILITY.getConnection(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "check_connection_teamE_TMS_65"; conn.Open(); cmd.Parameters.AddWithValue("@connection_id", obj.ConnectionId); isValid = Convert.ToInt32(cmd.ExecuteNonQuery()); } catch (Exception ex) { throw ex; } finally { if (conn.State == ConnectionState.Open) conn.Close(); } return isValid; }
public void UpdateBill(IBill bill, decimal insurance, string goods, string remarks) { ExceptionHelper.ThrowIfNull(bill, "bill"); bill.UpdateInfo(insurance, goods, remarks); _BillRepository.SaveChanges(); }
protected void UpdateGrid_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = UpdateGrid.SelectedRow; Int64 id = Convert.ToInt64(row.Cells[0].Text); try { staticbill = BillFactory.CreateBill(id); IBillManager billManagerObj = BillManagerFactory.CreateBillManager(); IBill ibill = billManagerObj.ViewUpdateBill(staticbill); double returnNewBill = billManagerObj.GetAmount(ibill); IBill oldBill = BillFactory.CreateBill(id); IBill returnOldBill = billManagerObj.ViewUpdateBill(oldBill); returnOldBill.AdvancedPayment = returnOldBill.AdvancedPayment + (returnOldBill.Amount - returnNewBill); returnOldBill.Amount = returnNewBill; int result = billManagerObj.UpdateBill(returnOldBill); if (result > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "scr1", "<script type='text/javascript'>alert('Your Data is Updated'); </script>", false); fill(); row.Enabled = false; } } catch (Exception ex) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script type='text/javascript'> alert('" + ex.Message + "')</script>"); } }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <CheckDiscount> // Summary : <To find the mode of payment by calling the DB Procedure> // Input Parameters : <Object of bill class containing customer id,connection Number,year,month and generation date> // Output Parameters <String value paymode> // Return Value : <Payment mode value> // /////////////////////////////////////////////////////////////////////////////////////////////// public string CheckDiscount(IBill obj) { string paymode; SqlConnection connect = null; try { connect = DBUTILITY.getConnection(); SqlCommand comm = new SqlCommand(); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "check_ebill_teamE_TMS_65"; comm.Connection = connect; connect.Open(); comm.Parameters.AddWithValue("@customerid", obj.CustomerId); comm.Parameters.AddWithValue("@connectionNo", obj.ConnectionId); paymode = (comm.ExecuteScalar().ToString()); } catch (Exception ex) { throw ex; } finally { if (connect.State == ConnectionState.Open) connect.Close(); } return paymode; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <ViewBillByConnection> // Summary : <To view a particular bill based on connection number and year/month by calling the corresponding DBFunction> // Input Parameters : <Object of bill class containing connection number,year,month> // Output Parameters <Object of the bill class> // Return Value : < Entire Bill details > // /////////////////////////////////////////////////////////////////////////////////////////////// public IBill ViewBillByConnection(IBill obj) { IBill bill = null; IBill newBill = null; IBillDB billDBobj = BillDBFactory.CreateBillDB(); try { bill = billDBobj.ViewBillByConnection(obj); string monthString = monthList[Convert.ToInt32(bill.Month) - 1]; newBill = BillFactory.CreateBill(bill.BillId,bill.CustomerId,bill.ConnectionId,bill.Amount,bill.GenerateDate,bill.Year,monthString,bill.Arrears,bill.AdvancedPayment,bill.Discount,bill.Total); } catch (Exception ex) { throw ex; } return newBill; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <GetTotal> // Summary : <To get the amount of the bill by making the sum of all the bill items respective to that bill by calling the respective DB Procedure> // Input Parameters : <Object of bill class containing customer id,connection Number,year,month and generation date> // Output Parameters <Double value amount> // Return Value : <Total amount of the bill which is the sum of all call costs> // /////////////////////////////////////////////////////////////////////////////////////////////// public double GetTotal(IBill obj) { double total; SqlConnection connect = null; try { connect = DBUTILITY.getConnection(); SqlCommand comm = new SqlCommand(); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "get_amt_teamE_TMS_65"; comm.Connection = connect; connect.Open(); comm.Parameters.AddWithValue("@connectionNo", obj.ConnectionId); comm.Parameters.AddWithValue("@year", obj.Year.ToString()); comm.Parameters.AddWithValue("@month", obj.Month.ToString()); total = Convert.ToDouble(comm.ExecuteScalar()); } catch (Exception ex) { throw ex; } finally { if (connect.State == ConnectionState.Open) connect.Close(); } return total; }
public void UpdateBillInternalState(IBill bill, InternalTrade trade, string remarks, DateTime? date = null) { ExceptionHelper.ThrowIfNull(bill, "bill"); using (var scope = new System.Transactions.TransactionScope()) { var oldState = bill.State; bill.UpdateInternalState(_User, trade); _BillRepository.SaveChanges(); if (BillStates.清关完毕国内派送中 != oldState) InsertBillStateHistory(bill, BillStates.清关完毕国内派送中, remarks, date); scope.Complete(); } }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <ViewBillByConnection> // Summary : <To view a particular bill based on connection number and year/month by calling the corresponding DB Stored Procedure> // Input Parameters : <Object of bill class containing connection number,year,month> // Output Parameters <Object of the bill class> // Return Value : < Entire Bill details > // /////////////////////////////////////////////////////////////////////////////////////////////// public IBill ViewBillByConnection(IBill obj) { IBill bill = null; SqlConnection conn = null; try { conn = DBUTILITY.getConnection(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "viewAll_bill_by_connection_teamE_TMS_65"; conn.Open(); cmd.Parameters.AddWithValue("@connectionNo", obj.ConnectionId); cmd.Parameters.AddWithValue("@month", obj.Month.ToString()); cmd.Parameters.AddWithValue("@year", obj.Year.ToString()); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { Int64 billId = Convert.ToInt64(sdr["Bill_Id"]); string customerId = sdr["CustomerId"].ToString(); Int64 connectionId = Convert.ToInt64(sdr["ConnectionNo"]); double amount = Convert.ToDouble(sdr["Amount"]); DateTime generationDate = Convert.ToDateTime(sdr["GenerationDate"]); int year = Convert.ToInt32(sdr["_year"]); string month = sdr["_month"].ToString(); double arrears = Convert.ToDouble(sdr["Arrears"]); double advance = Convert.ToDouble(sdr["Advanced_Payment"]); double discount = Convert.ToDouble(sdr["Discount_Amount"]); double totalAmount = Convert.ToDouble(sdr["Total_Amount"]); bill = BillFactory.CreateBill(billId, customerId, connectionId, amount, generationDate, year, month, arrears, advance, discount, totalAmount); } } catch (Exception ex) { throw ex; } finally { if (conn.State == ConnectionState.Open) conn.Close(); } return bill; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <CheckConnection> // Summary : <To check if a particular connection number exists and is active by calling the corresponding DBFunction> // Input Parameters : <Object of bill class containing connection number> // Output Parameters <integer value flag> // Return Value : < 0/1 > // /////////////////////////////////////////////////////////////////////////////////////////////// public int CheckConnection(IBill obj) { int flag = 0; IBillDB billItemDBobj = BillDBFactory.CreateBillDB(); try { flag = billItemDBobj.CheckConnection(obj); } catch (Exception ex) { throw ex; } return flag; }
private void ClearControls() { _billData = new BillData(); _inventoryData = new InventoryData(); _client = null; _remissionDetail = new List<RemissionDetailModel>(); _remissionSaveModel = new RemissionSaveModel(); _remission = new RemissionModel { Id = Guid.NewGuid(), RemissionNumber = _remissionData.GetRemissionNumber(), DateEvent = DateTime.Now }; lblNumeroRemision.Text = _remission.RemissionNumber.ToString().PadLeft(8, '0'); lblGranTotal.Text = "$0,00"; txtSubTotal.Text = string.Format("{0:0.00}", 0.00); txtDescuentoFinal.Text = string.Format("{0:0.00}", 0.00); txtDescuentoCliente.Text = string.Format("{0:0.00}", 0.00); dtgDetalleRemision.DataSource = new List<RemissionDetailModel>(); txtIdentificacionCliente.Text = string.Empty; txtNombreCliente.Text = string.Empty; txtDireccion.Text = string.Empty; txtTelefono.Text = string.Empty; txtEmail.Text = string.Empty; txtCodigoBarras.Text = string.Empty; txtNombreProducto.Text = string.Empty; lstProducto.DataSource = new List<InventoryModel>(); btnRemitir.Enabled = false; }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : <GetAmount> // Summary : <To get the amount of the bill by making the sum of all the bill items respective to that bill> // Input Parameters : <Object of bill class containing customer id,connection Number,year,month and generation date> // Output Parameters <Double value amount> // Return Value : <Total amount of the bill which is the sum of all call costs> // /////////////////////////////////////////////////////////////////////////////////////////////// public double GetAmount(IBill bill) { IBillDB billDBobj = BillDBFactory.CreateBillDB(); double amount=0; try { amount = billDBobj.GetTotal(bill); } catch (Exception ex) { throw ex; } return amount; }