//上传文件并返回路径 protected void fileUpload(out string newFilePath) { newFilePath = String.Empty; //文件上传后的路径, 如:"/UploadFilesx/201010/guid.doc" string newFileName = String.Empty; //文件上传后的文件名, 如:"guid.doc" string oldFileName = string.Empty; //上传前的文件名,如:"我的文档.doc" int fileSize = 0; //文件大小(kb) if (this.fu_fileLoad.HasFile) { UploadFile up = new UploadFile(); string[] str = { ".jpg", ".bmp", ".gif", ".jpeg" }; string msg; if (UploadFile.CheckFileType(Request.Files, this.fu_fileLoad.UniqueID, str, 4, out msg)) { bool flag = UploadFile.FileUpLoad(this.fu_fileLoad.PostedFile, "UploadFiles", out newFilePath, out newFileName); if (flag) { oldFileName = this.fu_fileLoad.FileName; fileSize = this.fu_fileLoad.PostedFile.ContentLength / 1024; } else { //文件上传失败 MessageBox.ResponseScript(this, "alert('文件上传失败!');"); return; } } else { //文件上传失败 MessageBox.ResponseScript(this, string.Format("alert('{0}');", msg)); return; } } }
protected string companyLog = string.Empty; //公司log protected void Page_Load(object sender, EventArgs e) { //判断权限 if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_系统配置_系统设置栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_系统配置_系统设置栏目, true); return; } string method = Utils.GetFormValue("hidMethod"); EyouSoft.BLL.CompanyStructure.CompanySetting setBll = new EyouSoft.BLL.CompanyStructure.CompanySetting(); //初始化bll EyouSoft.Model.CompanyStructure.CompanyFieldSetting set = null; //配置实体 if (method == "save") { //保存 set = new EyouSoft.Model.CompanyStructure.CompanyFieldSetting(); string fileName1 = string.Empty; string oldName = string.Empty; bool result = true; HttpPostedFile fLog = Request.Files["fileLog"]; HttpPostedFile fHeader = Request.Files["fileHeader"]; HttpPostedFile fFooter = Request.Files["fileFooter"]; HttpPostedFile fSeal = Request.Files["fileSeal"]; HttpPostedFile fModel = Request.Files["fileModel"]; if (fLog != null && !string.IsNullOrEmpty(fLog.FileName)) { result = UploadFile.FileUpLoad(fLog, "systemset", out fileName1, out oldName);//上传logo set.CompanyLogo = fileName1; } else { set.CompanyLogo = hidLog.Value; } set.CompanyPrintFile = new EyouSoft.Model.CompanyStructure.CompanyPrintTemplate(); if (fHeader != null && !string.IsNullOrEmpty(fHeader.FileName)) { result = UploadFile.FileUpLoad(fHeader, "systemset", out fileName1, out oldName);//上传页眉 set.CompanyPrintFile.PageHeadFile = fileName1; } else { set.CompanyPrintFile.PageHeadFile = hidHeader.Value; } if (result && (fFooter != null && !string.IsNullOrEmpty(fFooter.FileName))) { result = UploadFile.FileUpLoad(fFooter, "systemset", out fileName1, out oldName);//上传页脚 set.CompanyPrintFile.PageFootFile = fileName1; } else { set.CompanyPrintFile.PageFootFile = hidFooter.Value; } if (result && (fModel != null && !string.IsNullOrEmpty(fModel.FileName))) { result = UploadFile.FileUpLoad(fModel, "systemset", out fileName1, out oldName);//上传模板 set.CompanyPrintFile.TemplateFile = fileName1; } else { set.CompanyPrintFile.TemplateFile = hidModel.Value; } if (result && (fSeal != null && !string.IsNullOrEmpty(fSeal.FileName))) { result = UploadFile.FileUpLoad(fSeal, "systemset", out fileName1, out oldName);//上传公章 set.CompanyPrintFile.DepartStamp = fileName1; } else { set.CompanyPrintFile.DepartStamp = hidSeat.Value; } if (result) { //留位时间 set.ReservationTime = Utils.GetInt(txtRetainHour.Value) * 60; //价格组成 set.PriceComponent = rdiPrice.SelectedValue == "1" ? EyouSoft.Model.EnumType.CompanyStructure.PriceComponent.分项报价 : EyouSoft.Model.EnumType.CompanyStructure.PriceComponent.统一报价; set.DisplayAfterMonth = Utils.GetInt(txtAfterMonth.Value); //列表显示控制后几月 set.DisplayBeforeMonth = Utils.GetInt(txtBeforeMonth.Value); //列表显示控制前几月 set.SongTuanRenId = GroupSender.OperId; //送团人编号 set.SongTuanRenName = GroupSender.OperName; //送团人姓名 set.JiHeDiDian = GroupSet.Value; //集合地点 set.JiHeBiaoZhi = SetMark.Value; //集合标志 set.CompanyId = CurrentUserCompanyID; set.ReceiptRemindType = (EyouSoft.Model.EnumType.CompanyStructure.ReceiptRemindType)(int.Parse(rbl_ReceiptRemind.SelectedValue)); //收款提醒 set.TanChuangTiXingInterval = Utils.GetInt(Utils.GetFormValue(txtTanChuangTiXingInterval.UniqueID), 1) * 60; result = setBll.SetCompanySetting(set); } if (set != null && set.CompanyPrintFile != null) { SetPrintPic(set);//更新模板显示 } MessageBox.ShowAndRedirect(this, result ? "设置成功!" : "设置失败!", "/systemset/ConfigSet.aspx"); return; } set = setBll.GetSetting(CurrentUserCompanyID);//获得配置信息 if (set != null) { //初始化配置信息 txtRetainHour.Value = (set.ReservationTime / 60.0).ToString("F1"); //最长留位小时 txtRetainMin.Value = set.ReservationTime.ToString(); //最长留位分钟 rdiPrice.SelectedValue = ((int)set.PriceComponent).ToString(); //价格组成 txtBeforeMonth.Value = set.DisplayBeforeMonth.ToString(); //列表显示控制前几月 txtAfterMonth.Value = set.DisplayAfterMonth.ToString(); //列表显示控制后几月 GroupSender.OperId = set.SongTuanRenId; GroupSender.OperName = set.SongTuanRenName; GroupSet.Value = set.JiHeDiDian; SetMark.Value = set.JiHeBiaoZhi; rbl_ReceiptRemind.SelectedValue = ((int)set.ReceiptRemindType).ToString();//收款提醒 txtTanChuangTiXingInterval.Value = (set.TanChuangTiXingInterval / 60).ToString(); } if (set != null && set.CompanyPrintFile != null) { SetPrintPic(set);//显示模板 } }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected void PageSave(string doType, string id) { //t为false为编辑,true时为新增 bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true; //数据验证开始 StringBuilder strMsg = new StringBuilder(); if (String.IsNullOrEmpty(this.txtTitle.Value.Trim())) { strMsg.Append("标题不能为空!\\n"); } if (String.IsNullOrEmpty(this.txtSubmitTime.Value)) { strMsg.Append("提交时间不能为空!\\n"); } if (strMsg.Length > 0) { MessageBox.ResponseScript(this, String.Format("alert('{0}');", strMsg)); return; } //数据验证结束 //附件 string newFilePath = String.Empty; //文件上传后的路径, 如:"/UploadFiles/xxx/201010/guid.doc" string newFileName = String.Empty; //文件上传后的文件名, 如:"guid.doc" string oldFileName = string.Empty; //上传前的文件名,如:"我的文档.doc" int fileSize = 0; //文件大小(kb) if (this.txtFile.HasFile) { string[] str = { ".txt", ".doc", ".docx", ".xls", ".xlsx", ".jpg", ".bmp", ".gif", ".jpeg", ".rar", ".zip" }; string msg; if (UploadFile.CheckFileType(Request.Files, "txtFile", str, 4, out msg)) { bool flag = UploadFile.FileUpLoad(this.txtFile.PostedFile, "ManageCenter/Advice", out newFilePath, out newFileName); if (flag) { oldFileName = this.txtFile.FileName; fileSize = this.txtFile.PostedFile.ContentLength / 1024; } else { //文件上传失败 MessageBox.ResponseScript(this, "alert('文件上传失败!');"); return; } } else { //文件上传失败 MessageBox.ResponseScript(this, string.Format("alert('{0}');", msg)); return; } } BOpinion BLL = new BOpinion(); MGovOpinion Model; bool result = false; if (t) {//-----新增----- Model = new MGovOpinion(); this.commonModel(Model, newFilePath, newFileName, oldFileName, fileSize); result = BLL.AddGovOpinion(Model); } else {//-----编辑----- Model = BLL.GetGovOpinionModel(id); this.commonModel(Model, newFilePath, newFileName, oldFileName, fileSize); result = BLL.UpdateGovOpinion(Model); } string m = t ? "新增" : "修改"; if (result) { Utils.ShowMsgAndCloseBoxy(m + "成功!", Utils.GetQueryStringValue("IframeId"), true); } else { MessageBox.ResponseScript(this, string.Format("alert('{0}失败!');", m)); } }
protected string PageLogo = string.Empty; //公司logo protected void Page_Load(object sender, EventArgs e) { string method = Utils.GetFormValue("hidMethod"); EyouSoft.BLL.CompanyStructure.Customer Customer = new EyouSoft.BLL.CompanyStructure.Customer(); EyouSoft.Model.CompanyStructure.CustomerConfig CustomerConfig = null; if (method == "save") { //保存 Customer = new EyouSoft.BLL.CompanyStructure.Customer(); CustomerConfig = new EyouSoft.Model.CompanyStructure.CustomerConfig(); string fileName = string.Empty; string oldName = string.Empty; bool result = true; string OldFilePath = ""; HttpPostedFile fHeader = Request.Files["fileHeader"]; HttpPostedFile fFooter = Request.Files["fileFooter"]; HttpPostedFile fSeal = Request.Files["fileSeal"]; HttpPostedFile fModel = Request.Files["fileModel"]; HttpPostedFile flogo = Request.Files["fileLogo"]; //公司logo if (flogo != null && !string.IsNullOrEmpty(flogo.FileName) && flogo.ContentLength > 0) { result = UploadFile.FileUpLoad(flogo, "systemset", out fileName, out oldName); CustomerConfig.FilePathLogo = fileName; } else { OldFilePath = Utils.GetFormValue(hidfileLogo.UniqueID); CustomerConfig.FilePathLogo = OldFilePath; } //上传页眉 if (fHeader != null && !string.IsNullOrEmpty(fHeader.FileName) && fHeader.ContentLength > 0) { result = UploadFile.FileUpLoad(fHeader, "systemset", out fileName, out oldName); CustomerConfig.PageHeadFile = fileName; } else { OldFilePath = Utils.GetFormValue(hidFileHeader.UniqueID); CustomerConfig.PageHeadFile = OldFilePath; } //上传页脚 if (result && (fFooter != null && !string.IsNullOrEmpty(fFooter.FileName)) && fFooter.ContentLength > 0) { result = UploadFile.FileUpLoad(fFooter, "systemset", out fileName, out oldName); CustomerConfig.PageFootFile = fileName; } else { OldFilePath = Utils.GetFormValue(hidFileFooter.UniqueID); CustomerConfig.PageFootFile = OldFilePath; } //上传模板 if (result && (fModel != null && !string.IsNullOrEmpty(fModel.FileName)) && fModel.ContentLength > 0) { result = UploadFile.FileUpLoad(fModel, "systemset", out fileName, out oldName); CustomerConfig.TemplateFile = fileName; } else { OldFilePath = Utils.GetFormValue(hidFileModel.UniqueID); CustomerConfig.TemplateFile = OldFilePath; } //上传公章 if (result && (fSeal != null && !string.IsNullOrEmpty(fSeal.FileName)) && fSeal.ContentLength > 0) { result = UploadFile.FileUpLoad(fSeal, "systemset", out fileName, out oldName); CustomerConfig.CustomerStamp = fileName; } else { OldFilePath = Utils.GetFormValue(hidfileSeal.UniqueID); CustomerConfig.CustomerStamp = OldFilePath; } //获得配置信息 if (result) { CustomerConfig.Id = SiteUserInfo.TourCompany.TourCompanyId; result = Customer.UpdateSampleCustomerConfig(CustomerConfig); } if (CustomerConfig != null) { SetPrintPic(CustomerConfig); } MessageBox.ShowAndRedirect(this, result ? "设置成功!" : "设置失败!", "/GroupEnd/SystemSetting/DeployManager.aspx"); return; } CustomerConfig = Customer.GetCustomerConfigModel(SiteUserInfo.TourCompany.TourCompanyId); if (CustomerConfig != null) { SetPrintPic(CustomerConfig); } }
protected string logOutUrl = string.Empty; //外品牌 protected void Page_Load(object sender, EventArgs e) { //判断权限 if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_基础设置_品牌管理栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_基础设置_品牌管理栏目, false); return; } brandName = Utils.GetFormValue("txtBrand"); //获取报价 int brandId = Utils.GetInt(Utils.GetQueryStringValue("brandId")); //品牌Id string method = Utils.GetFormValue("hidMethod"); //获取当前操作(保存/继续) string showMess = "数据保存完成"; //提示消息 EyouSoft.Model.CompanyStructure.CompanyBrand brandModel = null; EyouSoft.BLL.CompanyStructure.CompanyBrand brandBll = new EyouSoft.BLL.CompanyStructure.CompanyBrand();//初始化bll //无操作方式则为初次加载数据 if (method == "") { #region 初始化数据 if (brandId != 0) { brandModel = brandBll.GetModel(brandId); if (brandModel != null) { brandName = brandModel.BrandName; logInUrl = !string.IsNullOrEmpty(brandModel.Logo1) ? string.Format("<div id='file' style='float:left'><a href='{0}' target='_blank'>查看图片<a><img src='../../images/closebox2.gif' id='del_file'/></div>", brandModel.Logo1) : "暂无内Logo"; if (brandModel.Logo1 != "") { hid_file.Value = brandModel.Logo1; } } return; } #endregion } else { #region 保存数据 if (brandName == "") { MessageBox.Show(this, "品牌名称不为空!"); return; } bool result = false; brandModel = new EyouSoft.Model.CompanyStructure.CompanyBrand(); string logoPath = string.Empty; string oldName = string.Empty; HttpPostedFile inLogo = Request.Files["inLogo"];//内Logo if (inLogo != null) { result = UploadFile.FileUpLoad(inLogo, "systemset", out logoPath, out oldName);//上传内logo } else { result = true; } if (result)//如果成功则上传内logo { if (inLogo != null) { if (logoPath != "") { hid_file.Value = logoPath; } } if (hid_file.Value == "") { brandModel.Logo1 = null; } else { brandModel.Logo1 = hid_file.Value; } brandModel.BrandName = brandName; brandModel.CompanyId = CurrentUserCompanyID; brandModel.OperatorId = 0; brandModel.IssueTime = DateTime.Now; } if (result)//如果logo上传成功则执行保存 { if (brandId != 0) { brandModel.Id = brandId; result = brandBll.Update(brandModel);//修改品牌 } else { result = brandBll.Add(brandModel);//添加品牌 } } if (!result) { showMess = "数据保存失败!"; } //继续添加则刷新页面,否则关闭当前窗口 if (method == "continue") { MessageBox.ShowAndRedirect(this, showMess, "BrandEdit.aspx"); } else { MessageBox.ResponseScript(this, string.Format(";alert('{0}');window.parent.location='/systemset/basicinfo/BrandManage.aspx';window.parent.Boxy.getIframeDialog('{1}').hide();", showMess, Utils.GetQueryStringValue("iframeId"))); } #endregion } }
protected void Page_Load(object sender, EventArgs e) { int dutyID = Utils.GetInt(Request.QueryString["DutyID"], -1); //制度ID string method = Utils.GetFormValue("hidMethod"); if (!IsPostBack && method == "") { this.hidDutyID.Value = dutyID.ToString(); if (dutyID != -1) { EyouSoft.BLL.AdminCenterStructure.RuleInfo bllRuleInfo = new EyouSoft.BLL.AdminCenterStructure.RuleInfo(); EyouSoft.Model.AdminCenterStructure.RuleInfo modelRuleInfo = bllRuleInfo.GetModel(CurrentUserCompanyID, dutyID); if (modelRuleInfo != null) { Number = modelRuleInfo.RoleNo; RegentTitle = modelRuleInfo.Title; this.txt_RegentContent.Value = modelRuleInfo.RoleContent; if (modelRuleInfo.FilePath != "") { FileHref = modelRuleInfo.FilePath; this.hidFileValue.Value = modelRuleInfo.FilePath; file.Visible = true; } else { file.Visible = false; } } else { MessageBox.Show(this.Page, "没有该规章制度信息"); return; } } } if (method == "save") //保存 { Number = Utils.GetFormValue("txt_Number"); RegentTitle = Utils.GetFormValue("txt_RegentTitle"); RegentContent = Utils.EditInputText(Request.Form["txt_RegentContent"]); if (RegentTitle == "") { MessageBox.Show(this.Page, "制度标题不能为空!"); return; } HttpPostedFile hpf = this.Request.Files["file_Bylaw"]; string oldeFile = string.Empty; string fileName = string.Empty; if (hpf != null && hpf.ContentLength > 0) { if (UploadFile.FileUpLoad(hpf, "AdminCenterRuleInfo", out fileName, out oldeFile)) { FileHref = fileName; } else { MessageBox.Show(this.Page, "附加上传失败!"); return; } } else { FileHref = this.hidFileValue.Value; } EyouSoft.Model.AdminCenterStructure.RuleInfo modelRuleInfo = new EyouSoft.Model.AdminCenterStructure.RuleInfo(); EyouSoft.BLL.AdminCenterStructure.RuleInfo bllRuleInfo = new EyouSoft.BLL.AdminCenterStructure.RuleInfo(); modelRuleInfo.RoleNo = Number; modelRuleInfo.Title = RegentTitle; modelRuleInfo.RoleContent = RegentContent; modelRuleInfo.FilePath = FileHref; modelRuleInfo.CompanyId = CurrentUserCompanyID; if (dutyID == -1) { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_规章制度_新增制度)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_规章制度_新增制度, true); } if (bllRuleInfo.Add(modelRuleInfo)) { MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "保存成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/bylaw/Default.aspx")); } else { MessageBox.Show(this.Page, "保存失败!"); } } else if (dutyID != -1) { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_规章制度_修改制度)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_规章制度_修改制度, true); } modelRuleInfo.Id = dutyID; if (bllRuleInfo.Update(modelRuleInfo)) { MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "修改成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/bylaw/Default.aspx")); } else { MessageBox.Show(this.Page, "修改失败!"); } } } }
protected void Page_Load(object sender, EventArgs e) { //判断权限 if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_信息管理_信息管理栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_信息管理_信息管理栏目, true); return; } infoId = Utils.GetInt(Utils.GetQueryStringValue("infoId")); string method = Utils.GetFormValue("hidMethod"); //如果当前操作为保存或者保存继续添加 if (method == "save" || method == "continue") { #region 保存信息 string[] publichTo = Utils.GetFormValues("chkPublishTo");//发布对象 if (publichTo != null && publichTo.Length > 0) { IList <EyouSoft.Model.CompanyStructure.NewsAccept> acceptList = new List <EyouSoft.Model.CompanyStructure.NewsAccept>(); if (publichTo.Contains("cInner")) { EyouSoft.Model.CompanyStructure.NewsAccept acceptModel = new EyouSoft.Model.CompanyStructure.NewsAccept(); acceptModel.AcceptType = EyouSoft.Model.EnumType.PersonalCenterStructure.AcceptType.所有; acceptList.Add(acceptModel); } else if (publichTo.Contains("sDepart")) { if (!string.IsNullOrEmpty(txtDeparts.Value)) { string[] departs = txtDeparts.Value.Split(','); foreach (string dId in departs) { EyouSoft.Model.CompanyStructure.NewsAccept acceptModel = new EyouSoft.Model.CompanyStructure.NewsAccept { AcceptType = EyouSoft.Model.EnumType.PersonalCenterStructure.AcceptType.指定部门, AcceptId = Utils.GetInt(dId) }; acceptList.Add(acceptModel); } } } if (publichTo.Contains("cTour")) { EyouSoft.Model.CompanyStructure.NewsAccept acceptModel = new EyouSoft.Model.CompanyStructure.NewsAccept { AcceptType = EyouSoft.Model.EnumType.PersonalCenterStructure.AcceptType.指定组团 }; acceptList.Add(acceptModel); } newModel.AcceptList = acceptList; } else { MessageBox.Show(this, "请填写完整数据!"); return; } newModel.CompanyId = CurrentUserCompanyID; newModel.Title = Utils.InputText(txtInfoTitle.Value); //发布标题 newModel.Content = Utils.EditInputText(txtInfoContent.Value); //内容 Utils.InputText(txtDeparts.Value); //发布的部门 newModel.OperatorId = SiteUserInfo.ID; //发布人 newModel.OperatorName = SiteUserInfo.ContactInfo.ContactName; newModel.IssueTime = Utils.GetDateTime(Utils.InputText(txtPublishDate.Value)); HttpPostedFile attachFile1 = Request.Files["fileAttach"];//获取附件 bool result = false; if (attachFile1 != null && !string.IsNullOrEmpty(attachFile1.FileName)) { string filePath = string.Empty; string fileName = string.Empty; result = UploadFile.FileUpLoad(attachFile1, "systemset", out filePath, out fileName); if (result) { newModel.UploadFiles = filePath; } } else { result = true; } if (result) { if (infoId != 0) { //修改 newModel.ID = infoId; result = newsBll.Update(newModel); } else { //新增 result = newsBll.Add(newModel); } } if (result) { //保存成功跳转列表或重新发布信息 MessageBox.ShowAndRedirect(this, "信息保存成功", method == "save" ? "/systemset/infomanage/InfoList.aspx" : "/systemset/infomanage/InfoEdit.aspx"); } else { MessageBox.Show(this, "信息保存失败!"); } #endregion } else { if (infoId != 0) { #region 初始化数据 newModel = newsBll.GetModel(infoId); if (newModel != null) { //初始化数据 IList <EyouSoft.Model.CompanyStructure.NewsAccept> acceptList = newModel.AcceptList; if (acceptList != null && acceptList.Count > 0) { if (acceptList.Where(i => i.AcceptType == EyouSoft.Model.EnumType.PersonalCenterStructure.AcceptType.所有).Count() > 0) { innerChecked = "checked=\"checked\""; } IEnumerable <EyouSoft.Model.CompanyStructure.NewsAccept> acceptListDepart = acceptList.Where(i => i.AcceptType == EyouSoft.Model.EnumType.PersonalCenterStructure.AcceptType.指定部门); if (acceptListDepart.Count() > 0) { StringBuilder strBuilder = new StringBuilder(); foreach (var i in acceptListDepart) { strBuilder.AppendFormat("{0},", i.AcceptId); } txtDeparts.Value = strBuilder.ToString().TrimEnd(','); departChecked = "checked=\"checked\""; } if (acceptList.Where(i => i.AcceptType == EyouSoft.Model.EnumType.PersonalCenterStructure.AcceptType.指定组团).Count() > 0) { tourChecked = "checked=\"checked\""; } } txtAuthor.Value = newModel.OperatorName; txtInfoTitle.Value = newModel.Title; txtPublishDate.Value = newModel.IssueTime.ToString("yyyy-MM-dd HH:mm:ss"); attchFile = newModel.UploadFiles; txtInfoContent.Value = newModel.Content; } #endregion } else { txtAuthor.Value = SiteUserInfo.ContactInfo.ContactName; txtPublishDate.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } } }
/// <summary> /// 得到保存或者修改的对象 /// </summary> private void GetAddOrUpdatePersonnelInfo(out EyouSoft.BLL.AdminCenterStructure.PersonnelInfo bllPersonnel, out EyouSoft.Model.AdminCenterStructure.PersonnelInfo modelPersonnel) { #region "基本信息" FileNo = Utils.GetFormValue("txt_FileNo"); //档案编号 Name = Utils.GetFormValue("txt_Name"); //姓名 CardID = Utils.GetFormValue("txt_CardID"); //身份证号码 Birthday = Utils.GetDateTimeNullable(Request.Form["txt_Birthday"]); //生日 EntryDate = Utils.GetFormValue("txt_EntryDate"); //入职日期 //dpWorkLife = Utils.GetFormValue("dpWorkLife"); //工龄 LeftDate = Utils.GetFormValue("txt_LeftDate"); //离职日期 National = Utils.GetFormValue("txt_National"); //民族 Political = Utils.GetFormValue("txt_Political"); //政治面貌 Telephone = Utils.GetFormValue("txt_Telephone"); //联系电话 Mobile = Utils.GetFormValue("txt_Mobile"); //手机 QQ = Utils.GetFormValue("txt_QQ"); MSN = Utils.GetFormValue("txt_MSN"); Email = Utils.GetFormValue("txt_Email"); Address = Utils.GetFormValue("txt_Address"); Remark = Utils.GetFormValue("txt_Remark"); #endregion #region "学历信息" string[] keysGrade = Utils.GetFormValues("EducationGrade"); //学历 string[] keysState = Utils.GetFormValues("EducationState"); //状态 string[] RecordStartDate = Utils.GetFormValues("txt_RecordStartDate"); //开始时间 string[] RecordEndDate = Utils.GetFormValues("txt_RecordEndDate"); //结束时间 string[] Profession = Utils.GetFormValues("txt_Profession"); //专业 string[] Graduation = Utils.GetFormValues("txt_Graduation"); //毕业院校 string[] RecordRemark = Utils.GetFormValues("txt_RecordRemark"); //备注 #endregion #region "履历信息" string[] ResumeStartDate = Utils.GetFormValues("txt_ResumeStartDate"); //开始时间 string[] ResumeEndDate = Utils.GetFormValues("txt_ResumeEndDate"); //结束时间 string[] WorkPlace = Utils.GetFormValues("txt_WorkPlace"); //工作地点 string[] WorkUnit = Utils.GetFormValues("txt_WorkUnit"); //工作单位 string[] Job = Utils.GetFormValues("txt_Job"); //职业 string[] ResumeRemark = Utils.GetFormValues("txt_ResumeRemark"); //备注 #endregion bllPersonnel = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo(); modelPersonnel = new EyouSoft.Model.AdminCenterStructure.PersonnelInfo(); #region 保存修改 modelPersonnel.CompanyId = CurrentUserCompanyID; modelPersonnel.ArchiveNo = FileNo; modelPersonnel.UserName = Name; modelPersonnel.ContactSex = (EyouSoft.Model.EnumType.CompanyStructure.Sex) this.dpSex.SelectedIndex; modelPersonnel.CardId = CardID; modelPersonnel.BirthDate = Birthday; modelPersonnel.DepartmentId = this.ucDepartemnt.GetDepartId; HttpPostedFile hpf = this.Request.Files["FileEmployeePicture"]; bool Result = false; string fileName = string.Empty; string oldeName = string.Empty; if (hpf != null && hpf.ContentLength > 0) { Result = UploadFile.FileUpLoad(hpf, "workerPhoto", out fileName, out oldeName); modelPersonnel.PhotoPath = fileName; //上转照片 } else { modelPersonnel.PhotoPath = this.hiddenPhoto.Value; } modelPersonnel.DutyName = ddlJobPostion.SelectedValue; string m = this.ddlJobPostion.Text; modelPersonnel.DutyId = Utils.GetIntNull(Utils.GetFormValue(this.ddlJobPostion.UniqueID));//职务ID modelPersonnel.IsLeave = this.dpWorkerState.Value == "1" ? true : false; modelPersonnel.PersonalType = (EyouSoft.Model.EnumType.AdminCenterStructure.PersonalType)Utils.GetInt(this.dpWorkerType.Value); //modelPersonnel.WorkYear = Utils.GetInt(dpWorkLife); modelPersonnel.EntryDate = Utils.GetDateTimeNullable(EntryDate); modelPersonnel.IsMarried = this.dpMarriageState.Value == "1" ? true : false; modelPersonnel.LeaveDate = Utils.GetDateTimeNullable(LeftDate); modelPersonnel.National = National; modelPersonnel.Birthplace = this.ucProvince1.ProvinceId + "," + this.ucCity1.CityId; modelPersonnel.Politic = Political; modelPersonnel.ContactTel = Telephone; modelPersonnel.ContactMobile = Mobile; modelPersonnel.QQ = QQ; modelPersonnel.Email = Email; modelPersonnel.MSN = MSN; modelPersonnel.ContactAddress = Address; modelPersonnel.Remark = Remark; #region 学历信息 IList <EyouSoft.Model.AdminCenterStructure.SchoolInfo> listSchool = new List <EyouSoft.Model.AdminCenterStructure.SchoolInfo>(); EyouSoft.Model.AdminCenterStructure.SchoolInfo modelSchool = null; if (RecordStartDate != null && RecordStartDate.Length > 0) { for (int index = 0; index < RecordStartDate.Length; index++) { if (!string.IsNullOrEmpty(RecordStartDate[index].Trim()) && !string.IsNullOrEmpty(RecordEndDate[index].Trim()) && (!string.IsNullOrEmpty(Utils.GetFormValue(keysGrade[index]).Trim()) || !string.IsNullOrEmpty(Profession[index].Trim()) || !string.IsNullOrEmpty(Graduation[index].Trim()) || !string.IsNullOrEmpty(Utils.GetFormValue(keysState[index]).Trim()) || !string.IsNullOrEmpty(RecordRemark[index].Trim()))) { modelSchool = new EyouSoft.Model.AdminCenterStructure.SchoolInfo(); modelSchool.StartDate = Utils.GetDateTimeNullable(RecordStartDate[index].Trim()); modelSchool.EndDate = Utils.GetDateTimeNullable(RecordEndDate[index].Trim()); modelSchool.Degree = (EyouSoft.Model.EnumType.AdminCenterStructure.DegreeType)Utils.GetInt(keysGrade[index]); modelSchool.Professional = Utils.InputText(Profession[index].Trim()); modelSchool.SchoolName = Utils.InputText(Graduation[index].Trim()); modelSchool.StudyStatus = Convert.ToBoolean(Utils.GetInt(keysState[index])); modelSchool.Remark = Utils.InputText(RecordRemark[index].Trim()); listSchool.Add(modelSchool); } } if (listSchool.Count > 0) { modelPersonnel.SchoolList = listSchool; } } #endregion #region 履历信息 IList <EyouSoft.Model.AdminCenterStructure.PersonalHistory> listHistory = new List <EyouSoft.Model.AdminCenterStructure.PersonalHistory>(); EyouSoft.Model.AdminCenterStructure.PersonalHistory modelHistory = null; if (ResumeStartDate != null && ResumeStartDate.Length > 0) { for (int index = 0; index < ResumeStartDate.Length; index++) { if (!string.IsNullOrEmpty(ResumeStartDate[index].Trim()) && !string.IsNullOrEmpty(ResumeEndDate[index].Trim()) && (!string.IsNullOrEmpty(WorkPlace[index].Trim()) || !string.IsNullOrEmpty(WorkUnit[index].Trim()) || !string.IsNullOrEmpty(Job[index].Trim()) || !string.IsNullOrEmpty(ResumeRemark[index].Trim()))) { modelHistory = new EyouSoft.Model.AdminCenterStructure.PersonalHistory(); modelHistory.StartDate = Utils.GetDateTimeNullable(ResumeStartDate[index].Trim()); modelHistory.EndDate = Utils.GetDateTimeNullable(ResumeEndDate[index].Trim()); modelHistory.WorkPlace = Utils.InputText(WorkPlace[index].Trim()); modelHistory.WorkUnit = Utils.InputText(WorkUnit[index].Trim()); modelHistory.TakeUp = Utils.InputText(Job[index].Trim()); modelHistory.Remark = Utils.InputText(ResumeRemark[index].Trim()); listHistory.Add(modelHistory); } } if (listHistory != null && listHistory.Count > 0) { modelPersonnel.HistoryList = listHistory; } } #endregion #endregion }
protected void Page_Load(object sender, EventArgs e) { //判断权限 if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_组织机构_部门设置栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_组织机构_部门设置栏目, false); return; } int departId = Utils.GetInt(Utils.GetQueryStringValue("departId")); //报价Id string method = Utils.GetFormValue("hidMethod"); //获取当前操作(保存/继续) string method2 = Utils.GetQueryStringValue("method2"); //判断是否为新增或修改 string showMess = "数据保存成功!"; //提示消息 EyouSoft.Model.CompanyStructure.Department departModel = null; EyouSoft.BLL.CompanyStructure.Department departBll = new EyouSoft.BLL.CompanyStructure.Department(); //初始化bll EyouSoft.BLL.CompanyStructure.CompanyUser userBll = new EyouSoft.BLL.CompanyStructure.CompanyUser(SiteUserInfo); //初始化bll IList <EyouSoft.Model.CompanyStructure.Department> departList = departBll.GetAllDept(CurrentUserCompanyID); IList <EyouSoft.Model.CompanyStructure.CompanyUser> userlist = userBll.GetCompanyUser(CurrentUserCompanyID); //绑定部门列表 if (departList != null && departList.Count > 0) { selParentDE.DataTextField = "DepartName"; selParentDE.DataValueField = "Id"; selParentDE.DataSource = departList; selParentDE.DataBind(); } //绑定员工列表 if (userlist != null && userlist.Count > 0) { foreach (EyouSoft.Model.CompanyStructure.CompanyUser user in userlist) { selDepEmp.Items.Add(new ListItem(user.PersonInfo.ContactName, user.ID.ToString())); } } selParentDE.Items.Insert(0, new ListItem("请选择", "")); //上级部门 selDepEmp.Items.Insert(0, new ListItem("请选择", "")); //部门主管 //无操作方式则为获取数据 if (method == "") { #region 初始化数据 if (departId != 0) { departModel = departBll.GetModel(departId); if (method2 == "update")//修改 { if (departModel != null) { txtDepName.Value = departModel.DepartName; //部门名称 selDepEmp.Value = departModel.DepartManger.ToString(); //部门主管 selParentDE.Value = departModel.PrevDepartId.ToString(); // 上级部门 parentD = departModel.PrevDepartId.ToString(); txtTel.Value = departModel.ContactTel; //联系电话 txtRemark.Value = departModel.Remark; //备注 txtFax.Value = departModel.ContactFax; //传真 if (!string.IsNullOrEmpty(departModel.PageHeadFile)) { hidHeader.Value = departModel.PageHeadFile; } if (!string.IsNullOrEmpty(departModel.PageFootFile)) { hidFooter.Value = departModel.PageFootFile; } if (!string.IsNullOrEmpty(departModel.TemplateFile)) { hidModel.Value = departModel.TemplateFile; } if (!string.IsNullOrEmpty(departModel.DepartStamp)) { hidSeat.Value = departModel.DepartStamp; } pageHeader = !string.IsNullOrEmpty(departModel.PageHeadFile) ? string.Format("<a href='{0}' target='_blank'>查看</a> <a href='javascript:;' onclick=\"return De.del('{1}',this);\"><img src='/images/fujian_x.gif'/></a>", departModel.PageHeadFile, hidHeader.ClientID) : "暂无页眉"; pageFooter = !string.IsNullOrEmpty(departModel.PageFootFile) ? string.Format("<a href='{0}' target='_blank'>查看</a> <a href='javascript:;' onclick=\"return De.del('{1}',this);\"><img src='/images/fujian_x.gif'/></a>", departModel.PageFootFile, hidFooter.ClientID) : "暂无页脚"; pageModel = !string.IsNullOrEmpty(departModel.TemplateFile) ? string.Format("<a href='{0}' target='_blank'>查看</a> <a href='javascript:;' onclick=\"return De.del('{1}',this);\"><img src='/images/fujian_x.gif'/></a>", departModel.TemplateFile, hidModel.ClientID) : "暂无模板"; departSeal = !string.IsNullOrEmpty(departModel.DepartStamp) ? string.Format("<a href='{0}' target='_blank'>查看</a> <a href='javascript:;' onclick=\"return De.del('{1}',this);\"><img src='/images/fujian_x.gif'/></a>", departModel.DepartStamp, hidSeat.ClientID) : "暂无公章"; if (parentD == "0") { selParentDE.Attributes.Remove("valid"); } } } else { if (departModel != null) { selParentDE.Value = departModel.Id.ToString();//如果是添加操作则将部门ID设置上级部门 } } return; } #endregion } else { #region 保存操作 bool result = true; departModel = new EyouSoft.Model.CompanyStructure.Department(); string fileName = string.Empty; string oldName = string.Empty; HttpPostedFile fHeader = Request.Files["fileHeader"]; HttpPostedFile fFooter = Request.Files["fileFooter"]; HttpPostedFile fSeal = Request.Files["fileSeal"]; HttpPostedFile fModel = Request.Files["fileModel"]; if (fHeader != null && !string.IsNullOrEmpty(fHeader.FileName)) { result = UploadFile.FileUpLoad(fHeader, "systemset", out fileName, out oldName);//上传页眉 departModel.PageHeadFile = fileName; } else { departModel.PageHeadFile = hidHeader.Value; } if (result && (fFooter != null && !string.IsNullOrEmpty(fFooter.FileName))) { result = UploadFile.FileUpLoad(fFooter, "systemset", out fileName, out oldName);//上传页脚 departModel.PageFootFile = fileName; } else { departModel.PageFootFile = hidFooter.Value; } if (result && (fModel != null && !string.IsNullOrEmpty(fModel.FileName))) { result = UploadFile.FileUpLoad(fModel, "systemset", out fileName, out oldName);//上传模板 departModel.TemplateFile = fileName; } else { departModel.TemplateFile = hidModel.Value; } if (result && (fSeal != null && !string.IsNullOrEmpty(fSeal.FileName))) { result = UploadFile.FileUpLoad(fSeal, "systemset", out fileName, out oldName);//上传公章 departModel.DepartStamp = fileName; } else { departModel.DepartStamp = hidSeat.Value; } if (result) { departModel.CompanyId = CurrentUserCompanyID; //公司ID departModel.ContactFax = Utils.InputText(txtFax.Value); //传真 departModel.ContactTel = Utils.InputText(txtTel.Value); //电话 departModel.DepartName = Utils.InputText(txtDepName.Value); //部门名称 departModel.Remark = Utils.InputText(txtRemark.Value); //备注 departModel.IssueTime = DateTime.Now; //添加时间 departModel.OperatorId = SiteUserInfo.ID; //操作人 departModel.PrevDepartId = Utils.GetInt(Utils.GetFormValue(selParentDE.UniqueID)); //上级部门 departModel.DepartManger = Utils.GetInt(Utils.GetFormValue(selDepEmp.UniqueID)); //部门主管 //if (departModel.DepartManger == 0) //{ // MessageBox.Show(this, "请填写完整数据!"); // return; //} if (departId != 0) { if (method2 == "update") { departModel.Id = departId; result = departBll.Update(departModel);//修改部门 } else { result = departBll.Add(departModel);//添加部门 } } else { result = departBll.Add(departModel);//添加部门 } } if (!result) { showMess = "数据保存失败!"; } StringBuilder messBuilder = new StringBuilder(); //如果是修改则回调父窗口的修改方法,否则回调新增方法 if (method2 == "update") { messBuilder.AppendFormat(";window.parent.DM.callbackUpdateD('{0}','{1}','{3}');alert('{2}');", departId, Utils.InputText(txtDepName.Value), showMess, departModel.PrevDepartId.ToString() != Utils.GetFormValue("hidParentDE")); } else { messBuilder.AppendFormat(";window.parent.DM.callbackAddD('{0}');alert('{1}');", departId, showMess); } //如果是保存继续则刷新页面,否则关闭弹窗 if (method == "continue") { messBuilder.AppendFormat("window.location='/systemset/organize/DepartEdit.aspx?method2=add&departId={0}", departId); } else { messBuilder.AppendFormat("window.parent.Boxy.getIframeDialog('{0}').hide();", Utils.GetQueryStringValue("iframeId")); } MessageBox.ResponseScript(this, messBuilder.ToString()); return; #endregion } }