protected void Page_Load(object sender, EventArgs e) { lblAvialable.Text = GetString("com.department.defaulttaxes"); mDepartmentId = QueryHelper.GetInteger("departmentid", 0); if (mDepartmentId > 0) { mDepartmentInfoObj = DepartmentInfoProvider.GetDepartmentInfo(mDepartmentId); EditedObject = mDepartmentInfoObj; if (mDepartmentInfoObj != null) { CheckEditedObjectSiteID(mDepartmentInfoObj.DepartmentSiteID); // Get tax classes assigned to department DataSet ds = TaxClassInfoProvider.GetDepartmentTaxClasses(mDepartmentId); if (!DataHelper.DataSourceIsEmpty(ds)) { mCurrentValues = TextHelper.Join(";", SystemDataHelper.GetStringValues(ds.Tables[0], "TaxClassID")); } if (!RequestHelper.IsPostBack()) { uniSelector.Value = mCurrentValues; } } } uniSelector.IconPath = GetObjectIconUrl("ecommerce.taxclass", "object.png"); uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged; uniSelector.WhereCondition = GetSelectorWhereCondition(); }
protected void Page_Load(object sender, EventArgs e) { lblAvialable.Text = GetString("com.department.usersavailable"); mDepartmentId = QueryHelper.GetInteger("departmentid", 0); if (mDepartmentId > 0) { mDepartmentInfoObj = DepartmentInfoProvider.GetDepartmentInfo(mDepartmentId); EditedObject = mDepartmentInfoObj; if (mDepartmentInfoObj != null) { CheckEditedObjectSiteID(mDepartmentInfoObj.DepartmentSiteID); // Get the active users string where = "UserID IN (SELECT UserID FROM COM_UserDepartment WHERE DepartmentID = " + mDepartmentId + ")"; DataSet ds = UserInfoProvider.GetUsers(where, null, 0, "UserID"); if (!DataHelper.DataSourceIsEmpty(ds)) { mCurrentValues = TextHelper.Join(";", SystemDataHelper.GetStringValues(ds.Tables[0], "UserID")); } if (!RequestHelper.IsPostBack()) { uniSelector.Value = mCurrentValues; } } } uniSelector.IconPath = GetObjectIconUrl("cms.user", "object.png"); uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged; uniSelector.WhereCondition = GetWhereCondition(); }
/// <summary> /// Sets data to database. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // Check permissions CheckConfigurationModification(mEditedSiteId); // Check input values from textboxes and other controls - new Validator() string errorMessage = new Validator() .NotEmpty(txtDepartmentDisplayName.Text.Trim(), GetString("Department_Edit.errorEmptyDisplayName")) .NotEmpty(txtDepartmentName.Text.Trim(), GetString("Department_Edit.errorEmptyCodeName")) .IsCodeName(txtDepartmentName.Text.Trim(), GetString("General.ErrorCodeNameInIdentificatorFormat")).Result; if (errorMessage == "") { // DepartmentName must be unique DepartmentInfo departmentObj = null; string siteWhere = (mEditedSiteId > 0) ? " AND (DepartmentSiteID = " + mEditedSiteId + " OR DepartmentSiteID IS NULL)" : ""; DataSet ds = DepartmentInfoProvider.GetDepartments("DepartmentName = '" + txtDepartmentName.Text.Trim().Replace("'", "''") + "'" + siteWhere, null, 1, null); if (!DataHelper.DataSourceIsEmpty(ds)) { departmentObj = new DepartmentInfo(ds.Tables[0].Rows[0]); } if ((departmentObj == null) || (departmentObj.DepartmentID == mDepartmentId)) { // Get the object if (departmentObj == null) { departmentObj = DepartmentInfoProvider.GetDepartmentInfo(mDepartmentId); if (departmentObj == null) { departmentObj = new DepartmentInfo(); departmentObj.DepartmentSiteID = mEditedSiteId; } } departmentObj.DepartmentID = mDepartmentId; departmentObj.DepartmentName = txtDepartmentName.Text.Trim(); departmentObj.DepartmentDisplayName = txtDepartmentDisplayName.Text.Trim(); // Save the object DepartmentInfoProvider.SetDepartmentInfo(departmentObj); lblInfo.Visible = true; lblInfo.Text = GetString("General.ChangesSaved"); } else { lblError.Visible = true; lblError.Text = GetString("Department_Edit.DepartmentNameExists"); lblInfo.Visible = false; } } else { lblError.Visible = true; lblError.Text = errorMessage; } }
/// <summary> /// Sets data to database. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // Check permissions CheckConfigurationModification(ConfiguredSiteID); // Check input values from textboxes and other controls string errorMessage = new Validator() .NotEmpty(txtDepartmentDisplayName.Text.Trim(), GetString("Department_Edit.errorEmptyDisplayName")) .NotEmpty(txtDepartmentName.Text.Trim(), GetString("Department_Edit.errorEmptyCodeName")).Result; if (!ValidationHelper.IsCodeName(txtDepartmentName.Text.Trim())) { errorMessage = GetString("General.ErrorCodeNameInIdentificatorFormat"); } if (errorMessage == "") { // DepartmentName must be unique DepartmentInfo departmentObj = null; string siteWhere = (ConfiguredSiteID > 0) ? " AND (DepartmentSiteID = " + ConfiguredSiteID + " OR DepartmentSiteID IS NULL)" : ""; DataSet ds = DepartmentInfoProvider.GetDepartments("DepartmentName = '" + txtDepartmentName.Text.Trim().Replace("'", "''") + "'" + siteWhere, null, 1, null); if (!DataHelper.DataSourceIsEmpty(ds)) { departmentObj = new DepartmentInfo(ds.Tables[0].Rows[0]); } // If departmentName value is unique if ((departmentObj == null) || (departmentObj.DepartmentID == mDepartmentId)) { departmentObj = new DepartmentInfo(); departmentObj.DepartmentID = mDepartmentId; departmentObj.DepartmentName = txtDepartmentName.Text.Trim(); departmentObj.DepartmentDisplayName = txtDepartmentDisplayName.Text.Trim(); departmentObj.DepartmentSiteID = ConfiguredSiteID; DepartmentInfoProvider.SetDepartmentInfo(departmentObj); URLHelper.Redirect("Department_Frameset.aspx?departmentId=" + Convert.ToString(departmentObj.DepartmentID) + "&saved=1&siteId="+SiteID); } else { lblError.Visible = true; lblError.Text = GetString("Department_Edit.DepartmentNameExists"); } } else { lblError.Visible = true; lblError.Text = errorMessage; } }
protected void Page_Load(object sender, EventArgs e) { if (IsMultiStoreConfiguration) { CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Ecommerce.GlobalDepartments.Users"); } else { CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Configuration.Departments.Users"); } mDepartmentId = QueryHelper.GetInteger("objectId", 0); if (mDepartmentId > 0) { mDepartmentInfoObj = DepartmentInfoProvider.GetDepartmentInfo(mDepartmentId); EditedObject = mDepartmentInfoObj; if (mDepartmentInfoObj != null) { CheckEditedObjectSiteID(mDepartmentInfoObj.DepartmentSiteID); // Get the active users string where = "UserID IN (SELECT UserID FROM COM_UserDepartment WHERE DepartmentID = " + mDepartmentId + ")"; var data = UserInfoProvider.GetUsers().Where(where).Columns("UserID"); if (data.Any()) { mCurrentValues = TextHelper.Join(";", DataHelper.GetStringValues(data.Tables[0], "UserID")); } if (!RequestHelper.IsPostBack()) { uniSelector.Value = mCurrentValues; } } } uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged; uniSelector.WhereCondition = GetWhereCondition(); }
protected void Page_Load(object sender, EventArgs e) { // Check permissions for CMS Desk -> Ecommerce if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Configuration.Departments.Users")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Configuration.Departments.Users"); } lblAvialable.Text = GetString("com.department.usersavailable"); mDepartmentId = QueryHelper.GetInteger("departmentid", 0); if (mDepartmentId > 0) { mDepartmentInfoObj = DepartmentInfoProvider.GetDepartmentInfo(mDepartmentId); EditedObject = mDepartmentInfoObj; if (mDepartmentInfoObj != null) { CheckEditedObjectSiteID(mDepartmentInfoObj.DepartmentSiteID); // Get the active users string where = "UserID IN (SELECT UserID FROM COM_UserDepartment WHERE DepartmentID = " + mDepartmentId + ")"; DataSet ds = UserInfoProvider.GetUsers(where, null, 0, "UserID"); if (!DataHelper.DataSourceIsEmpty(ds)) { mCurrentValues = TextHelper.Join(";", SqlHelperClass.GetStringValues(ds.Tables[0], "UserID")); } if (!RequestHelper.IsPostBack()) { this.uniSelector.Value = mCurrentValues; } } } this.uniSelector.IconPath = GetObjectIconUrl("cms.user", "object.png"); this.uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged; this.uniSelector.WhereCondition = GetWhereCondition(); }
protected void Page_Load(object sender, EventArgs e) { if (IsMultiStoreConfiguration) { CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Ecommerce.GlobalDepartments.DefaultTaxClasses"); } else { CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Configuration.Departments.TaxClasses"); } mDepartmentId = QueryHelper.GetInteger("objectId", 0); if (mDepartmentId > 0) { mDepartmentInfoObj = DepartmentInfoProvider.GetDepartmentInfo(mDepartmentId); EditedObject = mDepartmentInfoObj; if (mDepartmentInfoObj != null) { CheckEditedObjectSiteID(mDepartmentInfoObj.DepartmentSiteID); // Get tax classes assigned to department DataSet ds = TaxClassInfoProvider.GetDepartmentTaxClasses(mDepartmentId); if (!DataHelper.DataSourceIsEmpty(ds)) { mCurrentValues = TextHelper.Join(";", DataHelper.GetStringValues(ds.Tables[0], "TaxClassID")); } if (!RequestHelper.IsPostBack()) { uniSelector.Value = mCurrentValues; } } } uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged; uniSelector.WhereCondition = GetSelectorWhereCondition(); }
protected void Page_Load(object sender, EventArgs e) { // Check permissions for CMS Desk -> Ecommerce if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Configuration.Departments.TaxClasses")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Configuration.Departments.TaxClasses"); } lblAvialable.Text = GetString("com.department.defaulttaxes"); mDepartmentId = QueryHelper.GetInteger("departmentid", 0); if (mDepartmentId > 0) { mDepartmentInfoObj = DepartmentInfoProvider.GetDepartmentInfo(mDepartmentId); EditedObject = mDepartmentInfoObj; if (mDepartmentInfoObj != null) { CheckEditedObjectSiteID(mDepartmentInfoObj.DepartmentSiteID); DataSet ds = TaxClassInfoProvider.GetDepartmentTaxClasses(mDepartmentId); if (!DataHelper.DataSourceIsEmpty(ds)) { mCurrentValues = TextHelper.Join(";", SqlHelperClass.GetStringValues(ds.Tables[0], "TaxClassID")); } if (!RequestHelper.IsPostBack()) { uniSelector.Value = mCurrentValues; } } } uniSelector.IconPath = GetObjectIconUrl("ecommerce.taxclass", "object.png"); uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged; uniSelector.WhereCondition = GetSelectorWhereCondition(); }
/// <summary> /// Checks if the user is authorized for the specified department and redirects to the access denied page when he isn't. /// </summary> private void CheckDepartmentPermission(DepartmentInfo department) { if ((department != null) && !ECommerceContext.IsUserAuthorizedForDepartment(department.DepartmentID)) { string message = string.Format(ResHelper.GetString("cmsdesk.notauthorizedtperdepartment"), department.DepartmentDisplayName); RedirectToAccessDenied(message); } }
public void UpdateDepartment( DepartmentInfo department ) { UpdateDepartmentRequest request = new UpdateDepartmentRequest() { Department = department }; CallWebService<IOrgUnitManagementServicev1_0, UpdateDepartmentRequest, UpdateOrgUnitResponse>( m_service1_0, request, ( s, q ) => s.UpdateDepartment( q ) ); }
public bool Add(DepartmentInfo dep) { return(dal.Add(dep)); }
/// <summary> /// Gets and bulk updates departments. Called when the "Get and bulk update departments" button is pressed. /// Expects the CreateDepartment method to be run first. /// </summary> private bool GetAndBulkUpdateDepartments() { // Prepare the parameters string where = "DepartmentName LIKE N'MyNewDepartment%'"; // Get the data DataSet departments = DepartmentInfoProvider.GetDepartments(where, null); if (!DataHelper.DataSourceIsEmpty(departments)) { // Loop through the individual items foreach (DataRow departmentDr in departments.Tables[0].Rows) { // Create object from DataRow DepartmentInfo modifyDepartment = new DepartmentInfo(departmentDr); // Update the properties modifyDepartment.DepartmentDisplayName = modifyDepartment.DepartmentDisplayName.ToUpper(); // Update the department DepartmentInfoProvider.SetDepartmentInfo(modifyDepartment); } return true; } return false; }
public bool AddDepartment(DepartmentInput departmentInput, out string message) { IQueryable <RoleInfo> roleInfos = _dbContext.Set <RoleInfo>(); IQueryable <RUserRoleInfo> rUserRoleInfos = _dbContext.Set <RUserRoleInfo>(); IQueryable <DepartmentInfo> departmentInfos = _dbContext.Set <DepartmentInfo>(); DepartmentInfo department = departmentInfos.Where(d => d.DepartmentId == departmentInput.DepartmentId).FirstOrDefault(); if (department == null) { DepartmentInfo department1 = departmentInfos.Where(d => d.DepartmentName == departmentInput.DepartmentName).FirstOrDefault(); //部门名是否已被使用 if (department1 == null) { DepartmentInfo info = departmentInfos.Where(d => d.LeaderId == departmentInput.LeaderId).FirstOrDefault(); //查询此人是否已是领导 if (info == null) { try { DepartmentInfo newDepartment = new DepartmentInfo { DepartmentId = departmentInput.DepartmentId, DepartmentName = departmentInput.DepartmentName, LeaderId = departmentInput.LeaderId, ParentId = departmentInput.ParentId, Description = departmentInput.Description, AddTime = DateTime.Now }; //将该用户的角色添加多一条为部门领导 RUserRoleInfo rUserRole = new RUserRoleInfo { UserId = departmentInput.LeaderId, RoleId = roleInfos.Where(r => r.RoleName.Contains("部门领导")).FirstOrDefault().RoleId }; _dbContext.Set <RUserRoleInfo>().Add(rUserRole); _dbContext.Set <DepartmentInfo>().Add(newDepartment); if (_dbContext.SaveChanges() > 0) { message = "添加成功!"; return(true); } else { message = "添加失败!内部出现异常!"; return(false); } } catch (Exception ex) { message = "错误信息为:" + ex.Message; if (ex.InnerException != null) { message += "详细错误信息:" + ex.InnerException.Message; } return(false); } } message = "此人已是" + info.DepartmentName + "的领导!"; return(false); } message = "该部门名已被使用!"; return(false); } message = "已存在该部门ID,请检查部门ID!"; return(false); }
/// <summary> /// 数据转换 /// </summary> /// <param name="import"></param> /// <returns></returns> protected override EmployeeInfo Tran(EmployeesImportDetail import) { // 转换对象基本信息 // 性别 UserGender gender = UserGender.None; import.Gender = import.Gender.Trim(); if (import.Gender.Contains("女") || import.Gender == "0" || import.Gender == "false") { gender = UserGender.Female; } if (import.Gender.Contains("男") || import.Gender == "1" || import.Gender == "true") { gender = UserGender.Male; } // 是否在职 bool isDelete = false; import.IsHoldJob = import.IsHoldJob.Trim(); if (import.IsHoldJob.Contains("是") || import.IsHoldJob == "1" || import.IsHoldJob == "true") { isDelete = false; } if (import.Gender.Contains("否") || import.Gender == "0" || import.Gender == "false") { isDelete = true; } EmployeeInfo info = new EmployeeInfo { OldId = import.Code, Code = import.Code, Name = import.Name, LogonAccount = import.LogonAccount, LogonPassword = import.LogonPassword, Gender = gender, IsDelete = isDelete, State = isDelete ? UserState.Disable : UserState.Enable }; // 获取部门 if (!string.IsNullOrWhiteSpace(import.Department)) { DepartmentService depService = ServiceLoader.GetService <DepartmentService>(); DepartmentInfo depInfo = depService.SearchQueryable().Where(e => e.Name == import.Department).FirstOrDefault(); if (depInfo != null) { info.Department = new SelectView { Id = depInfo.Id.ToString(), Name = depInfo.Name, Code = depInfo.Code }; info.ParentDepartment = new ParentDepartment { Id = depInfo.ParentId, Name = depInfo.ParentName, Ids = depInfo.ParentsIds }; } } // 获取角色 if (!string.IsNullOrWhiteSpace(import.Role)) { RoleService roleService = ServiceLoader.GetService <RoleService>(); RoleInfo roleInfo = roleService.SearchQueryable().Where(e => e.Name == import.Role).FirstOrDefault(); if (roleInfo != null) { info.Role = new SelectView { Id = roleInfo.Id.ToString(), Name = roleInfo.Name, Code = string.Empty }; } } // 返回信息 return(info); }
private string GetTitle(DepartmentInfo departmentInfo) { var treeItem = DepartmentTreeItem.CreateInstance(departmentInfo); return(treeItem.GetItemHtml(EDepartmentLoadingType.List, null, true)); }
public ActionResult Detail(int id) { DepartmentInfo info = DepartmentBLL.GetList(p => p.ID == id).FirstOrDefault(); return(View(info)); }
public async Task <IActionResult> List(DepartmentInfo departmentInfo) { var data = await departmentService.List(departmentInfo); return(JsonDateTime(data)); }
public bool Update(DepartmentInfo dep) { return(dal.Update(dep)); }
/// <summary> /// Load data of editing department. /// </summary> /// <param name="departmentObj">Department object</param> protected void LoadData(DepartmentInfo departmentObj) { txtDepartmentName.Text = departmentObj.DepartmentName; txtDepartmentDisplayName.Text = departmentObj.DepartmentDisplayName; }
/// <summary> /// Creates department. Called when the "Create department" button is pressed. /// </summary> private bool CreateDepartment() { // Create new department object DepartmentInfo newDepartment = new DepartmentInfo(); // Set the properties newDepartment.DepartmentDisplayName = "My new department"; newDepartment.DepartmentName = "MyNewDepartment"; newDepartment.DepartmentSiteID = CMSContext.CurrentSiteID; // Create the department DepartmentInfoProvider.SetDepartmentInfo(newDepartment); return true; }
/// <summary> /// calculate the area of rooms for each department /// </summary> /// <param name="departName">the department name</param> /// <param name="areaValue">the value of room area</param> public void CalculateDepartmentArea(String departName, Double areaValue) { //if the list is empty, add a new DepartmentArea instance if (0 == m_departmentInfos.Count) { // create a new instance of DepartmentArea struct and insert it to the list DepartmentInfo tmpDep = new DepartmentInfo(departName, 1, areaValue); m_departmentInfos.Add(tmpDep); } else { bool flag = false; // find whether the department exist in the project for (int i = 0; i < m_departmentInfos.Count; i++) { if (departName == m_departmentInfos[i].DepartmentName) { int newAmount = m_departmentInfos[i].RoomsAmount + 1; double tempValue = m_departmentInfos[i].DepartmentAreaValue + areaValue; DepartmentInfo tempInstance = new DepartmentInfo(departName, newAmount, tempValue); m_departmentInfos[i] = tempInstance; flag = true; } } // if a new department is found, // create a new instance of DepartmentArea struct and insert it to the list if (!flag) { DepartmentInfo tmpDep = new DepartmentInfo(departName, 1, areaValue); m_departmentInfos.Add(tmpDep); } } }
/// <summary> /// 修改部门信息 /// </summary> /// <param name="departmentInput">输入的信息</param> /// <param name="message">返回去的信息</param> /// <returns></returns> public bool UpdateDepartmentInfoById(DepartmentInput departmentInput, out string message) { IQueryable <RoleInfo> roleInfos = _dbContext.Set <RoleInfo>(); IQueryable <RUserRoleInfo> rUserRoleInfos = _dbContext.Set <RUserRoleInfo>(); IQueryable <DepartmentInfo> departmentInfos = _dbContext.Set <DepartmentInfo>(); DepartmentInfo department = departmentInfos.Where(d => d.DepartmentId == departmentInput.DepartmentId).FirstOrDefault();//是否存在该部门 if (department != null) { DepartmentInfo department1 = departmentInfos.Where(d => d.DepartmentName == departmentInput.DepartmentName).FirstOrDefault(); if (department1 == null || department.DepartmentName == departmentInput.DepartmentName) { DepartmentInfo info = departmentInfos.Where(l => l.LeaderId == departmentInput.LeaderId).FirstOrDefault(); //查询此人是否已是领导 if (info == null || info.LeaderId == department.LeaderId) { try { //获取部门领导这个角色的ID string roleId = roleInfos.Where(r => r.RoleName.Contains("部门领导")).FirstOrDefault().RoleId; //先移除原用户在该部门的领导角色 //找到这个人的部门领导角色的数据 RUserRoleInfo rUserRoleInfo = rUserRoleInfos.Where(r => r.UserId == department.LeaderId && r.RoleId == roleId).FirstOrDefault(); //如果该部门的原部门领导在角色信息表有部门领导角色,则删除,没有就证明是数据库手动添加的。直接跳过删除,直接赋值 if (rUserRoleInfo != null) { //挂起删除该条数据 _dbContext.Set <RUserRoleInfo>().Remove(rUserRoleInfo); } department.DepartmentName = departmentInput.DepartmentName; department.Description = departmentInput.Description; department.LeaderId = departmentInput.LeaderId; department.ParentId = departmentInput.ParentId; _dbContext.Set <DepartmentInfo>().Update(department); //为新的领导人配置角色权限 RUserRoleInfo newUserRoleInfo = new RUserRoleInfo { UserId = departmentInput.LeaderId, RoleId = roleId }; _dbContext.Set <RUserRoleInfo>().Add(newUserRoleInfo); if (_dbContext.SaveChanges() > 0) { message = "修改成功!"; return(true); } message = "修改失败!内部出现异常!"; return(false); } catch (Exception ex) { message = ex.Message; return(false); } } message = "此人已是" + info.DepartmentName + "的领导!"; return(false); } message = "此部门名称已被使用!"; return(false); } message = "内部错误!数据可能被篡改!"; return(false); }
protected override void RunTest(PlanSetup plan) { DisplayName = "CT Sim"; ResultDetails = ""; TestExplanation = "Checks that the correct CT is chosen for the image series based on what treatment unit is used for planning\nWarning: This will not correctly account for patients simmed at one facility and treated at another"; string ct = plan.StructureSet.Image.Series.ImagingDeviceId; if (!DepartmentInfo.GetCTIDs(Department).Contains(ct)) { Result = "Warning"; ResultDetails = $"Patient is being treated on {MachineID}, but the {String.Join(" or ", DepartmentInfo.GetCTIDs(Department))} was not chosen as the imaging device for the series, please check"; ResultDetails += $"\nSelected CT: {ct}\n"; DisplayColor = ResultColorChoices.Warn; } if (ResultDetails == "") { Result = ""; ResultDetails = ct; DisplayColor = ResultColorChoices.Pass; } ResultDetails = ResultDetails.TrimEnd('\n'); }