Exemple #1
0
    protected void bt_AddInviteConsult_Click(object sender, EventArgs e)
    {
        if (select_RecipientStaff.SelectValue == "" || select_RecipientStaff.SelectValue == "0")
        {
            MessageBox.Show(this, "请选择要协助的员工!");
            return;
        }

        string[] recipients = select_RecipientStaff.SelectValue.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        foreach (string s in recipients)
        {
            int recipient = 0;
            if (int.TryParse(s, out recipient) && recipient > 0)
            {
                EWF_Task_InviteConsultBLL invite = new EWF_Task_InviteConsultBLL();
                invite.Model.Job            = (int)ViewState["CurrentJobID"];
                invite.Model.InvitedTime    = DateTime.Now;
                invite.Model.InvitedStaff   = (int)Session["UserID"];
                invite.Model.RecipientStaff = recipient;
                invite.Model.ReadFlag       = "N";
                invite.Model.MessageSubject = tbx_InvitedMessageSubject.Text;
                invite.Add();
            }
        }


        BindGrid_InviteConsult();
    }
Exemple #2
0
    private void BindInviteConsult()
    {
        DataTable dt = EWF_Task_InviteConsultBLL.GetNeedConsult((int)Session["UserID"]);

        gv_EWFInviteConsultList.DataSource = dt;
        gv_EWFInviteConsultList.DataBind();
    }
Exemple #3
0
    private void BindGrid()
    {
        DateTime dtBegin = DateTime.Parse(tbx_begin.Text);
        DateTime dtEnd   = DateTime.Parse(tbx_end.Text).AddDays(1);

        DataTable dt;

        if (MCSTabControl1.SelectedIndex == 0)
        {
            dt = EWF_Task_InviteConsultBLL.GetNeedConsult((int)Session["UserID"]);
            tbx_begin.Enabled = false;
            tbx_end.Enabled   = false;
        }
        else
        {
            dt = EWF_Task_InviteConsultBLL.GetHasConsult((int)Session["UserID"], dtBegin, dtEnd);
            tbx_begin.Enabled = true;
            tbx_end.Enabled   = true;
        }

        string condition = " 1 = 1 ";

        if (ddl_App.SelectedValue != "0")
        {
            condition += " AND App = '" + ddl_App.SelectedValue + "'";
        }
        if (tbx_MessageSubject.Text != "")
        {
            condition += " AND (Title like '%" + tbx_MessageSubject.Text + "%' OR MessageSubject like '%" + tbx_MessageSubject.Text + "%')";
        }

        #region 判断当前可查询的范围
        string orgcitys = "";
        if (tr_OrganizeCity.SelectValue != "1" && tr_OrganizeCity.SelectValue != "0")
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue), true);
            orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "")
            {
                orgcitys += ",";
            }
            orgcitys += tr_OrganizeCity.SelectValue;

            condition += " AND OrganizeCity IN (" + orgcitys + ")";
        }
        #endregion

        if (tbx_InitiatorStaffName.Text != "")
        {
            condition += " AND ApplyStaffName LIKE '%" + tbx_InitiatorStaffName.Text + "%'";
        }

        dt.DefaultView.RowFilter = condition;
        dt.DefaultView.Sort      = " TaskID desc ";
        gv_List.DataSource       = dt.DefaultView;
        gv_List.TotalRecordCount = dt.DefaultView.Count;
        gv_List.PageIndex        = (int)ViewState["PageIndex"];
        gv_List.DataBind();
    }
    //暂存意见
    protected void bt_SaveDecisionComment_Click(object sender, EventArgs e)
    {
        if (tbx_DecisionComment.Text == "")
        {
            MessageBox.Show(this, "审批意见必填");
            return;
        }

        string comment = tbx_DecisionComment.Text.Trim();

        comment += "<br/>------" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "-------<br/>";

        EWF_Task_InviteConsultBLL InviteConsultBLL = new EWF_Task_InviteConsultBLL((int)ViewState["InviteConsult"]);

        InviteConsultBLL.SaveConsultComment(comment);

        #region 更新任务备注信息
        string remark = "协助时间:<b><font color=red>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</font></b> ";
        remark += "协助审批人:<b><font color=red>" + Session["UserRealName"].ToString() + "</font></b> ";
        remark += " 审批意见:<b><font color=red>" + tbx_DecisionComment.Text + "</font></b> ";
        remark += "<br/>";

        EWF_TaskBLL taskbll = new EWF_TaskBLL((int)ViewState["TaskID"]);
        taskbll.AppendRemark(remark);

        if (cbx_NotifyInitiator.Checked)
        {
            string _content = "<b><font color=red>工作流处理通知!您发起的协助邀审有了回复!</font></b><br/>";
            _content += "工作流:<font color=red>" + lbl_AppName.Text + "</font><br/>";
            _content += "主题:<font color=red>" + lbl_Title.Text + "</font><br/><br/>";
            _content += remark;

            _content += "<br/><a href='" + this.ResolveUrl("~/SubModule/EWF/TaskDetail.aspx?TaskID=" + ViewState["TaskID"].ToString()) + "' target='_blank'><font color=blue>点击查看工作流详细情况</font></a><br/>";

            DataTable _users = new Org_StaffBLL(InviteConsultBLL.Model.InvitedStaff).GetUserList();
            foreach (DataRow dr_user in _users.Rows)
            {
                SendSM(dr_user["UserName"].ToString(), _content);
            }
        }
        #endregion

        MessageBox.ShowAndRedirect(this, "保存成功!", "TaskList_InviteConsult.aspx");
    }
    //暂存意见
    protected void bt_SaveDecisionComment_Click(object sender, EventArgs e)
    {
        if (tbx_DecisionComment.Text == "")
        {
            MessageBox.Show(this, "审批意见必填");
            return;
        }

        string comment = tbx_DecisionComment.Text.Trim();
        comment += "<br/>------" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "-------<br/>";

        EWF_Task_InviteConsultBLL InviteConsultBLL = new EWF_Task_InviteConsultBLL((int)ViewState["InviteConsult"]);
        InviteConsultBLL.SaveConsultComment(comment);

        #region 更新任务备注信息
        string remark = "协助时间:<b><font color=red>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</font></b> ";
        remark += "协助审批人:<b><font color=red>" + Session["UserRealName"].ToString() + "</font></b> ";
        remark += " 审批意见:<b><font color=red>" + tbx_DecisionComment.Text + "</font></b> ";
        remark += "<br/>";

        EWF_TaskBLL taskbll = new EWF_TaskBLL((int)ViewState["TaskID"]);
        taskbll.AppendRemark(remark);

        if (cbx_NotifyInitiator.Checked)
        {
            string _content = "<b><font color=red>工作流处理通知!您发起的协助邀审有了回复!</font></b><br/>";
            _content += "工作流:<font color=red>" + lbl_AppName.Text + "</font><br/>";
            _content += "主题:<font color=red>" + lbl_Title.Text + "</font><br/><br/>";
            _content += remark;

            _content += "<br/><a href='" + this.ResolveUrl("~/SubModule/EWF/TaskDetail.aspx?TaskID=" + ViewState["TaskID"].ToString()) + "' target='_blank'><font color=blue>点击查看工作流详细情况</font></a><br/>";

            DataTable _users = new Org_StaffBLL(InviteConsultBLL.Model.InvitedStaff).GetUserList();
            foreach (DataRow dr_user in _users.Rows)
            {
                SendSM(dr_user["UserName"].ToString(), _content);
            }
        }
        #endregion

        MessageBox.ShowAndRedirect(this, "保存成功!", "TaskList_InviteConsult.aspx");
    }
    //绑定基本信息
    private void BindTaskData()
    {
        #region 绑定当前工作项
        EWF_Task_InviteConsultBLL InviteConsultBLL = new EWF_Task_InviteConsultBLL((int)ViewState["InviteConsult"]);
        if (InviteConsultBLL.Model == null || InviteConsultBLL.Model.RecipientStaff != (int)Session["UserID"])
        {
            Response.Redirect("~/SubModule/DeskTop.aspx");
            return;
        }

        if (InviteConsultBLL.Model.ReadFlag != "Y")
        {
            InviteConsultBLL.SetReadFlag("Y");
        }

        EWF_Task_JobBLL JobBLL = new EWF_Task_JobBLL(InviteConsultBLL.Model.Job);
        if (JobBLL.Model.Status != 3)
        {
            MessageBox.Show(this, "该流程已不在等待邀请协助审批状态!");
            bt_SaveDecisionComment.Visible = false;
            tbx_DecisionComment.Visible    = false;
        }
        //绑定当前邀审相关信息
        lbl_CurrentJobName.Text = new EWF_Flow_ProcessBLL(JobBLL.Model.CurrentProcess).Model.Name;
        lbl_InvitedStaff.Text   = new Org_StaffBLL(InviteConsultBLL.Model.InvitedStaff).Model.RealName;
        lbl_InvitedTime.Text    = InviteConsultBLL.Model.InvitedTime.ToString("yyyy-MM-dd HH:mm");
        lb_DecisionComment.Text = InviteConsultBLL.Model.ConsultComment;
        #endregion

        #region 绑定流程信息
        EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]);
        ViewState["Initiator"] = task.Model.Initiator;
        //绑定流程信息
        lbl_Applyer.Text          = new Org_StaffBLL(task.Model.Initiator).Model.RealName;
        lbl_AppName.Text          = new EWF_Flow_AppBLL(task.Model.App).Model.Name;
        lbl_Title.Text            = task.Model.Title;
        hyl_RelateURL.NavigateUrl = task.Model.RelateURL;
        lb_Status.Text            = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name;

        lb_StartTime.Text = task.Model.StartTime.ToString();
        if (task.Model.EndTime != new DateTime(1900, 1, 1))
        {
            lb_EndTime.Text = task.Model.EndTime.ToString();
        }
        else
        {
            lb_EndTime.Text = "未结束";
        }

        lt_Remark.Text = task.Model.Remark;

        //显示申请详细信息IFrame
        if (!string.IsNullOrEmpty(task.Model.RelateURL))
        {
            tr_RelateUrl.Visible = true;
            string url = this.ResolveClientUrl(task.Model.RelateURL);
            if (url.IndexOf('?') >= 0)
            {
                url += "&ViewFramework=false&Decision=Y";
            }
            else
            {
                url += "?ViewFramework=false&Decision=Y";
            }
            frame_relateurl.Attributes.Add("src", url);
        }
        else
        {
            tr_RelateUrl.Visible = false;
        }

        //Bind the dataobject info
        NameValueCollection dataobjects = task.GetDataObjectValue();
        pl_dataobjectinfo.BindData(dataobjects);
        pl_dataobjectinfo.SetPanelEnable(false);
        TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null;
        if (tbx_ReMark != null)
        {
            tbx_ReMark.Enabled  = true;
            tbx_ReMark.ReadOnly = true;
        }
        //绑定审批历史
        this.gv_List_DecisionHistory.DataSource = task.GetDecisionHistory();
        this.gv_List_DecisionHistory.DataBind();

        //绑定附件
        gv_List_Attachment.BindGrid <EWF_Task_Attachment>(task.GetAttachmentsList());
        #endregion
    }
    //绑定基本信息
    private void BindTaskData()
    {
        #region 绑定当前工作项
        EWF_Task_InviteConsultBLL InviteConsultBLL = new EWF_Task_InviteConsultBLL((int)ViewState["InviteConsult"]);
        if (InviteConsultBLL.Model == null || InviteConsultBLL.Model.RecipientStaff != (int)Session["UserID"])
        {
            Response.Redirect("~/SubModule/DeskTop.aspx");
            return;
        }

        if (InviteConsultBLL.Model.ReadFlag != "Y")
        {
            InviteConsultBLL.SetReadFlag("Y");
        }

        EWF_Task_JobBLL JobBLL = new EWF_Task_JobBLL(InviteConsultBLL.Model.Job);
        if (JobBLL.Model.Status != 3)
        {
            MessageBox.Show(this, "该流程已不在等待邀请协助审批状态!");
            bt_SaveDecisionComment.Visible = false;
            tbx_DecisionComment.Visible = false;
        }
        //绑定当前邀审相关信息
        lbl_CurrentJobName.Text = new EWF_Flow_ProcessBLL(JobBLL.Model.CurrentProcess).Model.Name;
        lbl_InvitedStaff.Text = new Org_StaffBLL(InviteConsultBLL.Model.InvitedStaff).Model.RealName;
        lbl_InvitedTime.Text = InviteConsultBLL.Model.InvitedTime.ToString("yyyy-MM-dd HH:mm");
        lb_DecisionComment.Text = InviteConsultBLL.Model.ConsultComment;
        #endregion

        #region 绑定流程信息
        EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]);
        ViewState["Initiator"] = task.Model.Initiator;
        //绑定流程信息
        lbl_Applyer.Text = new Org_StaffBLL(task.Model.Initiator).Model.RealName;
        lbl_AppName.Text = new EWF_Flow_AppBLL(task.Model.App).Model.Name;
        lbl_Title.Text = task.Model.Title;
        hyl_RelateURL.NavigateUrl = task.Model.RelateURL;
        lb_Status.Text = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name;

        lb_StartTime.Text = task.Model.StartTime.ToString();
        if (task.Model.EndTime != new DateTime(1900, 1, 1))
            lb_EndTime.Text = task.Model.EndTime.ToString();
        else
            lb_EndTime.Text = "未结束";

        lt_Remark.Text = task.Model.Remark;

        //显示申请详细信息IFrame
        if (!string.IsNullOrEmpty(task.Model.RelateURL))
        {
            tr_RelateUrl.Visible = true;
            string url = this.ResolveClientUrl(task.Model.RelateURL);
            if (url.IndexOf('?') >= 0)
                url += "&ViewFramework=false&Decision=Y";
            else
                url += "?ViewFramework=false&Decision=Y";
            frame_relateurl.Attributes.Add("src", url);
        }
        else
        {
            tr_RelateUrl.Visible = false;
        }

        //Bind the dataobject info
        NameValueCollection dataobjects = task.GetDataObjectValue();
        pl_dataobjectinfo.BindData(dataobjects);
        pl_dataobjectinfo.SetPanelEnable(false);
        TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null;
        if (tbx_ReMark != null)
        {
            tbx_ReMark.Enabled = true;
            tbx_ReMark.ReadOnly = true;
        }
        //绑定审批历史
        this.gv_List_DecisionHistory.DataSource = task.GetDecisionHistory();
        this.gv_List_DecisionHistory.DataBind();

        //绑定附件
        gv_List_Attachment.BindGrid<EWF_Task_Attachment>(task.GetAttachmentsList());
        #endregion
    }