protected void bt_AddApply_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] == 0) { MessageBox.Show(this, "对不起,请您先保存后在发起申请"); return; } Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]); NameValueCollection dataobjects = new NameValueCollection(); dataobjects.Add("ID", ViewState["ID"].ToString()); dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString()); dataobjects.Add("Position", bll.Model.Position.ToString()); dataobjects.Add("SalaryFlag", bll.Model["SalaryFlag"].ToString()); dataobjects.Add("StaffName", bll.Model.RealName.ToString()); int TaskID = EWF_TaskBLL.NewTask("Add_Staff", (int)Session["UserID"], "人员入职流程,姓名:" + bll.Model.RealName, "~/SubModule/StaffManage/StaffDetail.aspx?ID=" + ViewState["ID"].ToString(), dataobjects); if (TaskID > 0) { bll.Model["TaskID"] = TaskID.ToString(); bll.Model["State"] = "2"; bll.Update(); } Response.Redirect("~/SubModule/EWF/Apply.aspx?TaskID=" + TaskID.ToString()); }
protected void bt_AddApply_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] == 0) { MessageBox.Show(this, "对不起,请您先保存后在发起申请"); return; } Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]); if (Org_StaffNumberLimitBLL.CheckAllowAdd(bll.Model.OrganizeCity, bll.Model.Position) < 0) { MessageBox.Show(this, "对不起当前城市该职位员工人数满额,要想继续新增请与人事经理联系"); return; } int budget = Org_StaffNumberLimitBLL.CheckOverBudget(bll.Model.OrganizeCity, bll.Model.Position); NameValueCollection dataobjects = new NameValueCollection(); dataobjects.Add("ID", ViewState["ID"].ToString()); dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString()); dataobjects.Add("Position", bll.Model.Position.ToString()); dataobjects.Add("SalaryFlag", bll.Model["SalaryFlag"].ToString()); dataobjects.Add("StaffName", bll.Model.RealName.ToString()); dataobjects.Add("IsOverBudget", budget < 0 ? "1" : "2"); int TaskID = EWF_TaskBLL.NewTask("Add_Staff", (int)Session["UserID"], "人员入职流程,姓名:" + bll.Model.RealName, "~/SubModule/StaffManage/StaffDetail.aspx?ID=" + ViewState["ID"].ToString(), dataobjects); if (TaskID > 0) { bll.Model["TaskID"] = TaskID.ToString(); bll.Model["State"] = "2"; bll.Update(); } Response.Redirect("~/SubModule/EWF/Apply.aspx?TaskID=" + TaskID.ToString()); }
protected void bt_DeleteUser_Click(object sender, EventArgs e) { Org_StaffBLL staff = new Org_StaffBLL((int)ViewState["ID"]); if (staff.Model == null) return; Membership.DeleteUser(lb_Username.Text, true); staff.Model.aspnetUserId = Guid.Empty; staff.Update(); Response.Redirect("StaffList.aspx"); }
protected void bt_DeleteUser_Click(object sender, EventArgs e) { Org_StaffBLL staff = new Org_StaffBLL((int)ViewState["ID"]); if (staff.Model == null) { return; } Membership.DeleteUser(lb_Username.Text, true); staff.Model.aspnetUserId = Guid.Empty; staff.Update(); Response.Redirect("StaffList.aspx"); }
protected void bt_CreateUser_Click(object sender, EventArgs e) { string UserName = "", Password = "", PositionName = ""; Org_StaffBLL staff = new Org_StaffBLL((int)ViewState["ID"]); if (staff.Model == null) return; if (staff.Model.aspnetUserId != null && staff.Model.aspnetUserId != Guid.Empty) return; PositionName = new Org_PositionBLL(staff.Model.Position).Model.Name; CM_ClientBLL tdp = new CM_ClientBLL((int)Session["OwnerClient"]); CM_ClientManufactInfo manufactinfo = tdp.GetManufactInfo(tdp.Model.OwnerClient); if (tdp.Model == null) return; //用户名默认为当前:TDP代码-员工姓名 if (manufactinfo != null && !string.IsNullOrEmpty(manufactinfo.Code)) UserName = manufactinfo.Code; else if (!string.IsNullOrEmpty(tdp.Model.Code)) UserName = tdp.Model.Code; else UserName = tdp.Model.ID.ToString(); UserName += "-" + staff.Model.RealName; if (Membership.GetUser(UserName) != null) UserName += staff.Model.ID.ToString(); //密码默认为员工手机号码,为空时则为123456 Password = staff.Model.Mobile.Trim(); if (Password == "") Password = "******"; //创建用户,并加入角色 MembershipUser u = Membership.CreateUser(UserName, Password); foreach (string rolename in Roles.GetAllRoles().Where(p => p.StartsWith("TDP"))) { if (rolename == PositionName) { Roles.AddUserToRole(u.UserName, rolename); } } UserBLL.Membership_SetStaffID(u.UserName, staff.Model.ID); staff.Model.aspnetUserId = (Guid)u.ProviderUserKey; staff.Update(); MessageBox.ShowAndRedirect(this, "用户创建成功!【用户名:" + UserName + ",初始密码:" + Password + "】", "StaffList.aspx"); }
/// <summary> /// 审核 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bt_Approve_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] != 0) { Org_StaffBLL _staff = new Org_StaffBLL((int)ViewState["ID"]); if (Org_StaffNumberLimitBLL.CheckAllowAdd(_staff.Model.OrganizeCity, _staff.Model.Position) < 0) { MessageBox.Show(this, "对不起当前城市该职位员工人数满额,要想继续新增请与人事经理联系"); return; } _staff.Model.ApproveFlag = 1; _staff.Model.UpdateStaff = (int)Session["UserID"]; _staff.Update(); MessageBox.Show(this, "审核成功!"); BindData(); } }
/// <summary> /// 审核 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bt_Approve_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] != 0) { Org_StaffBLL _staff = new Org_StaffBLL((int)ViewState["ID"]); if (Org_StaffNumberLimitBLL.CheckAllowAdd(_staff.Model.OrganizeCity, _staff.Model.Position) < 0) { MessageBox.Show(this, "对不起当前城市该职位员工人数满额,要想继续新增请与人事经理联系"); return; } _staff.Model.ApproveFlag = 1; _staff.Model.UpdateStaff = (int)Session["UserID"]; _staff.Update(); MessageBox.Show(this, "审核成功!"); BindData(); } }
protected void bt_RevocationApply_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] == 0) { MessageBox.Show(this, "对不起,请您先保存后在发起申请"); return; } //判断是否还有未审批流程 if (EWF_Task_JobDecisionBLL.GetModelList("DecisionResult=1 AND RecipientStaff=" + ViewState["ID"].ToString()).Count > 0) { MessageBox.Show(this, "对不起,该人员还有未审批流程,暂不能发起离职流程!"); return; } Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]); NameValueCollection dataobjects = new NameValueCollection(); dataobjects.Add("ID", ViewState["ID"].ToString()); dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString()); dataobjects.Add("Position", bll.Model.Position.ToString()); dataobjects.Add("StaffName", bll.Model.RealName.ToString()); int TaskID = EWF_TaskBLL.NewTask("Revocation_Staff", (int)Session["UserID"], TreeTableBLL.GetSuperNameByLevel("MCS_SYS.dbo.Addr_OrganizeCity", "ID", "Name", "SuperID", bll.Model.OrganizeCity, ConfigHelper.GetConfigInt("OrganizePartCity-CityLevel")) + " " + TreeTableBLL.GetSuperNameByLevel("MCS_SYS.dbo.Addr_OrganizeCity", "ID", "Name", "SuperID", bll.Model.OrganizeCity, ConfigHelper.GetConfigInt("OrganizeCity-CityLevel")) + " " + new Org_PositionBLL(bll.Model.Position).Model.Name + " " + bll.Model.RealName + " 离职申请", "~/SubModule/StaffManage/StaffDetail.aspx?ID=" + ViewState["ID"].ToString(), dataobjects); if (TaskID > 0) { bll.Model["TaskID"] = TaskID.ToString(); bll.Model["State"] = "2"; bll.Update(); } Response.Redirect("~/SubModule/EWF/Apply.aspx?TaskID=" + TaskID.ToString()); }
protected void bt_RevocationApply_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] == 0) { MessageBox.Show(this, "对不起,请您先保存后在发起申请"); return; } //判断是否还有未审批流程 if (EWF_Task_JobDecisionBLL.GetModelList("DecisionResult=1 AND RecipientStaff=" + ViewState["ID"].ToString()).Count > 0) { MessageBox.Show(this, "对不起,该人员还有未审批流程,暂不能发起离职流程!"); return; } Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]); NameValueCollection dataobjects = new NameValueCollection(); dataobjects.Add("ID", ViewState["ID"].ToString()); dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString()); dataobjects.Add("Position", bll.Model.Position.ToString()); dataobjects.Add("StaffName", bll.Model.RealName.ToString()); int TaskID = EWF_TaskBLL.NewTask("Revocation_Staff", (int)Session["UserID"], TreeTableBLL.GetSuperNameByLevel("MCS_SYS.dbo.Addr_OrganizeCity", "ID", "Name", "SuperID", bll.Model.OrganizeCity, ConfigHelper.GetConfigInt("OrganizePartCity-CityLevel")) + " " + TreeTableBLL.GetSuperNameByLevel("MCS_SYS.dbo.Addr_OrganizeCity", "ID", "Name", "SuperID", bll.Model.OrganizeCity, ConfigHelper.GetConfigInt("OrganizeCity-CityLevel")) + " " + new Org_PositionBLL(bll.Model.Position).Model.Name + " " + bll.Model.RealName + " 离职申请", "~/SubModule/StaffManage/StaffDetail.aspx?ID=" + ViewState["ID"].ToString(), dataobjects); if (TaskID > 0) { bll.Model["TaskID"] = TaskID.ToString(); bll.Model["State"] = "2"; bll.Update(); } Response.Redirect("~/SubModule/EWF/Apply.aspx?TaskID=" + TaskID.ToString()); }
protected void bt_CreateUser_Click(object sender, EventArgs e) { string UserName = "", Password = "", PositionName = ""; Org_StaffBLL staff = new Org_StaffBLL((int)ViewState["ID"]); if (staff.Model == null) { return; } if (staff.Model.aspnetUserId != null && staff.Model.aspnetUserId != Guid.Empty) { return; } PositionName = new Org_PositionBLL(staff.Model.Position).Model.Name; CM_ClientBLL tdp = new CM_ClientBLL((int)Session["OwnerClient"]); CM_ClientManufactInfo manufactinfo = tdp.GetManufactInfo(tdp.Model.OwnerClient); if (tdp.Model == null) { return; } //用户名默认为当前:TDP代码-员工姓名 if (manufactinfo != null && !string.IsNullOrEmpty(manufactinfo.Code)) { UserName = manufactinfo.Code; } else if (!string.IsNullOrEmpty(tdp.Model.Code)) { UserName = tdp.Model.Code; } else { UserName = tdp.Model.ID.ToString(); } UserName += "-" + staff.Model.RealName; if (Membership.GetUser(UserName) != null) { UserName += staff.Model.ID.ToString(); } //密码默认为员工手机号码,为空时则为123456 Password = staff.Model.Mobile.Trim(); if (Password == "") { Password = "******"; } //创建用户,并加入角色 MembershipUser u = Membership.CreateUser(UserName, Password); foreach (string rolename in Roles.GetAllRoles().Where(p => p.StartsWith("TDP"))) { if (rolename == PositionName) { Roles.AddUserToRole(u.UserName, rolename); } } UserBLL.Membership_SetStaffID(u.UserName, staff.Model.ID); staff.Model.aspnetUserId = (Guid)u.ProviderUserKey; staff.Update(); MessageBox.ShowAndRedirect(this, "用户创建成功!【用户名:" + UserName + ",初始密码:" + Password + "】", "StaffList.aspx"); }