private void FormDepartmentView_Load(object sender, EventArgs e) { if (dataSource == null) { DateTime dt = DateTime.Now; DataSource = DepartmentVwServices.List(new Db(DbServices.ConnectionString)); slblEllapsedTimeValue.Text = (DateTime.Now.Subtract(dt).TotalMilliseconds / 1000).ToString(); } }
/// <summary> /// Returns a list of DepartmentVw objects /// </summary> /// <returns></returns> public ActionResult Index(DepartmentVwViewModel Model) { Db db = new Db(DbServices.ConnectionString); ViewBag.SalaryWorkPlaceList = new SelectList(SalaryWorkPlaceServices.List(db), "Id", "Name"); ViewBag.MainWorkPlace = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name"); if (Model.Filter.HasCriteria) { Model.List = DepartmentVwServices.Get(Model.Filter, db); } else { Model.List = new List <DepartmentVw>(); } return(View(Model)); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Details(Nullable <int> id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DepartmentVwViewModel departmentVwViewModel = new DepartmentVwViewModel(); Db db = new Db(DbServices.ConnectionString); // departmentVwViewModel.Instance = DepartmentVwServices.Get(id.Value, db); departmentVwViewModel.Instance = DepartmentVwServices.GetChildren(id.Value, db); if (departmentVwViewModel.Instance == null) { return(HttpNotFound()); } return(View(departmentVwViewModel)); }