protected void bt_Save_Click(object sender, EventArgs e)
    {
        if ((Guid)ViewState["ProcessID"] != Guid.Empty)//修改
        {
            EWF_Flow_ProcessJointDecisionBLL bll = new EWF_Flow_ProcessJointDecisionBLL((Guid)ViewState["ProcessID"]);

            bll.Model.DefaultNextProcess = new Guid(ddl_DefaultNextProcess.SelectedValue);
            bll.Model.Description = tbx_Description.Text;
            bll.Model.Sort = int.Parse(tbx_Sort.Text);

            bll.Model.MessageSubject = tbx_MessageSubject.Text;
            bll.Model.Name = tbx_Name.Text;
            if (!string.IsNullOrEmpty(tbx_TimeoutHours.Text)) bll.Model.TimeoutHours = int.Parse(tbx_TimeoutHours.Text);

            bll.Model.NeedAllPositive = ddl_NeedAllPositive.SelectedValue;
            bll.Model.AtLeastPositiveNum = int.Parse(tbx_AtLeastPositiveNum.Text);
            bll.Model.PositiveNextProcess = new Guid(ddl_PositiveNextProcess.SelectedValue);
            bll.Model.NegativeNextProcess = new Guid(ddl_NegativeNextProcess.SelectedValue);

            bll.Update();

            #region 更新明细
            ListTable<EWF_Flow_ProcessJointDecision_Recipients> items = (ListTable<EWF_Flow_ProcessJointDecision_Recipients>)ViewState["Details"];
            foreach (EWF_Flow_ProcessJointDecision_Recipients item in items.GetListItem(ItemState.Added))
            {
                bll.AddDetail(item);
            }
            foreach (EWF_Flow_ProcessJointDecision_Recipients item in items.GetListItem(ItemState.Modified))
            {
                bll.UpdateDetail(item);
            }
            foreach (EWF_Flow_ProcessJointDecision_Recipients item in items.GetListItem(ItemState.Deleted))
            {
                bll.DeleteDetail(item.ID);
            }
            #endregion
        }
        else//新增
        {
            EWF_Flow_ProcessJointDecisionBLL bll = new EWF_Flow_ProcessJointDecisionBLL();
            bll.Model.App = (Guid)ViewState["AppID"];
            bll.Model.DefaultNextProcess = new Guid(ddl_DefaultNextProcess.SelectedValue);
            bll.Model.Description = tbx_Description.Text;
            bll.Model.Sort = int.Parse(tbx_Sort.Text);
            bll.Model.Type = 10;

            bll.Model.MessageSubject = tbx_MessageSubject.Text;
            bll.Model.Name = tbx_Name.Text;
            if (!string.IsNullOrEmpty(tbx_TimeoutHours.Text)) bll.Model.TimeoutHours = int.Parse(tbx_TimeoutHours.Text);

            bll.Model.NeedAllPositive = ddl_NeedAllPositive.SelectedValue;
            bll.Model.AtLeastPositiveNum = int.Parse(tbx_AtLeastPositiveNum.Text);
            bll.Model.PositiveNextProcess = new Guid(ddl_PositiveNextProcess.SelectedValue);
            bll.Model.NegativeNextProcess = new Guid(ddl_NegativeNextProcess.SelectedValue);

            bll.Items = ((ListTable<EWF_Flow_ProcessJointDecision_Recipients>)ViewState["Details"]).GetListItem();
            bll.Add();
        }
        Response.Redirect("FlowProcessList.aspx?AppID=" + ViewState["AppID"].ToString());
    }
Example #2
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        if ((Guid)ViewState["ProcessID"] != Guid.Empty)//修改
        {
            EWF_Flow_ProcessJointDecisionBLL bll = new EWF_Flow_ProcessJointDecisionBLL((Guid)ViewState["ProcessID"]);

            bll.Model.DefaultNextProcess = new Guid(ddl_DefaultNextProcess.SelectedValue);
            bll.Model.Description        = tbx_Description.Text;
            bll.Model.Sort = int.Parse(tbx_Sort.Text);

            bll.Model.MessageSubject = tbx_MessageSubject.Text;
            bll.Model.Name           = tbx_Name.Text;
            if (!string.IsNullOrEmpty(tbx_TimeoutHours.Text))
            {
                bll.Model.TimeoutHours = int.Parse(tbx_TimeoutHours.Text);
            }

            bll.Model.NeedAllPositive     = ddl_NeedAllPositive.SelectedValue;
            bll.Model.AtLeastPositiveNum  = int.Parse(tbx_AtLeastPositiveNum.Text);
            bll.Model.PositiveNextProcess = new Guid(ddl_PositiveNextProcess.SelectedValue);
            bll.Model.NegativeNextProcess = new Guid(ddl_NegativeNextProcess.SelectedValue);

            bll.Update();

            #region 更新明细
            ListTable <EWF_Flow_ProcessJointDecision_Recipients> items = (ListTable <EWF_Flow_ProcessJointDecision_Recipients>)ViewState["Details"];
            foreach (EWF_Flow_ProcessJointDecision_Recipients item in items.GetListItem(ItemState.Added))
            {
                bll.AddDetail(item);
            }
            foreach (EWF_Flow_ProcessJointDecision_Recipients item in items.GetListItem(ItemState.Modified))
            {
                bll.UpdateDetail(item);
            }
            foreach (EWF_Flow_ProcessJointDecision_Recipients item in items.GetListItem(ItemState.Deleted))
            {
                bll.DeleteDetail(item.ID);
            }
            #endregion
        }
        else//新增
        {
            EWF_Flow_ProcessJointDecisionBLL bll = new EWF_Flow_ProcessJointDecisionBLL();
            bll.Model.App = (Guid)ViewState["AppID"];
            bll.Model.DefaultNextProcess = new Guid(ddl_DefaultNextProcess.SelectedValue);
            bll.Model.Description        = tbx_Description.Text;
            bll.Model.Sort = int.Parse(tbx_Sort.Text);
            bll.Model.Type = 10;

            bll.Model.MessageSubject = tbx_MessageSubject.Text;
            bll.Model.Name           = tbx_Name.Text;
            if (!string.IsNullOrEmpty(tbx_TimeoutHours.Text))
            {
                bll.Model.TimeoutHours = int.Parse(tbx_TimeoutHours.Text);
            }

            bll.Model.NeedAllPositive     = ddl_NeedAllPositive.SelectedValue;
            bll.Model.AtLeastPositiveNum  = int.Parse(tbx_AtLeastPositiveNum.Text);
            bll.Model.PositiveNextProcess = new Guid(ddl_PositiveNextProcess.SelectedValue);
            bll.Model.NegativeNextProcess = new Guid(ddl_NegativeNextProcess.SelectedValue);

            bll.Items = ((ListTable <EWF_Flow_ProcessJointDecision_Recipients>)ViewState["Details"]).GetListItem();
            bll.Add();
        }
        Response.Redirect("FlowProcessList.aspx?AppID=" + ViewState["AppID"].ToString());
    }