protected void OwnerdvDataSource_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { Broker.DataAccess.Client c = e.InputParameters["entityToInsert"] as Broker.DataAccess.Client; //if (Validator.GetByName("EmbgInsertValidator").IsActive) { c.ValidateOwner(); // } }
public static List <FinanceCardInfo> GetByClientOpenItems(Broker.DataAccess.Client c) { List <FinanceCardInfo> retList = new List <FinanceCardInfo>(); List <Policy> pList = Policy.GetByClient(c.ID); decimal saldoValue = 0; for (int i = 0; i < pList.Count; i++) { List <FinanceCardInfo> finListTmp = GetByPolicy(pList[i], 0); if (finListTmp.Count > 0) { if (finListTmp.Last().SaldoValue == (decimal)0) { string s = "sss"; } else { List <FinanceCardInfo> finList = GetByPolicy(pList[i], saldoValue); if (finList.Count > 0) { retList.AddRange(finList); saldoValue = finList.Last().SaldoValue; } } } } return(retList); }
protected void btnOwnerToClient_Click(object sender, EventArgs e) { if (ViewState["OwnerID"] != null) { TextBox tbEmbg = PoliciesDetailsView.FindControl("tbClientEMBG") as TextBox; TextBox tbName = PoliciesDetailsView.FindControl("tbClientName") as TextBox; int ownerID = int.Parse(ViewState["OwnerID"].ToString()); Broker.DataAccess.Client c = Broker.DataAccess.Client.Get(ownerID); tbEmbg.Text = c.EMBG; tbName.Text = c.Name; ViewState["ClientID"] = ownerID; } }
protected void btnSearchEMBG_Click(object sender, EventArgs e) { TextBox tbEmbg = DetailsView1.FindControl("tbEMBG") as TextBox; Broker.DataAccess.Client c = Broker.DataAccess.Client.GetByEmbg(tbEmbg.Text); if (c != null) { ViewState["ClientID"] = c.ID; TextBox tbName = DetailsView1.FindControl("tbClientName") as TextBox; tbName.Text = c.Name; } else { } }
public static List <FinanceCardInfo> GetByClient(Broker.DataAccess.Client c) { List <FinanceCardInfo> retList = new List <FinanceCardInfo>(); List <Policy> pList = Policy.GetByClient(c.ID); decimal saldoValue = 0; for (int i = 0; i < pList.Count; i++) { List <FinanceCardInfo> finList = GetByPolicy(pList[i], saldoValue); retList.AddRange(finList); if (finList.Count > 0) { saldoValue = finList.Last().SaldoValue; } } return(retList); }
protected void OwnerDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e) { if (e.Exception != null) { e.ExceptionHandled = true; e.KeepInInsertMode = true; ValidationUtility.ShowValidationErrors(this, e.Exception); } else { string embg = e.Values["EMBG"].ToString(); Broker.DataAccess.Client o = Broker.DataAccess.Client.GetByEmbg(embg); ViewState["OwnerID"] = o.ID; TextBox tbName = PoliciesDetailsView.FindControl("tbOwnerName") as TextBox; tbName.Text = o.Name; Panel pnl = PoliciesDetailsView.FindControl("pnlOwner") as Panel; pnl.Visible = false; } }
protected void ClientDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e) { if (e.Exception != null) { e.ExceptionHandled = true; e.KeepInInsertMode = true; ValidationUtility.ShowValidationErrors(this, e.Exception); } else { TextBox tbClientName = DetailsView1.FindControl("ClientDetailsView").FindControl("tbName") as TextBox; TextBox tbName = DetailsView1.FindControl("tbClientName") as TextBox; tbName.Text = tbClientName.Text; Panel pnl = DetailsView1.FindControl("pnlClient") as Panel; pnl.Visible = false; string embg = e.Values["EMBG"].ToString(); Broker.DataAccess.Client c = Broker.DataAccess.Client.GetByEmbg(embg); ViewState["ClientID"] = c.ID; } }
protected void btnSearchOwnerEMBG_Click(object sender, EventArgs e) { TextBox tbEmbg = DetailsView1.FindControl("tbOwnerEMBG") as TextBox; Broker.DataAccess.Client o = Broker.DataAccess.Client.GetByEmbg(tbEmbg.Text); if (o != null) { ViewState["OwnerID"] = o.ID; TextBox tbName = DetailsView1.FindControl("tbOwnerName") as TextBox; tbName.Text = o.Name; Panel ownerPanel = DetailsView1.FindControl("pnlOwner") as Panel; ownerPanel.Visible = false; } else { Panel ownerPanel = DetailsView1.FindControl("pnlOwner") as Panel; ownerPanel.Visible = true; DetailsView dvClient = DetailsView1.FindControl("OwnerDetailsView") as DetailsView; TextBox tbOwnerEMBG = dvClient.FindControl("tbEMBG") as TextBox; tbOwnerEMBG.Text = tbEmbg.Text; } }
protected void btnSearchClientEMBG_Click(object sender, EventArgs e) { TextBox tbEmbg = DetailsView1.FindControl("tbClientEMBG") as TextBox; Broker.DataAccess.Client c = Broker.DataAccess.Client.GetByEmbg(tbEmbg.Text); if (c != null) { ViewState["ClientID"] = c.ID; TextBox tbName = DetailsView1.FindControl("tbClientName") as TextBox; tbName.Text = c.Name; Panel clientPanel = DetailsView1.FindControl("pnlClient") as Panel; clientPanel.Visible = false; } else { Panel clientPanel = DetailsView1.FindControl("pnlClient") as Panel; clientPanel.Visible = true; DetailsView dvClient = DetailsView1.FindControl("ClientDetailsView") as DetailsView; TextBox tbClientEMBG = dvClient.FindControl("tbEMBG") as TextBox; tbClientEMBG.Text = tbEmbg.Text; } }
public static void InsertClientInFinansovo(int clientID) { try { Broker.DataAccess.Client clientBroker = Broker.DataAccess.Client.Get(clientID); FinansovoDataClassesDataContext fdc = new FinansovoDataClassesDataContext(); List <Client> list = fdc.Clients.Where(c => c.EMBG == clientBroker.EMBG).ToList(); if (list.Count == 0) { Client newClient = new Client(); newClient.Address = clientBroker.Address; string oldCode = fdc.Clients.OrderBy(c => c.ID).ToList().Last().Code; int newCode = 9999; int.TryParse(oldCode, out newCode); newCode++; string newCodeString = newCode.ToString(); string leadingZeros = ""; for (int i = 0; i < 4 - newCode.ToString().Length; i++) { leadingZeros += "0"; } newCodeString = leadingZeros + newCodeString; newClient.Code = newCodeString; newClient.CompanyID = fdc.Companies.First().ID; newClient.EMBG = clientBroker.EMBG; newClient.FaxNumber = clientBroker.Fax; newClient.IsBuyer = true; newClient.IsSeller = false; newClient.MobileNumber = clientBroker.Mobile; newClient.Name = clientBroker.Name; newClient.PhoneNumber = clientBroker.Phone; newClient.PlaceID = fdc.Places.First().ID; newClient.TaxNumber = ""; fdc.Clients.InsertOnSubmit(newClient); fdc.Clients.Context.SubmitChanges(); } } catch { } }
protected void btnOwnerEMBGSearch_Click(object sender, EventArgs e) { TextBox tbEmbg = PoliciesDetailsView.FindControl("tbOwnerEMBG") as TextBox; Broker.DataAccess.Client o = Broker.DataAccess.Client.GetByEmbg(tbEmbg.Text); Panel ownerPanel = PoliciesDetailsView.FindControl("pnlOwner") as Panel; if (o != null) { ViewState["OwnerID"] = o.ID; TextBox tbName = PoliciesDetailsView.FindControl("tbOwnerName") as TextBox; tbName.Text = o.Name; ownerPanel.Visible = false; } else { ownerPanel.Visible = true; DetailsView OwnerDetailsView = ownerPanel.FindControl("OwnerDetailsView") as DetailsView; TextBox tbOwnerEMBG = OwnerDetailsView.FindControl("tbEMBG") as TextBox; tbOwnerEMBG.Text = tbEmbg.Text; tbOwnerEMBG.ReadOnly = true; } }
protected void btnClientEMBGSearch_Click(object sender, EventArgs e) { TextBox tbClientEmbg = PoliciesDetailsView.FindControl("tbClientEMBG") as TextBox; string embg = tbClientEmbg.Text; Broker.DataAccess.Client c = Broker.DataAccess.Client.GetByEmbg(embg); Panel pnlClient = PoliciesDetailsView.FindControl("pnlClient") as Panel; if (c != null) { TextBox tbClientName = PoliciesDetailsView.FindControl("tbClientName") as TextBox; ViewState["ClientID"] = c.ID; tbClientName.Text = c.Name; pnlClient.Visible = false; } else { pnlClient.Visible = true; DetailsView ClientDetailsView = pnlClient.FindControl("ClientDetailsView") as DetailsView; TextBox tbClientEMBG = ClientDetailsView.FindControl("tbEMBG") as TextBox; tbClientEMBG.Text = embg; tbClientEMBG.ReadOnly = true; } }
protected void OwnerdvDataSource_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Broker.DataAccess.Client c = e.InputParameters["newEntity"] as Broker.DataAccess.Client; }
public static void PrintFinCard(Policy p, Broker.DataAccess.Client c, string itemsType) { string brokerName = BrokerHouseInformation.GetBrokerHouseName(); PDFCreators creator = new PDFCreators(true, 25, 25, 15, 15); creator.SetDocumentHeaderFooter(); creator.OpenPDF(); creator.GetContentByte(); creator.AddJDBLogoForFactures(10, 775); creator.SetTitleLeft8(" "); creator.SetTitleLeft8(" "); creator.SetTitleLeft8(" "); creator.SetTitleLeft8(" "); creator.SetTitleLeft8(" Жиро-сметка : " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.ZIRO_SMETKA).Value); creator.SetTitleLeft8(" Депонент : " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.DEPONENT).Value); creator.SetTitleLeft8(" ЕДБ : " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.EDB).Value + " " + "Матичен број : " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.MATICEN_BROJ).Value); creator.SetTitleLeft8(" "); creator.SetTitleCenterForFactureNumber("ФИНАНСОВА КАРТИЦА"); List <FinanceCardInfo> lst = new List <FinanceCardInfo>(); if (p != null) { creator.SetTitleLeftWithFontSize10("за полиса " + p.PolicyItems[0].PolicyNumber); lst = FinanceControllers.FinanceCardController.GetByPolicy(p, 0); } else if (c != null) { creator.SetTitleLeftWithFontSize10("за договорувач: "); creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(c.Name).ToUpper()); creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(c.Address).ToUpper()); creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(c.Place.Municipality.Name).ToUpper()); if (itemsType == "AllItems") { lst = FinanceControllers.FinanceCardController.GetByClient(c); } else if (itemsType == "OpenItems") { lst = FinanceControllers.FinanceCardController.GetByClientOpenItems(c); } } creator.SetTitleLeft10("Датум на печатење: " + DateTime.Today.ToShortDateString()); //decimal totalSaldo = 0; decimal totalDebtValue = 0; decimal totalDemandValue = 0; string[] headers = { "Дата", "Доспева", "Опис", "Должи", "Побарува", "Салдо" }; float[] widthPercentages = { 10, 10, 35, 15, 15, 15 }; TypeCode[] typeCodes = { TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal, TypeCode.Decimal, TypeCode.Decimal }; creator.CreateTable_Facture(headers.Length, headers, widthPercentages); foreach (FinanceCardInfo fci in lst) { object[] values; values = new object[headers.Length]; values[0] = fci.DocumentDate.ToShortDateString(); values[1] = fci.PaidDate.ToShortDateString(); values[2] = fci.Description; values[3] = String.Format("{0:#,0.00}", fci.DebtValue); values[4] = String.Format("{0:#,0.00}", fci.DemandValue); values[5] = String.Format("{0:#,0.00}", fci.SaldoValue); totalDebtValue += fci.DebtValue; totalDemandValue += fci.DemandValue; //totalSaldo += fci.SaldoValue; creator.AddDataRowForFactures(values, headers.Length, typeCodes); } object[] valuesTot; valuesTot = new object[headers.Length]; valuesTot[0] = ""; valuesTot[1] = ""; valuesTot[2] = ""; valuesTot[3] = String.Format("{0:#,0.00}", totalDebtValue); valuesTot[4] = String.Format("{0:#,0.00}", totalDemandValue); valuesTot[5] = String.Format("{0:#,0.00}", totalDebtValue - totalDemandValue); creator.AddDataRowForFactures(valuesTot, headers.Length, typeCodes); creator.AddTable(); creator.FinishPDF_FileName("FinCard"); }