コード例 #1
0
    /// <summary>
    /// 加载表单
    /// </summary>
    /// <param name="formId"></param>
    private void InitFormData(string formId)
    {
        try
        {
            JC_ProjectTenderGroupInfo info = JC_ProjectTenderGroup.GetJC_ProjectTenderGroupInfoByFormID(FormId);
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                if (info != null)
                {
                    //ListItem selectedItem = ddlDepartName.Items.FindByValue(info.StartDeptId);
                    //if (selectedItem != null)
                    //{
                    //    selectedItem.Selected = true;
                    //}

                    //加载业务数据
                    cblSecurityLevel.SelectedIndex = int.Parse(info.SecurityLevel);
                    cblUrgenLevel.SelectedIndex    = int.Parse(info.UrgenLevel);
                    tbDateTime.Text    = info.DateTime ?? "";
                    tbUserName.Text    = info.UserName;
                    tbMobile.Text      = info.Tel;
                    tbTitle.Text       = info.Title;
                    tbContent.Text     = info.Substance;
                    tbRemark.Text      = info.Remark;
                    tbReportCode.Text  = info.FormID;
                    ddlDepartName.Text = info.DeptName;
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #2
0
    /// <summary>
    /// 加载表单
    /// </summary>
    /// <param name="FormId"></param>
    private void InitFormData(string formId)
    {
        try
        {
            //参照例子中的getmodel检查自己所写的存储过程是否正确
            JC_ProjectTenderGroupInfo info = JC_ProjectTenderGroup.GetJC_ProjectTenderGroupInfoByFormID(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.DateTime;
                tbUserName.Text = info.UserName;
                tbMobile.Text   = info.Tel;
                tbTitle.Text    = info.Title;
                tbContent.Text  = info.Substance;
                tbRemark.Text   = info.Remark;
                //需要在checkbox里面存储多个数值或者为空
                if (!string.IsNullOrEmpty(info.GroupRealateDept))
                {
                    string[] groupRealateDepts = info.GroupRealateDept.Split(',');

                    foreach (var item in groupRealateDepts)
                    {
                        cbGroupRealateDept.Items[int.Parse(item)].Selected = true;
                    }
                }
            }
            else
            {
                tbUserName.Text   = _BPMContext.CurrentPWordUser.EmployeeName;
                tbMobile.Text     = _BPMContext.CurrentPWordUser.MobilePhone;
                tbDateTime.Text   = DateTime.Now.ToString();
                tbReportCode.Text = FormId;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #3
0
 /// <summary>
 /// 加载表单
 /// </summary>
 private void InitFormData()
 {
     try
     {
         JC_ProjectTenderGroupInfo info = JC_ProjectTenderGroup.GetJC_ProjectTenderGroupInfoByFormID(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.DateTime ?? "";
             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;
             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;
     }
 }
コード例 #4
0
    /// <summary>
    /// 保存表单
    /// </summary>
    /// <returns></returns>
    private JC_ProjectTenderGroupInfo SaveFormData()
    {
        //FormId
        JC_ProjectTenderGroupInfo info = null;

        try
        {
            //检查存储过程是否正确
            info = JC_ProjectTenderGroup.GetJC_ProjectTenderGroupInfoByFormID(FormId);

            StringBuilder groupRealateDepts = new StringBuilder();
            foreach (ListItem item in cbGroupRealateDept.Items)
            {
                if (item.Selected)
                {
                    groupRealateDepts.AppendFormat("{0},", cbGroupRealateDept.Items.IndexOf(item));
                }
            }

            if (info == null)
            {
                info = new JC_ProjectTenderGroupInfo()
                {
                    FormID        = FormId,
                    SecurityLevel = cblSecurityLevel.SelectedIndex.ToString(),
                    UrgenLevel    = cblUrgenLevel.SelectedIndex.ToString(),
                    StartDeptId   = ddlDepartName.SelectedItem.Value,
                    DeptName      = ddlDepartName.SelectedItem.Text,
                    DateTime      = DateTime.Now.ToString(),
                    UserName      = _BPMContext.CurrentPWordUser.EmployeeName,
                    Tel           = _BPMContext.CurrentPWordUser.MobilePhone,
                    Title         = tbTitle.Text,
                    Substance     = tbContent.Text,
                    Remark        = tbRemark.Text,
                    //foreach遍历读取
                    GroupRealateDept = groupRealateDepts.ToString().Trim(','),
                };
                //插入新的表单数据
                JC_ProjectTenderGroup.InsertJC_ProjectTenderGroupInfo(info);
            }
            else
            {
                info.FormID        = tbReportCode.Text;
                info.StartDeptId   = ddlDepartName.SelectedItem.Value;
                info.SecurityLevel = cblSecurityLevel.SelectedIndex.ToString();
                info.UrgenLevel    = cblUrgenLevel.SelectedIndex.ToString();
                info.DeptName      = ddlDepartName.SelectedItem.Text;
                info.DateTime      = tbDateTime.Text;
                info.UserName      = tbUserName.Text;
                info.Tel           = tbMobile.Text;
                info.Title         = tbTitle.Text;
                info.Substance     = tbContent.Text;
                info.Remark        = tbRemark.Text;
                ////foreach遍历读取
                info.GroupRealateDept = groupRealateDepts.ToString().Trim(',');
                //更新表单数据
                JC_ProjectTenderGroup.UpdateJC_ProjectTenderGroupInfo(info);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(info);
    }