private OrganizationInfo GetOrg(UserInfo loginedUser) { // 检查用户的输入情况 if (string.IsNullOrEmpty(txtName.Text.Trim())) { lblError.Text = "请输入机构名称!"; return(null); } if (string.IsNullOrEmpty(txtOrder.Text.Trim()) || !ValidationUtility.IsNumric(txtOrder.Text.Trim())) { lblError.Text = "请输入正确格式的排序数值!"; return(null); } var ret = new OrganizationInfo { Id = 0, CreatedByID = loginedUser.ID, CreatedByName = loginedUser.Alias, CreatedDate = DateTime.Now }; // 如果是修改,则获取要修改的对象 if (!string.IsNullOrEmpty(Request["id"])) { var list = _bll.GetOrganizationList(string.Empty, "order by DisplayOrder Desc"); if (list == null) { return(null); } var orgInfo = list.FirstOrDefault(i => i.Id == int.Parse(Request["id"])); ret = orgInfo; } if (ret == null) { return(null); } ret.Name = txtName.Text.Trim(); ret.Description = txtDesc.Text.Trim(); ret.DisplayOrder = int.Parse(txtOrder.Text.Trim()); ret.LastUpdByID = loginedUser.ID; ret.LastUpdByName = loginedUser.Alias; ret.LastUpdDate = DateTime.Now; return(ret); }
private RoleInfo GetRole(UserInfo loginedUser, RoleManagerBLL BLL) { // 检查用户的输入情况 if (string.IsNullOrEmpty(txtName.Text.Trim())) { lblError.Text = "请输入角色名称!"; return(null); } if (string.IsNullOrEmpty(txtOrder.Text.Trim()) || !ValidationUtility.IsNumric(txtOrder.Text.Trim())) { lblError.Text = "请输入正确格式的排序数值!"; return(null); } var ret = new RoleInfo { ID = 0, PopedomIDs = string.Empty, CreatedByID = loginedUser.ID, CreatedByName = loginedUser.Alias, CreatedDate = DateTime.Now }; // 如果是修改,则获取要修改的对象 if (!string.IsNullOrEmpty(hdnRoleNo.Value.Trim())) { var existRole = BLL.GetRole(int.Parse(hdnRoleNo.Value.Trim())); if (existRole == null) { lblError.Text = "修改的对象未找到!请确认该对象是否被其它用户删除!"; return(null); } ret = existRole; } ret.RoleName = txtName.Text.Trim(); ret.HeadImage = string.Empty; ret.Description = txtDesc.Text.Trim(); ret.DisplayOrder = int.Parse(txtOrder.Text.Trim()); ret.LastUpdByID = loginedUser.ID; ret.LastUpdByName = loginedUser.Alias; ret.LastUpdDate = DateTime.Now; return(ret); }
private CafeteriInfo GetOrg(UserInfo loginedUser) { // 检查用户的输入情况 if (string.IsNullOrEmpty(txtName.Text.Trim())) { lblError.Text = "请输入食堂名称!"; return(null); } if (string.IsNullOrEmpty(txtOrder.Text.Trim()) || !ValidationUtility.IsNumric(txtOrder.Text.Trim())) { lblError.Text = "请输入正确格式的排序数值!"; return(null); } var ret = new CafeteriInfo { Id = 0, CreatedByID = loginedUser.ID, CreatedByName = loginedUser.Alias, CreatedDate = DateTime.Now }; // 如果是修改,则获取要修改的对象 if (!string.IsNullOrEmpty(Request["id"])) { var list = _cafeteriBLL.GetCafeteriList(string.Empty, "order by DisplayOrder Desc"); if (list == null) { return(null); } var orgInfo = list.FirstOrDefault(i => i.Id == int.Parse(Request["id"])); ret = orgInfo; } if (ret == null) { return(null); } ret.Name = txtName.Text.Trim(); ret.Description = txtDesc.Text.Trim(); if (loginedUser.OrganizationId != null) { ret.OrganizationId = loginedUser.OrganizationId.Value; } ret.OrganizationName = loginedUser.OrganizationName; ret.CafeteriaTypeEnum = (CafeteriaTypeEnum)Enum.Parse(typeof(CafeteriaTypeEnum), ddlCafeteriaTypeEnum.SelectedValue); ret.DisplayOrder = int.Parse(txtOrder.Text.Trim()); ret.LastUpdByID = loginedUser.ID; ret.LastUpdByName = loginedUser.Alias; ret.LastUpdDate = DateTime.Now; return(ret); }
private ModuleInfo GetModule(UserInfo user, ModuleManagerBLL bll) { // 检查用户的输入情况 if (string.IsNullOrEmpty(hdnParentModuleNo.Value.Trim())) { lblError.Text = "请选择父模块!"; return(null); } if (string.IsNullOrEmpty(txtName.Text.Trim())) { lblError.Text = "请输入模块名称!"; return(null); } if (cbxIsMenu.Checked && !cbxIsFloder.Checked && string.IsNullOrEmpty(txtUrl.Text.Trim())) { lblError.Text = "当模块为菜单项且不是菜单组时,请输入模块URL!"; return(null); } if (string.IsNullOrEmpty(txtOrder.Text.Trim()) || !ValidationUtility.IsNumric(txtOrder.Text.Trim())) { lblError.Text = "请输入正确格式的排序数值!"; return(null); } var ret = new ModuleInfo { ID = ModuleInfo.CONST_EMPTY_ID, CreatedByID = user.ID, CreatedByName = user.Alias, CreatedDate = DateTime.Now }; // 如果是修改,则获取要修改的对象 if (!string.IsNullOrEmpty(hdnModuleNo.Value.Trim())) { var existModule = bll.GetModule(int.Parse(hdnModuleNo.Value.Trim())); if (existModule == null) { lblError.Text = "修改的对象未找到!请确认该对象是否被其它用户删除!"; return(null); } ret = existModule; } ret.ParentID = int.Parse(hdnParentModuleNo.Value.Trim()); ret.RootID = int.Parse(hdnRootModuleNo.Value.Trim()); ret.Name = txtName.Text.Trim(); ret.Url = txtUrl.Text.Trim(); // 获取ICON ret.Icon = FileUtility.SaveUploadingMenuIcon(fupIcon); ret.IsMenu = cbxIsMenu.Checked; ret.IsFloder = cbxIsFloder.Checked; ret.IsPopedom = cbxIsPopedom.Checked; ret.DisplayOrder = int.Parse(txtOrder.Text.Trim()); ret.LastUpdByID = user.ID; ret.LastUpdByName = user.Alias; ret.LastUpdDate = DateTime.Now; return(ret); }
private CafeteriaStaffInfo GetCafeInfo(UserInfo loginedUser) { // 检查用户的输入情况 if (string.IsNullOrEmpty(txtName.Text.Trim())) { lblError.Text = "请输入食管人员名称!"; return(null); } if (string.IsNullOrEmpty(txtTel.Text.Trim())) { lblError.Text = "请输入食管人员的电话!"; return(null); } if (string.IsNullOrEmpty(txtWechat.Text.Trim())) { lblError.Text = "请输入食管人员的微信号!"; return(null); } if (string.IsNullOrEmpty(txtOrder.Text.Trim()) || !ValidationUtility.IsNumric(txtOrder.Text.Trim())) { lblError.Text = "请输入正确格式的排序数值!"; return(null); } var ret = new CafeteriaStaffInfo { Id = 0, CreatedByID = loginedUser.ID, CreatedByName = loginedUser.Alias, CreatedDate = DateTime.Now }; // 如果是修改,则获取要修改的对象 if (!string.IsNullOrEmpty(Request["id"])) { var cateInfo = _staffBLL.GetCafeteriaStaff(Convert.ToInt32(Request["id"])); if (cateInfo == null) { return(null); } ret = cateInfo; } if (fileIcon.HasFile) { var fileExt = FileUtility.GetExtension(fileIcon.FileName); if (fileExt.ToLower() != ".jpg" && fileExt.ToLower() != ".png") { lblError.Text = "请输入jpg或png图片!"; return(null); } var filePath = FileUtility.GetNewFileName(Path.GetFileName(fileIcon.FileName)); var filePathThum = FileUtility.GetNewFileName(filePath); FileUtility.FileSave(FileUtility.GetPhysicAbsoluteFullFileName(FileUtility.ConstCafeteriaStaffIcon, filePath), this.fileIcon.PostedFile, 60, 60, FileUtility.GetPhysicAbsoluteFullFileName(FileUtility.ConstCafeteriaStaffIcon, filePathThum)); ret.Icon = filePath; ret.IconThum = filePathThum; } ret.Name = txtName.Text.Trim(); ret.CafeteriaId = Convert.ToInt32(ddlCafeters.SelectedValue); ret.CafeteriaName = ddlCafeters.SelectedItem.Text; ret.Tel = txtTel.Text.Trim(); ret.Wechat = txtWechat.Text.Trim(); if (loginedUser.OrganizationId != null) { ret.OrganizationId = loginedUser.OrganizationId.Value; } ret.OrganizationName = loginedUser.OrganizationName; ret.DisplayOrder = int.Parse(txtOrder.Text.Trim()); ret.LastUpdByID = loginedUser.ID; ret.LastUpdByName = loginedUser.Alias; ret.LastUpdDate = DateTime.Now; return(ret); }