public string GetRegions_LTO(string Location) { string Region = ""; SqlDataReader reader; try { int i = 0; if (TaxOffice.GetAllRTO(out reader)) { while (reader.Read()) { if (i == 0) { Region += reader.GetString(1).ToString() + "," + reader.GetString(0); } else { Region += "#;#" + reader.GetString(1).ToString() + "," + reader.GetString(0); } ++i; } reader.Close(); } } catch (Exception ex) { return("error " + ex); } return(Region); }
//Update Operations public void UpdateTaxOffice(TaxOffice taxOffice) { var entry = db.Entry(taxOffice); entry.State = EntityState.Modified; db.SaveChanges(); }
public ActionResult Edit(TaxOffice taxOffice) { if (ModelState.IsValid) { db.UpdateTaxOffice(taxOffice); TempData["Message"] = "Tax Office Info updated successfully"; return(RedirectToAction("Details", new { id = taxOffice.Id })); } return(View("CreateAndEdit", taxOffice)); }
static void Main(string[] args) { var taxOffice = new TaxOffice(); taxOffice.GetAllTaxPayers(); taxOffice.CollectTaxes(); InfoDomainApp(); Console.ReadLine(); }
static void Main(string[] args) { Start(); var alice = new Employee() { Name = "Alice", Title = "Test Engineer" }; var bruce = new Employee() { Name = "Bruce", Title = "Developer" }; var chloe = new Manager() { Name = "Chloe", Title = "Program Manager" }; var doris = new Employee() { Name = "Doris", Title = "Build Engineer" }; var ethan = new Manager() { Name = "Ethan", Title = "Release Manager" }; var frank = new Manager() { Name = "Frank", Title = "Director" }; var organization = new Organization("DoodleSoft"); var taxOffice = new TaxOffice(); var insuranceOffice = new InsuranceOffice(); var pensionFundOffice = new PensionFundOffice(); insuranceOffice.Subscribe(organization); organization.EmployeeAdded += taxOffice.RegisterEmployee; organization.EmployeeAdded += pensionFundOffice.AddToPensionProgram; organization.AddEmployee(alice, chloe); organization.AddEmployee(bruce, chloe); organization.AddEmployee(chloe, frank); organization.AddEmployee(doris, ethan); organization.AddEmployee(ethan, frank); organization.AddEmployee(frank, null); organization.Director = frank; insuranceOffice.Unsubscribe(organization); organization.EmployeeAdded -= taxOffice.RegisterEmployee; organization.EmployeeAdded -= pensionFundOffice.AddToPensionProgram; End(); }
public async Task <ActionResult> Create([Bind(Include = "TaxOfficeId,Name,Street,HomeNumber,ZipCode,City")] TaxOffice taxOffice) { if (ModelState.IsValid) { db.TaxOffices.Add(taxOffice); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(taxOffice)); }
public async Task <ActionResult> Edit([Bind(Include = "TaxOfficeId,Name,Street,HomeNumber,ZipCode,City")] TaxOffice taxOffice) { if (ModelState.IsValid) { db.Entry(taxOffice).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(taxOffice)); }
public static MsCrmResultObject GetTaxOffices(SqlDataAccess sda) { MsCrmResultObject returnValue = new MsCrmResultObject(); try { #region | SQL QUERY | string sqlQuery = @"SELECT T.new_taxofficeId Id ,T.new_name Name FROM new_taxoffice T WHERE T.StateCode = 0 ORDER BY T.new_name ASC" ; #endregion DataTable dt = sda.getDataTable(sqlQuery); if (dt.Rows.Count > 0) { List <TaxOffice> returnList = new List <TaxOffice>(); for (int i = 0; i < dt.Rows.Count; i++) { TaxOffice office = new TaxOffice(); office.TaxOfficeId = (Guid)dt.Rows[i]["Id"]; office.Name = dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : string.Empty; returnList.Add(office); } returnValue.Success = true; returnValue.ReturnObject = returnList; } else { returnValue.Success = false; returnValue.Result = "Sistemde etkin vergi dairesi bulunmamaktadır!"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }
// GET: /TaxOffices/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TaxOffice taxOffice = await db.TaxOffices.FindAsync(id); if (taxOffice == null) { return(HttpNotFound()); } return(View(taxOffice)); }
public ActionResult Create(TaxOffice taxOffice) { ViewBag.Title = CreateTitle; ViewBag.SubmitText = CreateButton; //if (string.IsNullOrEmpty(user.Name)) //{ // ModelState.AddModelError(nameof(user.Name), "The name is required"); // html hoppers handle the error display that we feed here //} if (ModelState.IsValid) { db.AddTaxOffice(taxOffice); TempData["Message"] = "Tax Office was added successfully"; return(RedirectToAction("Index" /*, new { id = taxOffice.Id }*/)); } return(View("CreateAndEdit")); }
public async Task <ActionResult> DeleteConfirmed(int id) { TaxOffice taxOffice = await db.TaxOffices.FindAsync(id); db.TaxOffices.Remove(taxOffice); try { await db.SaveChangesAsync(); } catch (DbUpdateException /*ex*/) { ModelState.AddModelError(String.Empty, "Nie można usunąć rekordu, ponieważ jest powiązany z innymi rekordami w bazie danych"); return(PartialView(taxOffice)); } return(Json(new { url = Url.Action("Index", "TaxOffices"), success = true })); }
static void DynamicData() { dynamic taxOffice = "taxOffice"; Console.WriteLine(taxOffice); taxOffice = new TaxOffice(); taxOffice.GetAllTaxPayers(); dynamic taxPayer = new System.Dynamic.ExpandoObject(); taxPayer.Id = Guid.NewGuid(); taxPayer.Name = "Tax Payer 1"; taxPayer.Address = "Address 1"; taxPayer.Age = 20; taxPayer.IncrementAge = (Action <int>)(x => taxPayer.Age += x); taxPayer.IncrementAge(6); Console.WriteLine($"{taxPayer.Name} - {taxPayer.Age} - {taxPayer.Address}"); Console.ReadLine(); }
public string GetITO(string rtoID) { string ITO = ""; SqlDataReader reader; try { //this.ddITO.Items.Clear(); //this.ddITO.Items.Add(new ListItem("ALL ITOs/LTOs", "0")); int i = 0; if (TaxOffice.GetITOByRTO(out reader, rtoID)) { while (reader.Read()) { if (i == 0) { ITO += reader.GetString(1).ToString() + "," + reader.GetString(0); } else { ITO += "#;#" + reader.GetString(1).ToString() + "," + reader.GetString(0); } ++i; } reader.Close(); } } catch (Exception ex) { return("error " + ex); //FIRSConfigSettings.logErrorMessage(p.Identity.Name,ex.Message,this.lblModule.Text); //this.DisplayFailureMessage("Sorry, an Error occurred, please contact the System Administrator."); } return(ITO); }
public IActionResult Post([FromBody] TaxOffice body) { var entity = _manager.Add(body); return(ResponseJson(entity)); }
public IActionResult Put([FromBody] TaxOffice body) { var entity = _manager.Update(body); return(ResponseJson(_manager.Update(entity))); }
public void AddTaxOffice(TaxOffice taxOffice) { db.TaxOffices.Add(taxOffice); db.SaveChanges(); //such wow again }
public void Process() { try { Debug.WriteLine("ClientObject Process"); Console.WriteLine("ClientObject Process"); Stream = client.GetStream(); // получаем имя пользователя string message = String.Empty; // в бесконечном цикле получаем сообщения от клиента while (true) { try { Debug.WriteLine("ClientObject Process чтение сообщения"); Console.WriteLine("ClientObject Process чтение сообщения"); message = GetMessage(); Debug.WriteLine(message); Console.WriteLine(message); var model = JsonConvert.DeserializeObject <ClientObjectResolveMethodToRunMessageModel>(message); List <object> resultModel = new List <object>(); Logger.Info("Start to handle Methods"); foreach (var method in model.Methods) { switch (method.Key) { case "GetRevenues": Logger.Info("Handle GetRevenues"); var taxOffice = new TaxOffice(); var result = taxOffice.GetAllRevenues(); Logger.Info($"result {result.Count}"); foreach (var item in result) { resultModel.Add(item); } Logger.Info($"Handled GetRevenues"); break; case "CollectTaxes": Logger.Info("Handle CollectTaxes"); taxOffice = new TaxOffice(); var collectTaxesResult = taxOffice.CollectTaxes(); Logger.Info($"collectTaxesResult {collectTaxesResult.Count}"); foreach (var item in collectTaxesResult) { resultModel.Add(item); } Logger.Info($"Handled CollectTaxes"); break; default: break; } } Logger.Info($"Ended handle Methods"); var resultModelString = JsonConvert.SerializeObject(resultModel); Debug.WriteLine("Подготовка к отправке ответа"); Console.WriteLine("Подготовка к отправке ответа"); Debug.WriteLine("Отправка ответа"); Console.WriteLine("Отправка ответа"); server.BroadcastMessage(resultModelString, this.Id); Debug.WriteLine("Завершение отправки"); Console.WriteLine("Завершение отправки"); } catch (Exception ex) { Debug.WriteLine(ex.Message); Console.WriteLine(ex.Message); Logger.Info(ex.Message); break; } } } catch (Exception e) { Console.WriteLine(e.Message); } finally { // в случае выхода из цикла закрываем ресурсы server.RemoveConnection(this.Id); Close(); } }