public bool AddBranch(Branch obj) { try { //StreamWriter writer = new StreamWriter("Files/branches.txt", true); //writer.WriteLine(obj.Name + ","); ////+"," + obj.DateOfBirth //writer.Flush(); //writer.Close(); AccountsDbEntities1 db = new AccountsDbEntities1(); BranchTable bt = new BranchTable(); bt.Name = obj.Name; db.BranchTables.Add(bt); db.SaveChanges(); return(true); } catch (Exception ex) { Console.WriteLine("Error Exception"); return(false); } }
public ActionResult DeleteConfirmed(int id) { BranchTable branchTable = db.BranchTables.Find(id); db.BranchTables.Remove(branchTable); db.SaveChanges(); return(RedirectToAction("Index")); }
public frmWellcome() { InitializeComponent(); BranchTable br = new BranchTable(); Suport.FillCombox(cmbBranches, br.GetTable(), "branchName", "branchCoude"); // menuStrip1.Enabled = false; }
private void LoadBranchData() { string filePath = Path.Combine(Application.streamingAssetsPath, source); table = JsonUtility.FromJson <BranchTable>(File.ReadAllText(filePath)); foreach (BranchData data in table.branches) { data.results.OverrideResults(); data.results.SetInputs(table.branches); } }
public ActionResult Edit(int Id, string TableNo, int Capacity) { BranchTable branchTable = db.BranchTables.Find(Id); if (ModelState.IsValid) { branchTable.TableNo = TableNo; branchTable.Capacity = Capacity; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(branchTable)); }
// GET: BranchTables/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BranchTable branchTable = db.BranchTables.Find(id); if (branchTable == null) { return(HttpNotFound()); } return(View(branchTable)); }
// GET: BranchTables/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BranchTable branchTable = db.BranchTables.Find(id); if (branchTable == null) { return(HttpNotFound()); } ViewBag.BranchId = new SelectList(db.Branches, "Id", "Name", branchTable.BranchId); return(View(branchTable)); }
public frmShowCars(string st) { str = st; InitializeComponent(); ColorsTable curentColor = new ColorsTable(); Suport.FillCombox(cmbColor, curentColor.GetTable(), "nameColor", "coudeColor"); //Suport.FillCombox(cmbPlace , curentp .FillConbo(), "numParking", "coudParking"); DesignTable curentd = new DesignTable(); Suport.FillCombox(cmbDesign, curentd.GetTable(), "nameDesign", "coudDesign"); BranchTable curentb = new BranchTable(); Suport.FillCombox(cmbBranch, curentb.GetTable(), "branchName", "branchCoude"); if (st == "add") { lblAddCar.Visible = true; lblMessage.Visible = false; btnAdd.Visible = true; label9.Visible = false; txtNumForSerch.Visible = false; btnSearch.Visible = false; } if (st == "update") { lblAddCar.Visible = false; lblMessage.Visible = true; btnUpdate.Visible = true; pcbPicture.Visible = true; pcbPicture.Visible = true; } if (st == "del") { lblAddCar.Visible = false; lblMessage.Visible = true; btnDel.Visible = true; pcbPicture.Visible = true; } }
public UnitOfWork() { _database = new Entities(); User = new UserTables(_database.Users); SecurityQuestion = new SecurityQuestionTables(_database.SecurityQuestions); Role = new RoleTable(_database.Roles); OrganisationTable = new OrganisationTable(_database.OrganisationDetails); BranchTable = new BranchTable(_database.BrancheDetails); BankTable = new BankTable(_database.BankDetails); EmployeeTable = new EmployeeTable(_database.Employees); EmployeeLocationTable = new EmployeeLocationTable(_database.EmployeeLocations); CustomerTable = new CustomerTable(_database.Customers); AccountTable = new AccountTable(_database.Accounts); AccountTypeTable = new AccountTypeTable(_database.AccountTypes); AccessLevelTable = new AccountAccessLevelTable(_database.AccessLevels); UserAccountAccessTable = new UserAccountAccessTable(_database.UserAccountAccesses); AccoutTransactionTable = new AccoutTransactionTable(_database.Transactions); }
public frmAddWorker(String st) { tsr = st; InitializeComponent(); JobTable jt = new JobTable(); CityTable ct = new CityTable(); Suport.FillCombox(cmbCity, ct.GetTable(), "nameCity", "coudeCity"); WorkerTable wo = new WorkerTable(); Suport.FillCombox(cmbBranch, wo.GetTable(), "branchName", "branchCoude"); Suport.FillCombox(cmbJob, jt.GetTable(), "nameJob", "doudeJob"); BranchTable curentb = new BranchTable(); Suport.FillCombox(cmbBranch, curentb.GetTable(), "branchName", "branchCoude"); if (st == "Add") { curentWorker = new Worker(); lblAdd.Visible = true; lblUpdate.Visible = false; lblSearch.Visible = false; txtSearch.Visible = false; btnSearch.Visible = false; lblDel.Visible = false; txtSearch.Visible = false; } if (st == "Update") { lblAdd.Visible = false; lblUpdate.Visible = true; lblDel.Visible = false; txtSearch.Visible = true; txtID.Enabled = false; } if (st == "Del") { lblAdd.Visible = false; lblUpdate.Visible = false; lblDel.Visible = true; txtSearch.Visible = true; } }
public ActionResult Create([Bind(Include = "Id,TableNo,Capacity")] BranchTable branchTable) { string userId = User.Identity.GetUserId(); int branchId = db.Employees.Where(e => e.LoginId == userId).Select(e => e.BranchId).SingleOrDefault(); branchTable.BranchId = branchId; ModelState.Clear(); TryValidateModel(branchTable); if (ModelState.IsValid) { db.BranchTables.Add(branchTable); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BranchId = new SelectList(db.Branches, "Id", "Name", branchTable.BranchId); return(View(branchTable)); }