public bool CanSale(string passport, string valueForSale, string currencyForSale) { RestrictionsRep restrictions = new RestrictionsRep(); ClientRep clientRep = new ClientRep(); Client client = new Client(); double currencyRestriction = restrictions.GetCurrencyRestriction(currencyForSale); client = clientRep.SearchClientInFile(passport); double saleCurrency = Convert.ToDouble(client.SoldCurrency[currencyForSale]); double value = Convert.ToDouble(valueForSale); double valueAfterSale = value + saleCurrency; double availableValue = currencyRestriction - valueAfterSale; if (availableValue > 0) { return(true); } else { return(false); } }
public bool CanBuy(string passport, string valueForBuy, string currencyForBuy) { RestrictionsRep restrictions = new RestrictionsRep(); ClientRep clientRep = new ClientRep(); Client client = new Client(); double currencyRestriction = restrictions.GetCurrencyRestriction(currencyForBuy); client = clientRep.SearchClientInFile(passport); double purchCurrency = Convert.ToDouble(client.PurchasedCurrency[currencyForBuy]); double value = Convert.ToDouble(valueForBuy); double valueAfterPurch = value + purchCurrency; double availableValue = currencyRestriction - valueAfterPurch; if (availableValue > 0) { return(true); } else { return(false); } }
public ClassUnitOfWorkRep(MineVideoRental context) { this.context = context; CassetteRepasitory = new CasseteRepClass(context); OrderRepasitory = new OrderRepClass(context); FilmRepasitory = new FilmRepClass(context); GenreRepasitory = new GenreRepClass(context); ClientRepasitory = new ClientRepClass(context); }
public TranIndexViewModel() { DummyAddInfRep = new AddInfRep(); DummyBasicRep = new BasicRep(); DummyClientRep = new ClientRep(); DummyIssuerRep = new IssuerRep(); DummyRep406 = new Rep406(); DummySupdoc = new SupdocRep(); }
public ActionResult Index() { ClientRepository clientRepo = new ClientRepository(); ClientRep client = clientRepo.get("Chloe Waterfield"); TaskRepository project = new TaskRepository(); List <ProjectTask> model = project.get(); return(View(model)); }
public UCOfferManager() { InitializeComponent(); //remplir les listes talents = TalentRep.GetTalents(); contractTypes = ContractRep.GetContracts(); clients = ClientRep.GetClients(); //remplir les affichages fillClients(); fillContactTypes(); fillTalents(); }
public TranCreateViewModel(HeaderRep headerRep) { AddInfRep = new AddInfRep() { IdRep = headerRep.Id }; AddInfRep.HeaderRep = headerRep; BasicRep = new BasicRep(); ClientRep = new ClientRep(); IssuerRep = new IssuerRep(); Rep406 = new Rep406(); Supdoc = new SupdocRep(); NoticeRep = new NoticeRep(); }
public void add(ProjectTask task) { Project project = projectRepo.get(task.projectName); ClientRep client = clientRepo.get(task.clientRep); using (var conn = GetConnection()) { using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = @"INSERT INTO Task (ProjectId, ClientRepID, TastStatusId,LeadTime) VALUES (@projectId, @clientrepId, @statusId, @leadTime)"; cmd.Parameters.AddWithValue("@projectId", project.id); cmd.Parameters.AddWithValue("@clientrepId", client.clientReps.Select(a => a.Value == task.clientRep).First()); cmd.Parameters.AddWithValue("@statusId", (int)Status.InProgress); cmd.Parameters.AddWithValue("@leadTime", task.leadTime); } } }
private void clientInsertClick(object sender, EventArgs e) { if (nameBoxC.Text.Length != 0 && mailBoxC.Text.Contains("@") == true && contactBoxC.Text.Length != 0) { rand = r.Next(00000, 99999); idBoxC.Text = "clt" + rand; empIdBoxC.Text = i; passBoxC.Text = (r.Next(123456, 999999)).ToString(); ClientRep cr = new ClientRep(); cr.Id = this.idBoxC.Text; cr.Name = this.nameBoxC.Text; cr.Gender = this.sexBoxC.Text; cr.Address = this.addBoxC.Text; cr.Email = this.mailBoxC.Text; cr.AddedBy = this.empIdBoxC.Text; //Console.WriteLine(cr.Status + " " + cr.Id); cr.Contacts = this.contactBoxC.Text; cr.Password = this.passBoxC.Text; cr.Occupation = this.occBox.Text; ClientRepositoryDB crdb = new ClientRepositoryDB(); if (crdb.Insert(cr)) { MessageBox.Show("Insert Completed!", "Succeed"); //button32.Visible = true; } else { MessageBox.Show("Insert Not Complete", "Error"); } } else { MessageBox.Show("Invalid!", "Error"); } }
public ClientRep get(string clientRep) { ClientRep client = new ClientRep(); using (conn) { client = conn.Query <ClientRep>(@"SELECT Client.Id,Client.Name,Client.Address1 as address,Client.PostCode,Client.City ,Client.Country,Client.Vat FROM ClientRep JOIN Client ON ClientRep.CliendId = Client.Id WHERE concat( ClientRep.FirstName, ' ', ClientRep.LastName ) = @name", new { name = clientRep }).First(); var row = conn.Query <ClientRep>(@"SELECT id, CONCAT( FirstName, ' ', LastName ) AS name FROM ClientRep WHERE CONCAT( FirstName, ' ', LastName ) = @name", new { name = clientRep }).ToList(); client.clientReps = new Dictionary <int, string>() { { row[0].id, row[0].name } }; return(client); } }
private void LoadArchiveFromExcel(CcRepContext context) { for (int i = 0; i < fileLoadArchive.Length; i++) { string[] param = fileLoadArchive[i].Split(':'); string pathToExcelFile = path_to_xlsx + param[0]; var excelFile = new ExcelQueryFactory(pathToExcelFile); string[] sheets = param[1].Split(','); List <ArchiveRow> dataArchive; //********* var connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";", pathToExcelFile); var adapter = new OleDbDataAdapter(String.Format("SELECT * FROM [{0}$]", sheets[0]), connectionString); var ds = new DataSet(); adapter.Fill(ds, "ExcelTable"); DataTable dtable = ds.Tables["ExcelTable"]; //************************* foreach (string sheetName in sheets) { try { dataArchive = (from a in excelFile.Worksheet <ArchiveRow>(sheetName) select a).ToList(); // dataArchive = excelFile.Worksheet<ArchiveRow>(sheetName).ToList(); } catch { return; } int k = 0; foreach (var a in dataArchive) { k++; try { AddInfRep ai = new AddInfRep(); ai.Form = a.FORM; ai.Section = a.SECTION; ai.Status = a.STATUS; ai.IdRep = Convert.ToInt32(a.ID_REP); ai.Author = a.AUTOR; ai.Source = a.SOURCE; ai.SupdocFl = a.SUPDOC_FL; ai.SourceName = a.SOURCE_NAME; ai.PaymentRK = k; ai.IrbPaymentRK = k; context.AddInfReps.Add(ai); context.SaveChanges(); AddInfRep last_ai = context.AddInfReps.Last <AddInfRep>(); BasicRep br = new BasicRep(); br.IdOper = last_ai.IdOper; br.Filial = a.FILIAL.PadLeft(4, '0');; br.PostDate = DateTime.ParseExact(a.POSTDATE, date_format, cult_info); br.CodeVO = a.CODE_VO; br.TypeTooling = a.TYPE_TOOLING; br.OperType = Convert.ToByte(a.OPER_TYPE); br.Count = Convert.ToInt64(a.COUNT); br.Share = Convert.ToDecimal(a.SHARE, cult_info); br.Ccy = a.CCY; br.AmountAll = Convert.ToDecimal(a.AMOUNT_ALL, cult_info); br.AmntIncome = Convert.ToDecimal(a.AMNT_INCOME, cult_info); br.Swift = a.SWIFT_405; br.SwiftFil = a.SWIFT_FIL_405; br.ValueDate = DateTime.ParseExact(a.VALUEDATE, date_format, cult_info); br.RefNum = a.REF_NUM; context.BasicReps.Add(br); ClientRep cr = new ClientRep(); cr.IdOper = last_ai.IdOper; cr.BicPartner = a.BIC_PARTNER; cr.CountryRez = a.COUNTRY_REZ; cr.NameRez = a.NAME_REZ; cr.TypeRez = a.TYPE_REZ; cr.INN = a.INN; cr.NameNerez = a.NAME_NEREZ; cr.TypeNerez = a.TYPE_NEREZ; cr.CountryNerez = a.COUNTRY_NEREZ; cr.BankName = a.BANK_NAME; cr.CountryBank = a.COUNTRY_BANK; cr.PartnerName = a.PARTNER_NAME; cr.CountryPartner = a.COUNTRY_PARTNER; context.ClientReps.Add(cr); IssuerRep ir = new IssuerRep(); ir.IdOper = last_ai.IdOper; ir.IssuerName = a.ISSUER_NAME; ir.SecurityCode = a.SECURITY_CODE; ir.RegNumIssuer = a.REG_NUM_ISSUER; ir.DateRegIssuer = DateTime.ParseExact(a.DATE_REG_ISSUER, date_format, cult_info); ir.RepayDate = DateTime.ParseExact(a.REPAY_DATE, date_format, cult_info); ir.CcyIssuer = a.CCY_ISSUER; ir.IssuerCode = Convert.ToByte(a.ISSUER_CODE); ir.IssuerReestr = a.ISSUER_REESTR; context.IssuerReps.Add(ir); NoticeRep nr = new NoticeRep(); nr.IdOper = last_ai.IdOper; nr.Notice = a.NOTICE; nr.NoticeIssuer = a.NOTICE_ISSUER; nr.NoticeExchange = a.NOTICE_EXCHANGE; nr.NoticeInst = a.NOTICE_INST; nr.NoticeProperty = a.NOTICE_PROPERTY; nr.NoticeBank = a.NOTICE_BANK; AddRep ar = new AddRep(); ar.IdOper = last_ai.IdOper; ar.CcdUser = a.CCD_USER; ar.Narrative = a.NARRATIVE; ar.CityCode = a.CITY_CODE; ar.NoticeReport = a.NOTICE_REPORT; ar.DepAcc = a.DEP_ACC; ar.ContractNum = a.CONTRACT_NUM; context.SaveChanges(); } catch (DbEntityValidationException ex) { throw new Exception("[LoadArchiveFromExcel] " + ex.Message); } } } } }