Esempio n. 1
0
    private void BindFormData()
    {
        try
        {
            SealOfBCInfo obj  = Eitems.Get(ViewState["FormID"].ToString());
            ListItem     item = ddlDepartName.Items.FindByValue(obj.DeptCode);
            if (item != null)
            {
                ddlDepartName.SelectedIndex = ddlDepartName.Items.IndexOf(item);
            }
            tbReportCode.Text              = obj.FormID;
            tbUserName.Text                = obj.UserName;
            tbMobile.Text                  = obj.Mobile;
            tbTitle.Text                   = obj.Title;
            tbDateTime.Text                = obj.DateTime;
            tbContent.Text                 = obj.Content;
            UpdatedTextBox.Value           = obj.DateTime;
            cblSecurityLevel.SelectedValue = obj.SecurityLevel != null?obj.SecurityLevel.ToString() : "-1";

            cblUrgenLevel.SelectedValue = obj.UrgenLevel != null?obj.UrgenLevel.ToString() : "-1";
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Esempio n. 2
0
    private void BindFormData()
    {
        try
        {
            SealOfBCInfo obj = Aitems.Get(FormID);
            if (obj != null)
            {
                tbReportCode.Text = obj.FormID;
                tbDepartName.Text = obj.DeptName;
                lbDeptCode.Text   = obj.DeptCode;
                tbDateTime.Text   = obj.DateTime;
                tbUserName.Text   = obj.UserName;
                tbMobile.Text     = obj.Mobile;
                tbTitle.Text      = obj.Title;
                tbContent.Text    = obj.Content;
                cblSecurityLevel.SelectedValue = obj.SecurityLevel != null?obj.SecurityLevel.ToString() : "-1";

                cblUrgenLevel.SelectedValue = obj.UrgenLevel != null?obj.UrgenLevel.ToString() : "-1";
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Esempio n. 3
0
    private bool SaveWorkFlowInstance(SealOfBCInfo 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   = ddlDepartName.SelectedItem.Value.ToString();
                workFlowInstance.CreateDeptName   = ddlDepartName.SelectedItem.Text;
                workFlowInstance.CreateAtTime     = DateTime.Now;
                workFlowInstance.CreateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.CreateByUserName = CurrentEmployee.EmployeeName;
                workFlowInstance.AppId            = "3012";
            }
            else
            {
                workFlowInstance.CreateAtTime     = DateTime.Now;
                workFlowInstance.UpdateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.UpdateByUserName = CurrentEmployee.EmployeeName;
                isEdit = true;
            }
            workFlowInstance.FormId    = obj.FormID;
            workFlowInstance.FormTitle = obj.Title;
            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);
    }
Esempio n. 4
0
    private SealOfBCInfo SaveData(string ID, string wfStatus)
    {
        SaveWFParams();
        SealOfBCInfo obj = null;

        try
        {
            UploadAttachments1.SaveAttachment(ViewState["FormID"].ToString());
            obj = Eitems.Get(ID);
            bool isEdit = false;
            if (obj == null)
            {
                obj        = new SealOfBCInfo();
                obj.FormID = ViewState["FormID"].ToString();
            }
            else
            {
                isEdit     = true;
                obj.FormID = ViewState["FormID"].ToString();
                //obj.ApproveStatus = wfStatus;
            }

            obj.DeptCode        = ddlDepartName.SelectedItem.Value.ToString();
            obj.DeptName        = ddlDepartName.SelectedItem.Text;
            obj.UserName        = tbUserName.Text;
            obj.Mobile          = tbMobile.Text;
            obj.Title           = tbTitle.Text;
            obj.DateTime        = UpdatedTextBox.Value;
            obj.Content         = tbContent.Text;
            obj.LeadersSelected = lblApprovers.Text;
            if (cblSecurityLevel.SelectedIndex != -1)
            {
                obj.SecurityLevel = cblSecurityLevel.SelectedValue.ToString();
            }
            if (cblUrgenLevel.SelectedIndex != -1)
            {
                obj.UrgenLevel = cblUrgenLevel.SelectedValue.ToString();
            }
            if (!isEdit)
            {
                Eitems.Insert(obj);
            }
            else
            {
                Eitems.Update(obj);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return(obj);
    }
Esempio n. 5
0
    protected void Save_Click(object sender, EventArgs e)
    {
        string       id  = ViewState["FormID"].ToString();
        SealOfBCInfo obj = SaveData(id, "00");

        if (obj != null)
        {
            if (SaveWorkFlowInstance(obj, "0", null, ""))
            {
                Alert(Page, "保存成功!");
            }
        }
        else
        {
            Alert(Page, "保存失败");
        }
    }
Esempio n. 6
0
    private void SaveData(string ID, string wfStatus)
    {
        SealOfBCInfo obj = null;

        try
        {
            obj                 = Aitems.Get(ID);
            obj.FormID          = ViewState["FormID"].ToString();
            obj.LeadersSelected = lblApprovers.Text;
            obj.Content         = tbContent.Text;

            Aitems.Update(obj);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Esempio n. 7
0
    private void BindFormData()
    {
        try
        {
            WorkFlowInstance Instance = wf_WorkFlowInstance.GetWorkFlowInstanceById(ViewState["InstanceID"].ToString());
            if (Instance == null)
            {
                ExceptionHander.GoToErrorPage("记录不存在");
            }
            SealOfBCInfo obj = Vitems.Get(Instance.FormId.ToString());
            if (obj == null)
            {
                ExceptionHander.GoToErrorPage("记录不存在");
            }
            if (obj != null)
            {
                tbReportCode.Text = obj.FormID;
                tbDepartName.Text = obj.DeptName;
                lbDeptCode.Text   = obj.DeptCode;
                tbDateTime.Text   = obj.DateTime;
                tbUserName.Text   = obj.UserName;
                tbMobile.Text     = obj.Mobile;
                tbTitle.Text      = obj.Title;
                tbContent.Text    = obj.Content.Replace(" ", "&nbsp;").Replace("\n", "<br/>");
                cblSecurityLevel.SelectedValue = obj.SecurityLevel != null?obj.SecurityLevel.ToString() : "-1";

                cblUrgenLevel.SelectedValue = obj.UrgenLevel != null?obj.UrgenLevel.ToString() : "-1";
            }
            UploadAttachments1.ProcId = ViewState["InstanceID"].ToString();

            OpinionDeptManager.InstanceId    = ViewState["InstanceID"].ToString();
            OpinionDirector.InstanceId       = ViewState["InstanceID"].ToString();
            OpinionGeneralManager.InstanceId = ViewState["InstanceID"].ToString();
            OpinionSealManager.InstanceId    = ViewState["InstanceID"].ToString();
            OpinionPresident.InstanceId      = ViewState["InstanceID"].ToString();
            OpinionGroupOffice.InstanceId    = ViewState["InstanceID"].ToString();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Esempio n. 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();

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

        if (obj != null)
        {
            //开启流程
            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            WorkflowHelper.StartProcess(@"K2Workflow\OA_SealOfBC", 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);
    }