Ejemplo n.º 1
0
 /// <summary>
 /// 加载表单
 /// </summary>
 /// <param name="FormId"></param>
 private void InitFormData(string FormId)
 {
     try
     {
         JC_FinalistApprovalInfo info = JC_FinalistApproval.GetJC_FinalistApprovalInfoByFormID(FormId);
         if (info != null)
         {
             ListItem selectItem = ddlDepartName.Items.FindByValue(info.StartDeptId);
             if (selectItem != null)
             {
                 selectItem.Selected = true;
             }
             //加载业务数据
             StartDeptId        = info.StartDeptId;
             tbDateTime.Text    = info.ArchiveDate;
             tbProjectName.Text = info.ProjectName;
             cblIsImpowerProject.SelectedIndex = int.Parse(info.IsAccreditByGroup);
             tbCheckStatus.Text = info.CheckStatus;
             cbGroupPurchaseDept.Items[0].Selected = info.GroupPurchaseDept == "1";
             cbGroupLegalDept.Items[0].Selected    = info.GroupLegalDept == "1";
         }
         else
         {
             tbDateTime.Text = DateTime.Now.ToString();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// 保存表单
    /// </summary>
    /// <returns></returns>
    private JC_FinalistApprovalInfo SaveFormData()
    {
        //FormId
        JC_FinalistApprovalInfo info = null;

        try
        {
            info = JC_FinalistApproval.GetJC_FinalistApprovalInfoByFormID(FormId);
            if (info == null)
            {
                info = new JC_FinalistApprovalInfo()
                {
                    //保存数据到数据库
                    FormID            = FormId,
                    ProjectName       = tbProjectName.Text,
                    StartDeptId       = ddlDepartName.SelectedItem.Value,
                    ReportDept        = ddlDepartName.SelectedItem.Text,
                    ReportDate        = DateTime.Now.ToString(),
                    IsAccreditByGroup = cblIsImpowerProject.SelectedIndex.ToString(),
                    CheckStatus       = tbCheckStatus.Text,
                    GroupPurchaseDept = cbGroupPurchaseDept.Items[0].Selected ? "1" : "0",
                    GroupLegalDept    = cbGroupLegalDept.Items[0].Selected ? "1" : "0",
                };
                JC_FinalistApproval.InsertJC_FinalistApprovalInfo(info);
            }
            else
            {
                info.ProjectName       = tbProjectName.Text;
                info.StartDeptId       = ddlDepartName.SelectedItem.Value;
                info.ReportDept        = ddlDepartName.SelectedItem.Text;
                info.ReportDate        = tbDateTime.Text;
                info.IsAccreditByGroup = cblIsImpowerProject.SelectedIndex.ToString();
                info.CheckStatus       = tbCheckStatus.Text;
                info.GroupPurchaseDept = cbGroupPurchaseDept.Items[0].Selected ? "1" : "0";
                info.GroupLegalDept    = cbGroupLegalDept.Items[0].Selected ? "1" : "0";

                JC_FinalistApproval.UpdateJC_FinalistApprovalInfo(info);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(info);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 保存事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, EventArgs e)
    {
        //工作流参数
        NameValueCollection dataFields = SetWFParams();

        JC_FinalistApprovalInfo dataInfo = SaveFormData();

        if (dataInfo != null)
        {
            if (SaveWorkFlowInstance("0", null, ""))
            {
                Alert("保存完成");
            }
        }
        else
        {
            Alert("保存失败");
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 插入授权表(授权给招采部门全部成员)  from  XX to XX 的格式
    /// 在该部分中的被授权人是一个部门的集合,所以需要获取部门的编号,遍历得到该部门的所有成员,并对每个成员进行授权
    /// </summary>
    /// <param name="AuthorizedByUserCode">授权人的编号</param>
    /// <param name="AuthorizedByUserName">授权人的姓名</param>
    /// <param name="ProId">流程ID,需要从dispose调用过程中就取到值</param>
    /// <param name="ProcName">流程名称,需要从dispose调用过程中就取到值</param>
    /// <param name="AuthorizedUserCode">被授权人编号(部门编号)</param>
    /// <param name="AuthorizedUserName">被授权人姓名(部门名称)</param>
    /// <returns></returns>
    public static void InsertAuthorizationToJCGroup(string AuthorizedByUserCode, string AuthorizedByUserName, string ProId, string ProcName, string AuthorizeDeptCode)
    {
        //发送邮件
        MailService mailService = new MailService();

        IList <VEmployeeAndAdditionalInfo> ds = GetUserListByDeptCode(AuthorizeDeptCode);

        foreach (var item in ds)
        {
            string AuthorizedUserCode = item.EmployeeCode;
            string AuthorizedUserName = item.EmployeeName;

            Pkurg.PWorldBPM.Business.Workflow.WF_Authorization.InsertAuthorization(AuthorizedByUserCode, AuthorizedByUserName, ProId, ProcName, AuthorizedUserCode, AuthorizedUserName);
            //发送邮件
            //定义两个变量,将title以及body使用字符串方式拼接出来
            JC_FinalistApprovalInfo finalistApprovalInfo = Pkurg.PWorldBPM.Business.BIZ.JC.JC_FinalistApproval.GetJC_FinalistApprovalInfoByFormId(ProId);

            string emailTitle = finalistApprovalInfo.ReportDept + finalistApprovalInfo.ArchiveName + "于" + finalistApprovalInfo.ArchiveDate + "发起的" + "【入围申请单】" + finalistApprovalInfo.ProjectName + "流程已审批结束!";
            //得到实例ID号
            DataTable dt      = Pkurg.PWorldBPM.Business.Controls.WF_WorkFlowInstances.GetWorkFlowInstanceByFormID(ProId);
            DataRow   dataRow = dt.Rows[0];

            string WorkFlowInstancesID = dataRow["InstanceID"].ToString();

            string ID = url + "/Workflow/ViewPage/V_JC_FinalistApproval.aspx?id=" + WorkFlowInstancesID;

            //string emailFinallyTitleFormat = @"emailTitle";
            string emailFinallyBodyFormat = @"您好!
       <br/>
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + emailTitle + @"
       <br/>
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;若要查看审批意见点击此处:&nbsp;&nbsp;&nbsp;&nbsp;<a href='" + ID + @"'>查看</a>
         <br/>
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;谢谢
          <br/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";


            bool eResult = mailService.SendEmailCustom(item.Email, emailTitle, emailFinallyBodyFormat);
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// 加载表单
 /// </summary>
 private void InitFormData()
 {
     try
     {
         JC_FinalistApprovalInfo info = JC_FinalistApproval.GetJC_FinalistApprovalInfoByFormID(FormId);
         if (!string.IsNullOrEmpty(Request.QueryString["id"]))
         {
             if (info != null)
             {
                 //加载业务数据
                 tbProjectName.Text = info.ProjectName;
                 ddlDepartName.Text = info.ReportDept;
                 lbDeptCode.Text    = info.StartDeptId;
                 tbDateTime.Text    = info.ReportDate ?? "";
                 cblIsImpowerProject.SelectedIndex = int.Parse(info.IsAccreditByGroup);
                 tbCheckStatus.Text = info.CheckStatus.Replace(" ", "&nbsp;").Replace("\n", "<br/>");
                 if (!string.IsNullOrEmpty(info.IsApproval))
                 {
                     lbIsApproval.Text = string.Format("{1}({0})", info.IsApproval == "1" ? "批准" : "拒绝", lbIsApproval.Text);
                     if (info.IsApproval == "1")
                     {
                         this.lbIsApproval.Style.Add("color", "green");
                     }
                     else
                     {
                         this.lbIsApproval.Style.Add("color", "red");
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 加载表单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void InitFormData(string formId)
 {
     try
     {
         JC_FinalistApprovalInfo info = JC_FinalistApproval.GetJC_FinalistApprovalInfoByFormID(FormId);
         if (!string.IsNullOrEmpty(Request.QueryString["id"]))
         {
             if (info != null)
             {
                 //加载业务数据
                 tbProjectName.Text = info.ProjectName;
                 tbDateTime.Text    = info.ReportDate ?? "";
                 ddlDepartName.Text = info.ReportDept;
                 lbDeptCode.Text    = info.StartDeptId;
                 cblIsImpowerProject.SelectedIndex = int.Parse(info.IsAccreditByGroup);
                 tbCheckStatus.Text = info.CheckStatus;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 7
0
    /// <summary>
    /// 重写流程结束方法
    /// </summary>
    public override Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo DoServiceEvent(int k2_workflowId, SerializableDictionary <string, string> dataFields)
    {
        Logger.logger.DebugFormat("Params:{0},{1}", k2_workflowId, dataFields.Keys.Count);
        foreach (KeyValuePair <string, string> item in dataFields)
        {
            Logger.logger.DebugFormat("df:{0}-{1}", item.Key, item.Value);
        }
        Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo info = new ExecuteResultInfo();
        try
        {
            //根据流程ID获取FormId
            //string jcFormCode = Pkurg.PWorldBPM.Business.BIZ.JC.JC_FinalistApproval.GetJC_FinalistApprovalInfoByWfId(k2_workflowId.ToString()).FormID;
            JC_FinalistApprovalInfo companyInfo = Pkurg.PWorldBPM.Business.BIZ.JC.JC_FinalistApproval.GetJC_FinalistApprovalInfoByWfId(k2_workflowId.ToString());
            string jcFormCode    = companyInfo.FormID;
            string jcFormName    = companyInfo.ProjectName;
            string StartUserName = companyInfo.ArchiveName;
            //判断是否审批通过,存储0,1表示通过与不通过
            string resultString = dataFields["IsPass"];

            //添加判断在招标委员会的节点上,如果时间过去两天,还有人没有审批,
            //则根据相关的字段给数据库插入“默认同意”字段,并且时间为截至时间[三个表关联]
            //条件=招标委员会意见/集团招标委员会意见,同时时间=2天,option.value=null
            //option.value="同意" 时间=当前时间
            //方法 insertinto:加意见     instanceid
            //先得到节点,再把节点上的datefield的人分隔开,再挨个判断他有没有意见,没有意见的再插入
            //if (dataFields["IsPass"] == "1")
            //{
            //    string currentActiveName = "";
            //    string persons = "";
            //    if (dataFields["IsReportToResource"] == "0")
            //    {
            //        persons = dataFields["GroupTenderCommitteeManager"];

            //        currentActiveName = "集团招标委员会意见";
            //    }
            //    else
            //    {
            //        persons = dataFields["TenderCommitteeManager"];

            //        currentActiveName = "招标委员会意见";
            //    }
            //    //把上面节点的datefield的人分隔开,再挨个判断他有没有意见,没有意见的再插入
            //    foreach (string person in persons.Split(','))
            //    {
            //            //通过一个方法定义三个变量得到
            //            // l WF_InstanogionnameceId CurrentActiveName
            //            //loginName, wfInstanceId, currentActiveName
            //        string LoginName = person.ToLower().Replace("k2:founder\\", "");
            //        string WFInstanceId = k2_workflowId.ToString();
            //        //给表中插入数据,并且option字段值默认为“默认同意”
            //        if (!string.IsNullOrEmpty(LoginName))
            //        {
            //        Pkurg.PWorldBPM.Business.BIZ.JC.JC_FinalistApproval.InsertWF_Approval_RecordByInstanceID(currentActiveName, LoginName, WFInstanceId);
            //    }
            //    }
            //}

            //添加判断在招标委员会主任的节点上,如果时间过去两天,还有人没有审批,
            //则根据相关的字段给数据库插入“同意”字段,并且时间为截至时间[三个表关联]
            //条件=招标委员会主任意见/集团招标委员会主任意见,同时时间=2天,option.value=null
            //option.value="同意" 时间=当前时间
            //instanceid
            //先得到节点,再把节点上的datefield的人分隔开,再挨个判断他有没有意见,没有意见的再插入
            //if (dataFields["IsPass"] == "1")
            //{
            //    string currentActiveName = "";
            //    string person = "";
            //    if (dataFields["IsReportToResource"] == "0")
            //    {
            //        person = dataFields["GroupTenderCommitteeChairman"];

            //        currentActiveName = "集团招标委员会主任意见";
            //    }
            //    else
            //    {
            //        person = dataFields["TenderCommitteeChairman"];

            //        currentActiveName = "招标委员会主任意见";
            //    }

            //    //定义三个变量得到
            //    //loginName, wfInstanceId, currentActiveName
            //    string LoginName = person.ToLower().Replace("k2:founder\\", "");
            //    string WFInstanceId = k2_workflowId.ToString();
            //    //给表中插入数据,并且option字段值默认为“默认同意”
            //    Pkurg.PWorldBPM.Business.BIZ.JC.JC_FinalistApproval.InsertWF_Approval_RecordByInstanceID(currentActiveName, LoginName, WFInstanceId);

            //}
            //这部分是根据自己的流程来判定的,现在只是通过流程ID得到FormId来进行判断结束
            Logger.logger.DebugFormat("Proc:{0},{1}", jcFormCode, resultString);

            JC_FinalistApprovalInfo model = new JC_FinalistApprovalInfo();
            model.FormID     = jcFormCode;
            model.IsApproval = resultString;
            //两个文件名字最好不能起的一样,尤其是增删改查操作的时候文件名不能一样
            Pkurg.PWorldBPM.Business.BIZ.JC.JC_FinalistApproval.UpdateJC_FinalistApprovalInfoInfoByModel(model);


            //流程结束之后授权给集团招采部门所有人
            //得到各参数的值:AuthorizedByUserCode:授权人编号;AuthorizedByUserName:授权人姓名;ProId:流程ID;
            //ProcName:流程编号;AuthorizedUserCode:被授权部门编号;AuthorizedUserName:被授权部门名称
            DataTable dt      = Pkurg.PWorldBPM.Business.Controls.WF_WorkFlowInstances.GetWorkFlowInstanceByFormID(jcFormCode);
            DataRow   dataRow = dt.Rows[0];

            string AuthorizedByUserCode = dataRow["CreateByUserCode"].ToString();
            string AuthorizedByUserName = dataRow["CreateByUserName"].ToString();
            string ProId    = jcFormCode;
            string ProcName = jcFormName;

            InsertAuthorizationToJCGroup(AuthorizedByUserCode, AuthorizedByUserName, ProId, ProcName, CGDeptCode);



            info.IsSuccess = true;
        }
        catch (Exception ex)
        {
            info.ExecException = ex.StackTrace;
            info.IsSuccess     = false;
        }
        Logger.logger.DebugFormat("Result:{0}", info.IsSuccess);
        Logger.logger.DebugFormat("Result-e:{0}", info.ExecException);
        return(info);
    }