public void removecontract(int ID) { contract C = new contract(); C = dal.searchId_contract_find(ID); dal.removecontract(C); }
public void removecontract(int ID)//remove contract { contract C = new contract(); C.contractID = ID; dal.removecontract(C);//call the dal method to remov from the xeleement file }
public void MapContract_Allocations() { var contractNumber = "contractNumber"; var contractVersionNumber = 1; var startDate = new DateTime(2017, 1, 1); var endDate = new DateTime(2018, 1, 1); var fcsContract = new contract() { contractNumber = contractNumber, contractVersionNumber = contractVersionNumber, startDateSpecified = true, startDate = startDate, endDateSpecified = true, endDate = endDate, contractAllocations = new[] { new contractAllocationsContractAllocation() } }; var contract = NewService().MapContract(fcsContract); contract.ContractNumber.Should().Be(contractNumber); contract.ContractVersionNumber.Should().Be(contractVersionNumber); contract.StartDate.Should().Be(startDate); contract.EndDate.Should().Be(endDate); contract.ContractAllocations.Should().HaveCount(1); }
public ActionResult Edit(int?id) { if (Request.Cookies["UserID"].Value == null) { //Redirect to login if it can't find user id TempData["message"] = "Please log in."; System.Diagnostics.Debug.WriteLine("User not logged in. Redirecting to login page.\n"); return(RedirectToAction("LandingPage", "Home")); } ViewBag.UserID = Request.Cookies["UserID"].Value; using (Entities dc = new Entities()) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } contract con = dc.contracts.Find(id); Contract viewCon = new Contract() { ConName = con.ConName, ConAllottedHours = (decimal)con.ConAllottedHours, ConHoursRemaining = con.ConHoursRemaining, }; if (con == null) { return(HttpNotFound()); } return(View(viewCon)); } }
public void DeleteTest() { contract v = new contract(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.DCID = AddDC(); v.Name = "E3p"; v.Prority = 64; v.Vendor = "yGhaxrb"; v.Remark = "t37pj9sxs"; v.ContractFileID = AddContractFile(); context.Set <contract>().Add(v); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.Delete(v.ID.ToString()); Assert.IsInstanceOfType(rv.Model, typeof(contractVM)); contractVM vm = rv.Model as contractVM; v = new contract(); v.ID = vm.Entity.ID; vm.Entity = v; _controller.Delete(v.ID.ToString(), null); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { Assert.AreEqual(context.Set <contract>().Count(), 0); } }
public void CreateTest() { PartialViewResult rv = (PartialViewResult)_controller.Create(); Assert.IsInstanceOfType(rv.Model, typeof(contractVM)); contractVM vm = rv.Model as contractVM; contract v = new contract(); v.DCID = AddDC(); v.Name = "E3p"; v.Prority = 64; v.Vendor = "yGhaxrb"; v.Remark = "t37pj9sxs"; v.ContractFileID = AddContractFile(); vm.Entity = v; _controller.Create(vm); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { var data = context.Set <contract>().FirstOrDefault(); Assert.AreEqual(data.Name, "E3p"); Assert.AreEqual(data.Prority, 64); Assert.AreEqual(data.Vendor, "yGhaxrb"); Assert.AreEqual(data.Remark, "t37pj9sxs"); } }
public IHttpActionResult Putcontract(int id, contract contract) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != contract.ID) { return(BadRequest()); } db.Entry(contract).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!contractExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult editar(long?contractID) { if (Session["USER_ID"] != null) { if (contractID != null) { long userId = (long)Session["USER_ID"]; user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); contract editContract = entities.contracts.Find(contractID); editarContratosViewModel viewModel = new editarContratosViewModel(); viewModel.side_menu = "contratos"; viewModel.side_sub_menu = "contratos_editar"; viewModel.curUser = curUser; viewModel.editContract = editContract; viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); return(View(viewModel)); } else { return(Redirect(Url.Action("NotFound", "Error"))); } } else { return(Redirect(ep.GetLogoutUrl())); } }
public bool MakeOrder(ContractModel orderDto) { List <obje> orderedphones = new List <obje>(); foreach (var pId in orderDto.OrderedObjectsIds) { obje phone = db.obje.Find(pId); // валидация orderedphones.Add(phone); } // применяем скидку contract order = new contract { date = DateTime.Now, contract_name = orderDto.contract_name, price = orderDto.price, contract_type = orderDto.contract_type, clientFK = orderDto.clientFK, workerFK = orderDto.workerFK }; db.contract.Add(order); if (db.SaveChanges() > 0) { return(true); } return(false); }
public FormMonthlyStatement(contract contract, DateTime Rentalperiod) { InitializeComponent(); this.contract = contract; this.period = Rentalperiod; salesItems = new List <SalesItem>(); }
public void hichouvSacharEmployee(contract c) { /*var Listcontracts = from n in dal.Allcontract() * where n.employeeID == c.employeeID && n.employerID == c.employerID * select n;*/ TimeSpan t = c.end - c.beginning; if (number_of_contracts(x => x.employeeID == c.employeeID && x.employerID == c.employerID) == 1)//number of contract =1 { c.commission = (c.salaryBrute * 0.10); c.salaryNet = c.salaryBrute - c.commission; c.commission = c.commission * (t.Days / 30); } else if (number_of_contracts(x => x.employeeID == c.employeeID && x.employerID == c.employerID) > 1)//delegate number of contract>1 amala { c.commission = c.salaryBrute * Math.Pow(0.25, number_of_contracts(x => x.employeeID == c.employeeID && x.employerID == c.employerID)); c.salaryNet = c.salaryBrute - c.commission; c.commission = c.commission * (t.Days / 30); } else { c.commission = (c.salaryBrute * 0.10); c.salaryNet = c.salaryBrute - c.commission; c.commission = c.commission * (t.Days / 30); } }
public contractWindow(client client) { InitializeComponent(); Contract = new contract(); Contract.client = client; controlBokEnable(); controlButtonsEnable(); }
public void Map_NullContractor() { var contract = new contract(); Action action = () => NewService().Map(Guid.Empty, contract); action.Should().Throw <ArgumentNullException>(); }
public ActionResult editar(string Error, long?contractID) { if (Session["USER_ID"] != null) { if (Session["CURRENT_COMU"] != null) { if (contractID != null) { long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]); contract editContract = entities.contracts.Where(x => x.id == contractID && x.community_id == communityAct).FirstOrDefault(); if (editContract != null) { try { long userId = (long)Session["USER_ID"]; user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); editarContractViewModel viewModel = new editarContractViewModel(); communityList = ep.GetCommunityList(userId); viewModel.communityList = communityList; viewModel.side_menu = "contratos"; viewModel.side_sub_menu = "contratos_editar"; viewModel.document_category_list = entities.document_type.Where(x => x.community_id == communityAct).ToList(); viewModel.editContract = editContract; viewModel.curUser = curUser; viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); ViewBag.msgError = Error; return(View(viewModel)); } catch (Exception ex) { return(Redirect(Url.Action("listado", "contratos", new { area = "coadmin", Error = "Problema interno " + ex.Message }))); } } else { return(Redirect(Url.Action("listado", "contratos", new { area = "coadmin", Error = "No existe ese elemento" }))); } } else { return(Redirect(Url.Action("listado", "contratos", new { area = "coadmin" }))); } } else { return(Redirect(Url.Action("listado", "contratos", new { area = "coadmin", Error = "No puede editar contratos. Usted no administra ninguna comunidad. Comuníquese con el Webmaster..." }))); } } else { return(Redirect(ep.GetLogoutUrl())); } }
public ActionResult Create(contract c) { HttpClient contrat = new HttpClient(); contrat.BaseAddress = new Uri("http://127.0.0.1:18080"); //deserializedProduct = JsonConvert.DeserializeObject<contract>("cga-web/api/contract", new JavaScriptDateTimeConverter()); contrat.PostAsJsonAsync <contract>("cga-web/api/contract", c).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode()); return(RedirectToAction("Index")); }
public void FlattenContracts() { var contract = new contract() { contracts = new[] { new contract(), new contract(), new contract(), } }; var flattenedContracts = NewService().FlattenContracts(contract); flattenedContracts.Should().HaveCount(4); }
public IHttpActionResult Getcontract(int id) { contract contract = db.contract.Find(id); if (contract == null) { return(NotFound()); } return(Ok(contract)); }
public DeviceWindow(ref contract contract, ref clientDevice clientDevice) {//редактировать существующее описание устройства, 1 параметр ссылка на договор, 2 параметр ссылка на редактируемое описание InitializeComponent(); this.contractId = contract.Id; NewDevice = clientDevice; //заполняем поля для ввода существующими данными cbTypeOfDevice.SelectedItem = clientDevice.typeOfDevice; tbModelName.Text = NewDevice.modelName; tbSerialNumber.Text = NewDevice.serialNumber; tbDescription.Text = NewDevice.description; updateTypesList(); }
public ContractModel(contract m) { contractID = m.contractID; contract_name = m.contract_name; contract_type = m.contract_type; price = m.price; date = m.date; clientFK = m.clientFK; workerFK = m.workerFK; OrderedObjects = String.Join(",", m.obje.Select(i => i.name).ToList()); OrderedObjectsIds = m.obje.Select(i => i.objectID).ToList(); }
public IHttpActionResult Postcontract(contract contract) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.contract.Add(contract); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = contract.ID }, contract)); }
public JsonResult DeleteContract(long delID) { try { contract delContract = entities.contracts.Find(delID); entities.contracts.Remove(delContract); entities.SaveChanges(); return(Json(new { result = "success" })); } catch (Exception ex) { return(Json(new { result = "error", exception = ex.HResult })); } }
private void bEditContract_Click(object sender, RoutedEventArgs e) { Int32 id = (dbGridContracts.SelectedItem as VIew_contractsExecution).Id; contract current = core.serviceCenterDB.contracts.Where(c => c.Id == id).First(); Windows.contractWindow w = new Windows.contractWindow(current); w.ShowDialog(); if (w.DialogResult == true) { core.serviceCenterDB.SaveChanges(); } updateGBGridContracts(); }
public ViewResult AddContract(contract contract) { ViewBag.message = "添加信息成功!"; var result = repository.AddContract(contract); if (result == false) { ViewBag.message = "添加信息失败!"; } return(View(new AddContractViewModel())); }
public void EditTest() { contract v = new contract(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.DCID = AddDC(); v.Name = "E3p"; v.Prority = 64; v.Vendor = "yGhaxrb"; v.Remark = "t37pj9sxs"; v.ContractFileID = AddContractFile(); context.Set <contract>().Add(v); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.Edit(v.ID.ToString()); Assert.IsInstanceOfType(rv.Model, typeof(contractVM)); contractVM vm = rv.Model as contractVM; v = new contract(); v.ID = vm.Entity.ID; v.Name = "7pgJ"; v.Prority = 47; v.Vendor = "PZP"; v.Remark = "KCcxOh7"; vm.Entity = v; vm.FC = new Dictionary <string, object>(); vm.FC.Add("Entity.DCID", ""); vm.FC.Add("Entity.Name", ""); vm.FC.Add("Entity.Prority", ""); vm.FC.Add("Entity.Vendor", ""); vm.FC.Add("Entity.Remark", ""); vm.FC.Add("Entity.ContractFileID", ""); _controller.Edit(vm); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { var data = context.Set <contract>().FirstOrDefault(); Assert.AreEqual(data.Name, "7pgJ"); Assert.AreEqual(data.Prority, 47); Assert.AreEqual(data.Vendor, "PZP"); Assert.AreEqual(data.Remark, "KCcxOh7"); } }
public bool AddContract(contract contract) { try { _logger.Information($"Adding new contract:{contract?.name}-{contract?.contract_id}"); _predictItContext.contracts.Add(contract); return(_predictItContext.SaveChanges() > 0); } catch (Exception e) { _logger.Error(e, $"Error Adding contract:{contract?.name}-{contract?.contract_id} - market: {contract?.market?.name}"); return(false); } }
public IHttpActionResult Deletecontract(int id) { contract contract = db.contract.Find(id); if (contract == null) { return(NotFound()); } db.contract.Remove(contract); db.SaveChanges(); return(Ok(contract)); }
public void GetProjectRetainageDisplay() { // Arrange. var contract = new contract() { projectRetainage = 0.1 }; // Act. var result = contract.GetProjectRetainageDisplay(); // Assert. Assert.AreEqual(10, result); }
public Contractor Map(Guid syndicationItemId, contract contract) { if (contract.contractor == null) { throw new ArgumentNullException("Contractor Missing for Contract"); } var contractor = MapContractor(contract.contractor); contractor.SyndicationItemId = syndicationItemId; contractor.Contracts = FlattenContracts(contract).Where(c => c.hierarchyType == hierarchyType.CONTRACT).Select(MapContract).ToList(); return(contractor); }
private void bShowContract_Click(object sender, RoutedEventArgs e) { Int32 id = (dbGridContracts.SelectedItem as VIew_contractsExecution).Id; contract current = core.serviceCenterDB.contracts.Where(c => c.Id == id).First(); Windows.contractWindow w = new Windows.contractWindow(current); w.bOk.Visibility = Visibility.Collapsed; w.bCancel.Content = "Закрыть"; w.bAddService.IsEnabled = w.bAddDevice.IsEnabled = false; w.bEditDevice.IsEnabled = w.bEditService.IsEnabled = false; w.ReadOnly = true; w.Width += 500; w.Height += 200; w.ShowDialog(); }
private Guid AddContract() { contract v = new contract(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.DCID = AddDC(); v.Name = "lSHvv"; v.Prority = 2; v.Vendor = "yd81kz"; v.Remark = "FlIg"; v.ContractFileID = AddContractFile(); context.Set <contract>().Add(v); context.SaveChanges(); } return(v.ID); }
private void Fixupcontract(contract previousValue, bool skipKeys = false) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.customer_site.Contains(this)) { previousValue.customer_site.Remove(this); } if (contract != null) { if (!contract.customer_site.Contains(this)) { contract.customer_site.Add(this); } contractId = contract.contractId; } else if (!skipKeys) { contractId = null; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("contract") && (ChangeTracker.OriginalValues["contract"] == contract)) { ChangeTracker.OriginalValues.Remove("contract"); } else { ChangeTracker.RecordOriginalValue("contract", previousValue); } if (contract != null && !contract.ChangeTracker.ChangeTrackingEnabled) { contract.StartTracking(); } } }
// Bij het opslaan van een contract worden er nieuwe instanties van de relevante boten gemaakt. Dit zou ideaal // op een andere plek gebeuren private void c_SlaOpBtn_Click(object sender, EventArgs e) { if(c_BootTB1.Items != null) { c_boten.Add(c_BootTB1.Text); } if(c_BootTB2.Items != null) { c_boten.Add(c_BootTB2.Text); } if(c_BootTB3.Items != null) { c_boten.Add(c_BootTB3.Text); } foreach(string boot in c_boten) { if(boot == "Kano") { kano kano = new kano(); c_BootObjecten.Add(kano); } if(boot == "Zeilboot") { zeilboot zeilboot = new zeilboot(c_zeilBootTypeCB.Text); c_BootObjecten.Add(zeilboot); } if(boot == "Motorboot") { motorboot motorboot = new motorboot(20, "MotorBoot"); c_BootObjecten.Add(motorboot); LPAproject.motorboot.alleMotorBoten.Add(motorboot); } } // Het maken van de bijbehorende objecten om mee te geven aan het contract foreach(string bijbehorendObject in c_BijbehorendeObjecten) { bijkomendArtikel extraArtikel = new bijkomendArtikel(bijbehorendObject, 1.25); c_bijbehorendeArtikelen.Add(extraArtikel); } // Het aanmaken van een huurder voor in het contract - verschillende dingen geprobeerd, echter niet gelukt op moment van schrijven. //string startDatum = c_DTPickerVan.Value.ToString("yyyy-MM-dd"); //string eindDatum = c_DTPickerTot.Value.ToString("yyyy-MM-dd"); huurderNaam = c_VerhuurderNaam.Text; huurderEmail = c_VerhuurderEmail.Text; huurder huurder = new huurder(huurderNaam, huurderEmail); database.insertHuurder(huurderNaam, huurderEmail); contract contract = new contract(huurder, c_BootObjecten, c_bijbehorendeArtikelen, c_DTPickerVan.Value, c_DTPickerTot.Value); database.insertContract(huurder.naam.ToString(), "DummyTekst", 1, c_DTPickerVan.Value, c_DTPickerTot.Value); alleContracten.Add(contract); this.Close(); }