using BLL; using System; using System.Linq; namespace FineUIPro.Web.ManHours { public partial class AccountDisabled : PageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.DisciplinesWBSService.InitDisciplinesDropDownList(drpDiscipline, true); GetButtonPower(); btnClose.OnClientClick = ActiveWindow.GetHideReference(); string eProjectId = Request.Params["ManHoursPlanId"]; if (!string.IsNullOrEmpty(eProjectId)) { var p = BLL.PlanService.GetPlanById(eProjectId); if (p != null) { string disc = string.Empty; txtJobNo.Text = p.ProjectControl_JobNo; //if (p.Roles == "M00") //{ // disc = "M00_Project Management"; //} //else if (p.Roles.Contains("_")) //{ // string[] r = p.Roles.Split('_'); // disc = r[0] + "_" + p.Discipline + "_" + r[1]; //} //else //{ // disc = p.Roles + "_" + p.Discipline; //} //txtDiscipline.Text = disc; if (p.DisciplineId != null) { string r = string.Empty; if (!string.IsNullOrEmpty(p.Roles)) { string[] roles = p.Roles.Split('_'); if (roles.Count() > 2) { r = "_" + roles[2]; } else { r = "_" + roles[0]; } } drpDiscipline.SelectedValue = p.DisciplineId + r; } txtAccount.Text = p.Account; txtEngineerName.Text = p.EngineerName; txtManHours.Text = p.ManHours.ToString(); if (p.AccountDisabled == 1) { cbNotApplicable1.Checked = true; } } } } } /// /// 提交按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { try { string eProjectId = Request.Params["ManHoursPlanId"]; Model.ManHours_Plan pm = BLL.PlanService.GetPlanByIds(eProjectId); if (pm != null) { string discId = drpDiscipline.SelectedValue; pm.DisciplineId = discId.Split('_')[0]; string disc = drpDiscipline.SelectedText; string[] d = disc.Split('_'); pm.Discipline = d[1]; if (d.Count() == 2) { pm.Roles = d[0]; } if (d.Count() == 3) { pm.Roles = d[0] + "_" + d[2]; } if (cbNotApplicable1.Checked) { pm.AccountDisabled = 1; } else { pm.AccountDisabled = 0; } pm.ManHours = Funs.GetNewDouble(txtManHours.Text.Trim()); pm.Account = txtAccount.Text.Trim(); Funs.DB.SubmitChanges(); } ShowNotify("Save Successfully!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } catch (Exception ex) { Alert.ShowInParent(ex.ToString()); return; } } #region 权限设置 /// /// 菜单按钮权限 /// private void GetButtonPower() { var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.ManHoursMenuId); if (buttonList.Count() > 0) { if (buttonList.Contains(BLL.Const.BtnAdd)) { this.btnSave.Hidden = false; } } } #endregion } }