protected void Page_Load(object sender, EventArgs e) { if (!ExtNet.IsAjaxRequest) { hdfStatus.Text = ((int)KpiStatus.Active).ToString(); hdfGroup.Text = Request.QueryString["Id"]; if (!string.IsNullOrEmpty(hdfGroup.Text)) { var group = GroupKpiController.GetById(Convert.ToInt32(hdfGroup.Text)); if (group != null) { gpGroupKpi.Title = @"Thông tin chi tiết: " + group.Name; } } } }
/// <summary> /// init setting window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void InitWindow(object sender, DirectEventArgs e) { try { //reset form ResetForm(); // init window props if (e.ExtraParams["Command"] == "Update") { // edit wdSetting.Title = @"Cập nhật loại KPI"; wdSetting.Icon = Icon.Pencil; var model = GroupKpiController.GetById(Convert.ToInt32(hdfId.Text)); if (model != null) { // set props txtName.Text = model.Name; txtDescription.Text = model.Description; if (model.Status == KpiStatus.Active) { chkIsActive.Checked = true; } } gpCriterion.Disabled = true; } else { // insert wdSetting.Title = @"Thêm mới loại KPI"; wdSetting.Icon = Icon.Add; gpCriterion.Disabled = false; } // show window wdSetting.Show(); } catch (Exception exception) { Dialog.ShowError(exception); } }
/// <summary> /// Delete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Delete(object sender, DirectEventArgs e) { try { if (!string.IsNullOrEmpty(hdfId.Text)) { //delete criterionGroup CriterionGroupController.DeleteByCondition(Convert.ToInt32(hdfId.Text), null); //delete group GroupKpiController.Delete(Convert.ToInt32(hdfId.Text)); } // reload data gpGroupKpi.Reload(); } catch (Exception exception) { Dialog.ShowError(exception); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void InitWindowEvaluation(object sender, DirectEventArgs e) { if (string.IsNullOrEmpty(hdfGroupFilter.Text)) { return; } var groupKpi = GroupKpiController.GetById(int.Parse(hdfGroupFilter.Text)); if (groupKpi == null) { return; } // set window name wdEvaluation.Title += " " + groupKpi.Name; // reload grid gpCriterionEvaluation.Reload(); // show window wdEvaluation.Show(); }
/// <summary> /// insert or update /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void InsertOrUpdate(object sender, DirectEventArgs e) { try { // init entity var model = new GroupKpiModel(); // check id if (!string.IsNullOrEmpty(hdfId.Text) && Convert.ToInt32(hdfId.Text) > 0) { var result = GroupKpiController.GetById(Convert.ToInt32(hdfId.Text));; if (result != null) { model = result; } } // set new props for entity model.Name = txtName.Text; model.Description = txtDescription.Text; if (chkIsActive.Checked) { model.Status = KpiStatus.Active; } else { model.Status = KpiStatus.Locked; } // check entity id if (model.Id > 0) { model.EditedDate = DateTime.Now; model.EditedBy = CurrentUser.User.UserName; // update GroupKpiController.Update(model); } else { model.CreatedBy = CurrentUser.User.UserName; model.CreatedDate = DateTime.Now; model.EditedDate = DateTime.Now; model.EditedBy = ""; // insert var resultModel = GroupKpiController.Create(model); if (resultModel != null) { //create criterionGroup foreach (var itemRow in chkCriterionRowSelection.SelectedRows) { // init entity var criterionGroupModel = new CriterionGroupModel() { CriterionId = Convert.ToInt32(itemRow.RecordID), GroupId = resultModel.Id }; // insert CriterionGroupController.Create(criterionGroupModel); } } } // hide window wdSetting.Hide(); //reset form ResetForm(); // reload data gpGroupKpi.Reload(); } catch (Exception exception) { Dialog.ShowError(exception); } }
protected void Page_Load(object sender, EventArgs e) { if (!ExtNet.IsAjaxRequest) { // get month if (!string.IsNullOrEmpty(Request.QueryString["month"])) { hdfMonthFilter.Text = Request.QueryString["month"]; cboMonthFilter.Text = @"Tháng " + Request.QueryString["month"]; } else { hdfMonthFilter.Text = DateTime.Now.Month.ToString(); cboMonthFilter.Text = @"Tháng " + DateTime.Now.Month; } // get year if (!string.IsNullOrEmpty(Request.QueryString["year"])) { hdfYearFilter.Text = Request.QueryString["year"]; spnYearFilter.SetValue(Request.QueryString["year"]); } else { hdfYearFilter.Text = DateTime.Now.Year.ToString(); spnYearFilter.SetValue(DateTime.Now.Year); } // get status hdfStatus.Text = ((int)KpiStatus.Active).ToString(); // get group var groupId = Request.QueryString["groupId"]; if (!string.IsNullOrEmpty(groupId)) { var group = GroupKpiController.GetById(int.Parse(groupId)); if (group != null) { cboGroupFilter.Text = group.Name; hdfGroupFilter.Text = group.Id.ToString(); } } else { var groups = GroupKpiController.GetAll(null, false, KpiStatus.Active, null, null); if (groups.Count > 0) { cboGroupFilter.Text = groups.First().Name; hdfGroupFilter.Text = groups.First().Id.ToString(); } } hdfDepartment.Text = DepartmentIds; new Core.Framework.Common.BorderLayout() { menuID = MenuId, script = "#{hdfDepartmentSelectedId}.setValue('" + Core.Framework.Common.BorderLayout.nodeID + "');#{txtKeyword}.reset();#{pagingToolbar}.pageIndex = 0; #{pagingToolbar}.doLoad();" }.AddDepartmentList(brlayout, CurrentUser, false); // load grid LoadGridPanel(); } }