protected void btnOK_Click(object sender, EventArgs e) { if (!Valid()) { mpeInfo.Show(); return; } try { ProjectInfoEntity entity = new ProjectInfoEntity { ProjectName = txtDialogProjectName.Text.Trim(), PKID = hfPKID.Value.SafeToInt() }; if (entity.PKID > 0) { ProjectInfoLogic.UpdateProjectInfo(entity); } else { ProjectInfoLogic.InsertProjectInfo(entity); } mpeInfo.Hide(); BindDataSource(); } catch (Exception ex) { DialogMessage = "<span class='fontred'>" + ex.Message + "</span>"; mpeInfo.Show(); } }
private void BindDataSource() { var source = ProjectInfoLogic.GetProjectInfoByCondition(txtProjectName.Text.Trim()); gvProjectInfo.DataSource = source; gvProjectInfo.DataBind(); lblMessage.Text = " <span class='font14b'>共查到 </span><span class='fontred'>" + source.Count + "</span><span class='font14b'> 条记录</span>"; }
protected void btnDelete_Click(object sender, CommandEventArgs e) { try { ProjectInfoLogic.DeleteProjectInfo(Convert.ToInt32(e.CommandArgument)); BindDataSource(); } catch (ApplicationException ex) { lblMessage.Text = "<span class='fontred'>" + ex.Message + "</span>"; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; _Context = context; _Result = string.Empty; _Key = _Context.Request.QueryString["q"] ?? ""; if (context.Request.Params["type"] != null) { switch (context.Request.Params["type"]) { //职位名称 case "Position": InitResult(BllInstance.PositionBllInstance.GetAllPosition(), "Name"); break; //所有有效帐号的姓名 case "Account": InitResult(BllInstance.AccountBllInstance.GetAccountByCondition("", null, null, true), "Name"); break; case "AllAccount": InitResult(BllInstance.AccountBllInstance.GetAccountByCondition("", null, null, null), "Name"); break; //得到下属 case "Subordinates": InitResult( BllInstance.AccountBllInstance.GetSubordinates( (HttpContext.Current.Session[SessionKeys.LOGININFO] as Account).Id), "Name"); break; //所有Hrmis的有效帐号的姓名 case "HrmisAccount": InitResult(BllInstance.AccountBllInstance.GetAllHRMisAccount(), "Name"); break; //hrmis帐套项参数名称 case "AccountSetPara": AccountSetPara(); break; case "ProjectInfo": InitResult(ProjectInfoLogic.GetProjectInfoByCondition(""), "ProjectName"); break; default: break; } } context.Response.Write(_Result); context.Response.End(); }
protected void btnModify_Click(object sender, CommandEventArgs e) { DialogMessage = string.Empty; txtDialogProjectName.Text = string.Empty; hfPKID.Value = e.CommandArgument.ToString(); lblNameMessage.Text = string.Empty; lblOperation.Text = "更新项目信息"; try { var project = ProjectInfoLogic.GetProjectInfoByPKID(Convert.ToInt32(e.CommandArgument)); txtDialogProjectName.Text = project.ProjectName; mpeInfo.Show(); } catch (ApplicationException ex) { lblMessage.Text = "<span class='fontred'>" + ex.Message + "</span>"; } }
protected void txtProjectCode_TextChanged(object sender, EventArgs e) { var code = txtProjectCode.Text.Trim(); lblProject.Text = ""; lblProjectName.Text = ""; txtProjectID.Value = ""; if (!string.IsNullOrEmpty(code)) { var project = ProjectInfoLogic.GetProjectInfoByCode(code); if (project != null) { lblProjectName.Text = project.ProjectName; } else { lblProject.Text = "不存在该编号"; lblProjectName.Text = ""; } } }
public bool Validate(bool isAuditing = false) { bool b_ret = true; _IReimburseView.Message = string.Empty; _IReimburseView.PaperCountMsg = string.Empty; _IReimburseView.DestinationsMsg = string.Empty; _IReimburseView.ProjectNameMsg = string.Empty; _IReimburseView.ConsumeDateMsg = string.Empty; _IReimburseView.OutCityDaysMsg = string.Empty; _IReimburseView.OutCityAllowanceMsg = string.Empty; _IReimburseView.lblApplyDateMsg = string.Empty; if (!string.IsNullOrEmpty(_IReimburseView.OutCityDays)) { decimal temp; if (!decimal.TryParse(_IReimburseView.OutCityDays, out temp)) { _IReimburseView.OutCityDaysMsg = ReimburseUtility._DateError; b_ret = false; } } if (!string.IsNullOrEmpty(_IReimburseView.OutCityAllowance)) { decimal temp; if (!decimal.TryParse(_IReimburseView.OutCityAllowance, out temp)) { _IReimburseView.OutCityAllowanceMsg = ReimburseUtility._DateError; b_ret = false; } } if (_IReimburseView.ReimburseItemSource == null || _IReimburseView.ReimburseItemSource.Count == 0) { _IReimburseView.Message = ReimburseUtility._NoReimburseItem; b_ret = false; } // 单据张数不能为空 if (string.IsNullOrEmpty(_IReimburseView.PaperCount.Trim())) { _IReimburseView.PaperCountMsg = ReimburseUtility._IsEmpty; b_ret = false; } else { int inttemp; if (!Int32.TryParse(_IReimburseView.PaperCount.Trim(), out inttemp)) { _IReimburseView.PaperCountMsg = ReimburseUtility._PaperCountError; b_ret = false; } else if (inttemp <= 0) { _IReimburseView.PaperCountMsg = ReimburseUtility._PaperCountThanZero; b_ret = false; } } if (_IReimburseView.IsTravelReimburse) { // 目的地不能为空 if (string.IsNullOrEmpty(_IReimburseView.Destinations.Trim())) { _IReimburseView.DestinationsMsg = ReimburseUtility._IsEmpty; b_ret = false; } if (string.IsNullOrEmpty(_IReimburseView.ProjectName.Trim())) { _IReimburseView.ProjectNameMsg = "不可为空"; b_ret = false; } else if (!isAuditing) { var projectInfo = ProjectInfoLogic.GetProjectInfoByName(_IReimburseView.ProjectName); if (projectInfo == null) { _IReimburseView.ProjectNameMsg = "不存在该项目"; b_ret = false; } } } if (string.IsNullOrEmpty(_IReimburseView.ApplyDate)) { _IReimburseView.lblApplyDateMsg = ReimburseUtility._IsEmpty; b_ret = false; } else { DateTime dt; if (!DateTime.TryParse(_IReimburseView.ApplyDate, out dt)) { _IReimburseView.lblApplyDateMsg = ReimburseUtility._TimeIsError; b_ret = false; } } if (string.IsNullOrEmpty(_IReimburseView.ConsumeDateFrom) || string.IsNullOrEmpty(_IReimburseView.ConsumeDateTo)) { _IReimburseView.ConsumeDateMsg = "消费时间不可为空。"; b_ret = false; } else { DateTime dtConsumeDateFrom; DateTime dtConsumeDateTo; if ( !(DateTime.TryParse(_IReimburseView.ConsumeDateFrom, out dtConsumeDateFrom) && DateTime.TryParse(_IReimburseView.ConsumeDateTo, out dtConsumeDateTo))) { _IReimburseView.ConsumeDateMsg = "消费时间格式不正确。"; b_ret = false; } else { dtConsumeDateFrom = new DateTime(dtConsumeDateFrom.Year, dtConsumeDateFrom.Month, dtConsumeDateFrom.Day, Convert.ToInt32(_IReimburseView.ConsumeDateFromHour), Convert.ToInt32(_IReimburseView.ConsumeDateFromMinute), 0); dtConsumeDateTo = new DateTime(dtConsumeDateTo.Year, dtConsumeDateTo.Month, dtConsumeDateTo.Day, Convert.ToInt32(_IReimburseView.ConsumeDateToHour), Convert.ToInt32(_IReimburseView.ConsumeDateToMinute), 0); if (DateTime.Compare(dtConsumeDateFrom, dtConsumeDateTo) > 0) { _IReimburseView.ConsumeDateMsg = "开始时间不可晚于结束时间。"; b_ret = false; } } } return(b_ret); }