/// <summary>
    /// 保存事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, EventArgs e)
    {
        //工作流参数
        NameValueCollection dataFields = SetWFParams();

        if (dataFields == null)
        {
            return;
        }
        JC_TenderSpecialItemInfo dataInfo = SaveFormData();

        if (dataInfo != null)
        {
            UploadAttachments1.SaveAttachment(FormId);

            if (SaveWorkFlowInstance("0", null, ""))
            {
                Alert("保存完成");
            }
        }
        else
        {
            Alert("保存失败");
        }
    }
 /// <summary>
 /// 加载表单
 /// </summary>
 private void InitFormData(string formId)
 {
     try
     {
         JC_TenderSpecialItemInfo info = JC_TenderSpecialItem.GetJC_TenderSpecialItemInfoByFormID(FormId);
         if (!string.IsNullOrEmpty(Request.QueryString["id"]))
         {
             if (info != null)
             {
                 //加载业务数据
                 cblSecurityLevel.SelectedIndex = int.Parse(info.SecurityLevel);
                 cblUrgenLevel.SelectedIndex    = int.Parse(info.UrgenLevel);
                 tbDateTime.Text = info.Date ?? "";
                 tbUserName.Text = info.UserName;
                 tbMobile.Text   = info.Tel;
                 tbTitle.Text    = info.Title;
                 tbContent.Text  = info.Substance;
                 tbRemark.Text   = info.Remark;
                 cblIsImpowerProject.SelectedIndex = int.Parse(info.IsAccreditByGroup);
                 tbReportCode.Text  = info.FormID;
                 ddlDepartName.Text = info.DeptName;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#3
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
            JC_TenderSpecialItemInfo companyInfo = Pkurg.PWorldBPM.Business.BIZ.JC.JC_TenderSpecialItem.GetJC_TenderSpecialItemInfoByWfId(k2_workflowId.ToString());
            string jcFormCode    = companyInfo.FormID;
            string jcFormName    = companyInfo.Title;
            string StartUserName = companyInfo.UserName;
            //判断是否审批通过,存储0,1表示通过与不通过
            string resultString = dataFields["IsPass"];

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

            JC_TenderSpecialItemInfo model = new JC_TenderSpecialItemInfo();
            model.FormID     = jcFormCode;
            model.IsApproval = resultString;
            //两个文件名字最好不能起的一样,尤其是增删改查操作的时候文件名不能一样
            Pkurg.PWorldBPM.Business.BIZ.JC.JC_TenderSpecialItem.UpdateJC_TenderSpecialItemInfoInfoByModel(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;
            //得到子公司的招采部的编号以及名称
            Pkurg.PWorld.Entities.Department deptInfo = new Pkurg.PWorld.Business.Permission.BFPmsUserRoleDepartment().GetDeptByCurrentDeptCodeAndOtherDeptName(companyInfo.StartDeptId, "招标采购部");

            //授权给所在公司的招标采购部
            InsertAuthorizationToJCGroup(AuthorizedByUserCode, AuthorizedByUserName, ProId, ProcName, deptInfo.DepartCode);
            //授权给集团的采购管理部
            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);
    }
    /// <summary>
    /// 保存表单
    /// </summary>
    /// <returns></returns>
    private JC_TenderSpecialItemInfo SaveFormData()
    {
        //FormId
        JC_TenderSpecialItemInfo info = null;

        try
        {
            //检查存储过程是否正确
            info = JC_TenderSpecialItem.GetJC_TenderSpecialItemInfoByFormID(FormId);
            if (info == null)
            {
                info = new JC_TenderSpecialItemInfo()
                {
                    FormID            = FormId,
                    SecurityLevel     = cblSecurityLevel.SelectedIndex.ToString(),
                    UrgenLevel        = cblUrgenLevel.SelectedIndex.ToString(),
                    StartDeptId       = ddlDepartName.SelectedItem.Value,
                    DeptName          = ddlDepartName.SelectedItem.Text,
                    Date              = DateTime.Now.ToString(),
                    UserName          = _BPMContext.CurrentPWordUser.EmployeeName,
                    Tel               = _BPMContext.CurrentPWordUser.MobilePhone,
                    IsAccreditByGroup = cblIsImpowerProject.SelectedIndex.ToString(),
                    Title             = tbTitle.Text,
                    Substance         = tbContent.Text,
                    Remark            = tbRemark.Text,
                };
                //插入新的表单数据
                JC_TenderSpecialItem.InsertJC_TenderSpecialItemInfo(info);
            }
            else
            {
                info.StartDeptId       = ddlDepartName.SelectedItem.Value;
                info.DeptName          = ddlDepartName.SelectedItem.Text;
                info.SecurityLevel     = cblSecurityLevel.SelectedIndex.ToString();
                info.UrgenLevel        = cblUrgenLevel.SelectedIndex.ToString();
                info.IsAccreditByGroup = cblIsImpowerProject.SelectedIndex.ToString();
                //更新表单数据
                JC_TenderSpecialItem.UpdateJC_TenderSpecialItemInfo(info);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(info);
    }
示例#5
0
 /// <summary>
 /// 加载表单
 /// </summary>
 private void InitFormData()
 {
     try
     {
         JC_TenderSpecialItemInfo info = JC_TenderSpecialItem.GetJC_TenderSpecialItemInfoByFormID(FormId);
         if (!string.IsNullOrEmpty(Request.QueryString["id"]))
         {
             if (info != null)
             {
                 //加载业务数据
                 cblSecurityLevel.SelectedIndex = int.Parse(info.SecurityLevel);
             }
             cblUrgenLevel.SelectedIndex = int.Parse(info.UrgenLevel);
             ddlDepartName.Text          = info.DeptName;
             tbDateTime.Text             = info.Date ?? "";
             tbUserName.Text             = info.UserName;
             tbMobile.Text  = info.Tel;
             tbTitle.Text   = info.Title;
             tbContent.Text = info.Substance.Replace(" ", "&nbsp;").Replace("\n", "<br/>");
             tbRemark.Text  = info.Remark;
             cblIsImpowerProject.SelectedIndex = int.Parse(info.IsAccreditByGroup);
             tbReportCode.Text = info.FormID;
             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;
     }
 }
示例#6
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_TenderSpecialItemInfo citycompanyInfo = Pkurg.PWorldBPM.Business.BIZ.JC.JC_TenderSpecialItem.GetJC_TenderSpecialItemInfoByFormId(ProId);
            string emailTitle = citycompanyInfo.DeptName + citycompanyInfo.UserName + "于" + citycompanyInfo.Date + "发起的" + citycompanyInfo.Title + "流程已审批结束!";
            Logger.logger.DebugFormat("WF_Authorization:{0}", AuthorizedUserCode);
            //得到实例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_ProjectTenderCityCompany.aspx?id=" + WorkFlowInstancesID;

            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);
        }
    }
 /// <summary>
 /// 加载表单
 /// </summary>
 /// <param name="FormId"></param>
 private void InitFormData(string formId)
 {
     try
     {
         //参照例子中的getmodel检查自己所写的存储过程是否正确
         JC_TenderSpecialItemInfo info = JC_TenderSpecialItem.GetJC_TenderSpecialItemInfoByFormID(FormId);
         if (info != null)
         {
             ListItem selectItem = ddlDepartName.Items.FindByValue(info.StartDeptId);
             if (selectItem != null)
             {
                 selectItem.Selected = true;
             }
             //加载业务数据
             tbReportCode.Text = info.FormID;
             cblSecurityLevel.SelectedIndex = int.Parse(info.SecurityLevel);
             cblUrgenLevel.SelectedIndex    = int.Parse(info.UrgenLevel);
             StartDeptId     = info.StartDeptId;
             tbDateTime.Text = info.Date;
             tbUserName.Text = info.UserName;
             tbMobile.Text   = info.Tel;
             cblIsImpowerProject.SelectedIndex = int.Parse(info.IsAccreditByGroup);
             tbTitle.Text   = info.Title;
             tbContent.Text = info.Substance;
             tbRemark.Text  = info.Remark;
         }
         else
         {
             tbUserName.Text   = _BPMContext.CurrentPWordUser.EmployeeName;
             tbMobile.Text     = _BPMContext.CurrentPWordUser.MobilePhone;
             tbDateTime.Text   = DateTime.Now.ToString();
             tbReportCode.Text = FormId;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }