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_OK_Click(object sender, EventArgs e)
    {
        Org_StaffBLL _staffbll = null;

        if ((int)ViewState["ID"] == 0)
        {
            _staffbll = new Org_StaffBLL();
        }
        else
        {
            _staffbll = new Org_StaffBLL((int)ViewState["ID"]);
        }

        int oldPosition     = _staffbll.Model.Position;
        int oldOrganizeCity = _staffbll.Model.OrganizeCity;

        panel1.GetData(_staffbll.Model);

        if ((int)ViewState["ID"] != 0 && (oldPosition != _staffbll.Model.Position || oldOrganizeCity != _staffbll.Model.OrganizeCity) &&
            EWF_Task_JobDecisionBLL.GetModelList("DecisionResult=1 AND RecipientStaff=" + ViewState["ID"].ToString()).Count > 0)
        {
            MessageBox.Show(this, "对不起,该人员还有未审批流程不能调整【职务】或【管理片区】信息!");
            return;
        }
        Addr_OfficialCityBLL citybll = new Addr_OfficialCityBLL(_staffbll.Model.OfficialCity);

        if (citybll != null && citybll.Model.Level < 2)
        {
            MessageBox.Show(this, "驻点所在城市必须选到市级!");
            return;
        }

        Org_Staff _staffM = new Org_StaffBLL((int)Session["UserID"]).Model;

        if (_staffM.Position == _staffbll.Model.Position && new Org_PositionBLL(_staffM.Position).Model.IsHeadOffice != "Y")
        {
            MessageBox.Show(this, "对不起,您没有权限新增职位与您相同的员工");
            return;
        }

        if (_staffbll.Model["OperateProperty"] == "0")
        {
            MessageBox.Show(this, "归属办事处类型必填!");
            return;
        }

        if ((int)ViewState["ID"] == 0)
        {
            #region 根据身份证号判断是否重复
            if (_staffbll.Model["IDCode"] != string.Empty &&
                Org_StaffBLL.GetStaffList("MCS_SYS.dbo.UF_Spilt(Org_Staff.ExtPropertys,'|',1)='" + _staffbll.Model["IDCode"] + "' AND Dimission=1").Count > 0)
            {
                MessageBox.Show(this, "对不起,该身份证号的员工已在系统中入职,请核实后再新增员工!");
                return;
            }
            #endregion

            if (Org_StaffNumberLimitBLL.CheckAllowAdd(_staffbll.Model.OrganizeCity, _staffbll.Model.Position) <= 0)
            {
                MessageBox.Show(this, "对不起当前城市该职位员工人数满额,要想继续新增请与人事经理联系");
                return;
            }
            _staffbll.Model.InsertStaff = (int)Session["UserID"];
            _staffbll.Model.InsertTime  = DateTime.Now;
            _staffbll.Model.ApproveFlag = 1;            //未审批
            _staffbll.Model.Dimission   = 1;            //在职
            ViewState["ID"]             = _staffbll.Add();
        }
        else
        {
            if (!Org_StaffNumberLimitBLL.IsSameLimit(oldOrganizeCity, _staffbll.Model.OrganizeCity, oldPosition, _staffbll.Model.Position) &&
                Org_StaffNumberLimitBLL.CheckAllowAdd(_staffbll.Model.OrganizeCity, _staffbll.Model.Position) <= 0)
            {
                MessageBox.Show(this, "对不起当前城市该职位员工人数满额,要想继续新增请与人事经理联系");
                return;
            }
            _staffbll.Model.UpdateStaff = (int)Session["UserID"];
            _staffbll.Update();
        }
        MessageBox.ShowAndRedirect(this, "保存成功", "StaffDetail.aspx?ID=" + ViewState["ID"].ToString());
    }
示例#3
0
    //绑定开始环节详细信息
    private void BindTaskInfo()
    {
        EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]);

        #region 如果任务在待审批状态,且正好是待当前人审批,则直接切换到审批页面
        if (task.Model.Status == 3)
        {
            int job = EWF_TaskBLL.StaffCanApproveTask(task.Model.ID, (int)Session["UserID"]);
            if (job > 0)
            {
                Response.Redirect("Recipient.aspx?CurrentJobID=" + job.ToString() + "&TaskID=" + task.Model.ID.ToString());
            }
        }
        #endregion

        EWF_Flow_App app = new EWF_Flow_AppBLL(task.Model.App).Model;

        #region 绑定流程信息
        lbl_ID.Text      = task.Model.ID.ToString();
        lbl_Applyer.Text = new Org_StaffBLL(task.Model.Initiator).Model.RealName;
        lbl_AppName.Text = app.Name;

        lbl_Applyer_Position.Text = new Org_PositionBLL(new Org_StaffBLL(task.Model.Initiator).Model.Position).Model.Name;

        lbl_Title.Text = task.Model.Title;
        lb_Status.Text = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name;

        lb_StartTime.Text = task.Model.StartTime.ToString();
        if (task.Model.EndTime != new DateTime(1900, 1, 1))
        {
            lb_EndTime.Text = task.Model.EndTime.ToString();
        }
        else
        {
            lb_EndTime.Text = "未结束";
        }

        lt_Remark.Text = task.Model.Remark;

        #region 绑定流程当前环节信息
        if (task.Model.Status < 5)
        {
            IList <EWF_Task_Job> jobs = EWF_Task_JobBLL.GetModelList("Task=" + task.Model.ID.ToString() + " ORDER BY StartTime DESC");
            if (jobs.Count > 0)
            {
                EWF_Flow_Process process = new EWF_Flow_ProcessBLL(jobs[0].CurrentProcess).Model;
                if (process != null)
                {
                    lb_CurrentJobInfo.Text = process.Name;
                    if (process.Type == 3)
                    {
                        lb_CurrentJobInfo.Text += " 等待审批人:";
                        foreach (EWF_Task_JobDecision decision in EWF_Task_JobDecisionBLL.GetModelList("Job=" + jobs[0].ID.ToString()))
                        {
                            MCSFramework.Model.Org_Staff staff = new Org_StaffBLL(decision.RecipientStaff).Model;
                            if (staff != null)
                            {
                                lb_CurrentJobInfo.Text += staff.RealName + "   ";
                            }
                        }
                    }
                }
            }
        }
        else
        {
            tr_CurrentProcessInfo.Visible = false;
        }
        #endregion

        #endregion

        #region 控制流程状态
        if (task.Model.Initiator == (int)Session["UserID"])
        {
            //只有流程发起的本人,才可控制流程状态

            if (task.Model.Status == 6)
            {
                MessageBox.Show(this, "您的流程因故停止流转,请尽快联系系统管理员排查原因,或点击“继续执行”按钮以重新启动流程的流转!");
                bt_Restart.Visible = true;
            }

            if (task.Model.Status == 4)
            {
                MessageBox.Show(this, "您的流程被最后一审批人设为了待处理状态,请补充相关信息附件后,或点击“继续执行”按钮以重新启动流程的流转!");
                bt_Restart.Visible = true;
            }

            if (task.Model.Status == 1)
            {
                MessageBox.Show(this, "您的流程还没正式发起申请,请尽快点击“确定发起”按钮以发起流程!");
                btn_Start.Visible = true;
            }

            if (task.Model.Status != 5)
            {
                //未完成
                if (app.RelateBusiness == "N")
                {
                    bt_Cancel.Visible = true;
                }
                tr_UploadAtt.Visible = true;
            }
        }
        #endregion

        #region 显示申请详细信息IFrame
        //显示申请详细信息IFrame
        if (!string.IsNullOrEmpty(task.Model.RelateURL))
        {
            hyl_RelateURL.NavigateUrl = task.Model.RelateURL;
            tr_RelateUrl.Visible      = true;
            string url = this.ResolveClientUrl(task.Model.RelateURL);
            if (url.IndexOf('?') >= 0)
            {
                url += "&ViewFramework=False";
            }
            else
            {
                url += "?ViewFramework=False";
            }
            frame_relateurl.Attributes.Add("src", url);
        }
        else
        {
            tr_RelateUrl.Visible  = false;
            hyl_RelateURL.Visible = false;
        }
        #endregion


        //Bind the dataobject info
        pl_dataobjectinfo.BindData(task.Model.DataObjectValues);
        if (task.Model.Status > 1)
        {
            pl_dataobjectinfo.SetPanelEnable(false);

            TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null;
            if (tbx_ReMark != null)
            {
                tbx_ReMark.Enabled  = true;
                tbx_ReMark.ReadOnly = true;
            }
        }

        //绑定环节列表
        gv_List_JobList.BindGrid <EWF_Task_Job>(task.GetJobList());
    }