예제 #1
0
    private void BindFormData()
    {
        try
        {
            CadresOrRemovalInfo obj = Aitems.Get(FormID);
            if (obj != null)
            {
                InitApproveList2(obj.IsGroup);
                tbReportCode.Text              = obj.FormID;
                tbCadresName.Text              = obj.CadresName;
                tbLocationCompanyDeptJob.Text  = obj.LocationCompanyDeptJob;
                tbCadresCompanyDeptJob.Text    = obj.CadresCompanyDeptJob;
                tbCadresContent.Text           = obj.CadresContent;
                tbRemovalName.Text             = obj.RemovalName;
                tbLocationCompanyDeptJobR.Text = obj.LocationCompanyDeptJobR;
                tbRemovalCompanyDeptjob.Text   = obj.RemovalCompanyDeptjob;
                tbRemovalContent.Text          = obj.RemovalContent;
                lblApprovers.Text              = obj.LeadersSelected;

                if (!string.IsNullOrEmpty(obj.chkCadresOrRemoval))
                {
                    tbCadre.Visible   = obj.chkCadresOrRemoval != "1" ? true : false;
                    tbRemoval.Visible = obj.chkCadresOrRemoval != "0" ? true : false;
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
예제 #2
0
    private CadresOrRemovalInfo SaveData(string ID, string wfStatus)
    {
        SaveWFParams();
        CadresOrRemovalInfo obj = null;

        try
        {
            UploadAttachments1.SaveAttachment(ViewState["FormID"].ToString());
            obj = Eitems.Get(ID);
            bool isEdit = false;
            if (obj == null)
            {
                obj         = new CadresOrRemovalInfo();
                obj.FormID  = ViewState["FormID"].ToString();
                obj.IsGroup = hfIsGroup.Value;
            }
            else
            {
                isEdit     = true;
                obj.FormID = ViewState["FormID"].ToString();
            }
            if (chkCadresOrRemoval.SelectedIndex != -1)
            {
                obj.chkCadresOrRemoval = chkCadresOrRemoval.SelectedValue.ToString();
            }
            obj.CadresName              = tbCadresName.Text;
            obj.CadresCompanyDeptJob    = tbCadresCompanyDeptJob.Text;
            obj.LocationCompanyDeptJob  = tbLocationCompanyDeptJob.Text;
            obj.CadresContent           = tbCadresContent.Text;
            obj.RemovalName             = tbRemovalName.Text;
            obj.RemovalCompanyDeptjob   = tbRemovalCompanyDeptjob.Text;
            obj.LocationCompanyDeptJobR = tbLocationCompanyDeptJobR.Text;
            obj.RemovalContent          = tbRemovalContent.Text;
            //obj.ApproveStatus = wfStatus;
            obj.LeadersSelected = lblApprovers.Text;

            if (!isEdit)
            {
                Eitems.Insert(obj);
            }
            else
            {
                Eitems.Update(obj);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return(obj);
    }
예제 #3
0
    private void BindFormData()
    {
        try
        {
            WorkFlowInstance Instance = wf_WorkFlowInstance.GetWorkFlowInstanceById(ViewState["InstanceID"].ToString());
            if (Instance == null)
            {
                ExceptionHander.GoToErrorPage("记录不存在");
            }
            CadresOrRemovalInfo obj = Vitems.Get(Instance.FormId.ToString());
            if (obj == null)
            {
                ExceptionHander.GoToErrorPage("记录不存在");
            }
            if (obj != null)
            {
                InitApproveList2(obj.IsGroup);
                tbReportCode.Text              = obj.FormID;
                tbCadresName.Text              = obj.CadresName;
                tbLocationCompanyDeptJob.Text  = obj.LocationCompanyDeptJob.Replace(" ", "&nbsp;").Replace("\n", "<br/>");
                tbCadresCompanyDeptJob.Text    = obj.CadresCompanyDeptJob.Replace(" ", "&nbsp;").Replace("\n", "<br/>");
                tbCadresContent.Text           = obj.CadresContent.Replace(" ", "&nbsp;").Replace("\n", "<br/>");
                tbRemovalName.Text             = obj.RemovalName;
                tbLocationCompanyDeptJobR.Text = obj.LocationCompanyDeptJobR.Replace(" ", "&nbsp;").Replace("\n", "<br/>");
                tbRemovalCompanyDeptjob.Text   = obj.RemovalCompanyDeptjob.Replace(" ", "&nbsp;").Replace("\n", "<br/>");
                tbRemovalContent.Text          = obj.RemovalContent.Replace(" ", "&nbsp;").Replace("\n", "<br/>");

                if (!string.IsNullOrEmpty(obj.chkCadresOrRemoval))
                {
                    tbCadre.Visible   = obj.chkCadresOrRemoval != "1" ? true : false;
                    tbRemoval.Visible = obj.chkCadresOrRemoval != "0" ? true : false;
                }
            }
            UploadAttachments1.ProcId = ViewState["InstanceID"].ToString();

            OpinionDeptManager.InstanceId   = ViewState["InstanceID"].ToString();
            OpinionHRDeptManager.InstanceId = ViewState["InstanceID"].ToString();
            OpinionDirector1.InstanceId     = ViewState["InstanceID"].ToString();
            OpinionDirector2.InstanceId     = ViewState["InstanceID"].ToString();
            OpinionDirector3.InstanceId     = ViewState["InstanceID"].ToString();
            OpinionDirector4.InstanceId     = ViewState["InstanceID"].ToString();
            OpinionChairman.InstanceId      = ViewState["InstanceID"].ToString();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
예제 #4
0
    private void SaveData(string ID, string wfStatus)
    {
        CadresOrRemovalInfo obj = null;

        try
        {
            obj        = Aitems.Get(ID);
            obj.FormID = ViewState["FormID"].ToString();

            Aitems.Update(obj);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
예제 #5
0
    protected void Save_Click(object sender, EventArgs e)
    {
        string id = ViewState["FormID"].ToString();
        CadresOrRemovalInfo obj = SaveData(id, "00");

        if (obj != null)
        {
            if (SaveWorkFlowInstance(obj, "0", null, ""))
            {
                Alert(Page, "保存成功!");
            }
        }
        else
        {
            Alert(Page, "保存失败");
        }
    }
예제 #6
0
    private void BindFormData()
    {
        try
        {
            CadresOrRemovalInfo obj = Eitems.Get(ViewState["FormID"].ToString());
            InitApproveList2(obj.IsGroup);
            tbReportCode.Text = obj.FormID;
            chkCadresOrRemoval.SelectedValue = obj.chkCadresOrRemoval != null?obj.chkCadresOrRemoval.ToString() : "-1";

            tbCadresName.Text              = obj.CadresName;
            tbLocationCompanyDeptJob.Text  = obj.LocationCompanyDeptJob;
            tbCadresCompanyDeptJob.Text    = obj.CadresCompanyDeptJob;
            tbCadresContent.Text           = obj.CadresContent;
            tbRemovalName.Text             = obj.RemovalName;
            tbLocationCompanyDeptJobR.Text = obj.LocationCompanyDeptJobR;
            tbRemovalCompanyDeptjob.Text   = obj.RemovalCompanyDeptjob;
            tbRemovalContent.Text          = obj.RemovalContent;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
예제 #7
0
    private void InitLeader()
    {
        BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment();
        DataTable dtHRDeptManager     = bfurd.GetSelectRoleUser(HRDeptCode, "部门负责人");
        DataTable dtChairman          = bfurd.GetSelectRoleUser(GroupCode, "董事长");
        DataTable dtDeptManagers      = bfurd.GetSelectRoleUser(GroupCode, "部门总成员");
        DataTable dtDirectors         = bfurd.GetSelectRoleUser(GroupCode, "总办会成员");

        if (dtHRDeptManager.Rows.Count != 0)
        {
            lbHRDeptManager.Text = "(" + dtHRDeptManager.Rows[0]["EmployeeName"].ToString() + ")审核";
        }
        if (dtChairman.Rows.Count != 0)
        {
            lbChairman.Text = "(" + dtChairman.Rows[0]["EmployeeName"].ToString() + ")审批";
        }

        if (string.IsNullOrEmpty(Request.QueryString["id"]))
        {
            foreach (DataRow user in dtDeptManagers.Rows)
            {
                ListItem li = new ListItem();
                li.Value = "K2:Founder\\" + user["LoginName"].ToString();
                li.Text  = user["EmployeeName"].ToString();
                if (!cblDeptManager.Items.Contains(li))
                {
                    cblDeptManager.Items.Add(li);
                }
            }

            foreach (DataRow user in dtDirectors.Rows)
            {
                ListItem li = new ListItem();
                li.Value = "K2:Founder\\" + user["LoginName"].ToString();
                li.Text  = user["EmployeeName"].ToString();
                if (!cblDirector1.Items.Contains(li))
                {
                    cblDirector1.Items.Add(li);
                }
                if (!cblDirector2.Items.Contains(li))
                {
                    cblDirector2.Items.Add(li);
                }
                if (!cblDirector3.Items.Contains(li))
                {
                    cblDirector3.Items.Add(li);
                }
                if (!cblDirector4.Items.Contains(li))
                {
                    cblDirector4.Items.Add(li);
                }
            }
        }
        else
        {
            XmlDocument         xmldoc       = new XmlDocument();
            CadresOrRemovalInfo formDataInfo = Eitems.Get(FormId);
            if (!string.IsNullOrEmpty(formDataInfo.LeadersSelected))
            {
                xmldoc.LoadXml(formDataInfo.LeadersSelected);
            }

            InitCheckboxlist(xmldoc, "Director1", cblDirector1);
            InitCheckboxlist(xmldoc, "Director2", cblDirector2);
            InitCheckboxlist(xmldoc, "Director3", cblDirector3);
            InitCheckboxlist(xmldoc, "Director4", cblDirector4);
            InitCheckboxlist(xmldoc, "DeptManager", cblDeptManager);
        }
    }
예제 #8
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        string SaveVerification = SaveWFParams();

        if (string.IsNullOrEmpty(SaveVerification))
        {
            return;
        }
        NameValueCollection dataFields = SetWFParams();

        int    wfInstanceId = 0; //process instance id
        string id           = ViewState["FormID"].ToString();

        CadresOrRemovalInfo obj = SaveData(id, "02");

        if (obj != null)
        {
            //开启流程
            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            WorkflowHelper.StartProcess(@"K2Workflow\HR_CadresOrRemoval", id, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                if (SaveWorkFlowInstance(obj, "1", DateTime.Now, wfInstanceId.ToString()))
                {
                    if (Eitems.UpdateStatus(id, "02"))
                    {
                        string           Opinion          = "";
                        string           ApproveResult    = "同意";
                        string           OpinionType      = "";
                        string           IsSign           = "0";
                        string           DelegateUserName = "";
                        string           DelegateUserCode = "";
                        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(obj.FormID);

                        var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
                        {
                            ApprovalID = Guid.NewGuid().ToString(),

                            FormID            = id,
                            InstanceID        = workFlowInstance.InstanceId,
                            Opinion           = Opinion,
                            ApproveAtTime     = DateTime.Now,
                            ApproveByUserCode = CurrentEmployee.EmployeeCode,
                            ApproveByUserName = CurrentEmployee.EmployeeName,
                            ApproveResult     = ApproveResult,
                            OpinionType       = OpinionType,
                            CurrentActiveName = "拟稿",
                            ISSign            = IsSign,

                            DelegateUserName = DelegateUserName,
                            DelegateUserCode = DelegateUserCode,
                            CreateAtTime     = DateTime.Now,
                            CreateByUserCode = CurrentEmployee.EmployeeCode,
                            CreateByUserName = CurrentEmployee.EmployeeName,
                            UpdateAtTime     = DateTime.Now,
                            UpdateByUserCode = CurrentEmployee.EmployeeCode,
                            UpdateByUserName = CurrentEmployee.EmployeeName,
                            FinishedTime     = DateTime.Now
                        };
                        BFApprovalRecord bfApproval = new BFApprovalRecord();
                        bfApproval.AddApprovalRecord(appRecord);
                    }
                }
            }
        }
        ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');", true);
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null; window.open('', '_self', '');window.close();", true);
    }
예제 #9
0
    private bool SaveWorkFlowInstance(CadresOrRemovalInfo obj, string WfStatus, DateTime?SumitTime, string WfInstanceId)
    {
        bool             result           = false;
        WorkFlowInstance workFlowInstance = null;

        try
        {
            workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(obj.FormID);
            bool isEdit = false;
            if (workFlowInstance == null)
            {
                workFlowInstance                  = new WorkFlowInstance();
                workFlowInstance.InstanceId       = Guid.NewGuid().ToString();
                workFlowInstance.CreateDeptCode   = CurrentEmployee.DepartCode;
                workFlowInstance.CreateDeptName   = CurrentEmployee.DepartName;
                workFlowInstance.CreateAtTime     = DateTime.Now;
                workFlowInstance.CreateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.CreateByUserName = CurrentEmployee.EmployeeName;
                workFlowInstance.AppId            = "3013";
            }
            else
            {
                workFlowInstance.CreateAtTime     = DateTime.Now;
                workFlowInstance.UpdateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.UpdateByUserName = CurrentEmployee.EmployeeName;
                isEdit = true;
            }
            workFlowInstance.FormId = obj.FormID;
            if (chkCadresOrRemoval.SelectedIndex == 0)
            {
                workFlowInstance.FormTitle = tbCadresName.Text + "的干部任职审批表";
            }
            else if (chkCadresOrRemoval.SelectedIndex == 1)
            {
                workFlowInstance.FormTitle = tbRemovalName.Text + "的干部免职审批表";
            }
            else
            {
                workFlowInstance.FormTitle = tbCadresName.Text + "的干部任职和" + tbRemovalName.Text + "的干部免职审批表";
            }
            workFlowInstance.WfStatus = WfStatus;
            if (SumitTime != null)
            {
                workFlowInstance.SumitTime = SumitTime;
            }

            if (WfInstanceId != "")
            {
                workFlowInstance.WfInstanceId = WfInstanceId;
            }

            if (!isEdit)
            {
                result = wf_WorkFlowInstance.AddWorkFlowInstance(workFlowInstance);
            }
            else
            {
                result = wf_WorkFlowInstance.UpdateWorkFlowInstance(workFlowInstance);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(result);
    }