protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            FineOffice.Modules.OA_FlowProcess model = processBll.GetModel(p => p.ID == txtID.Text);
            model.ProcessPersonnel  = hiddenPersonnel.Text;
            model.ProcessDepartment = hiddenDepartment.Text;
            string[] oprate = chkOprate.SelectedValueArray;

            if (oprate.Contains("AllowRefuse"))
            {
                model.AllowRefuse = true;
            }
            else
            {
                model.AllowRefuse = false;
            }

            if (oprate.Contains("AllowGoBack"))
            {
                model.AllowGoBack = true;
            }
            else
            {
                model.AllowGoBack = false;
            }

            if (oprate.Contains("Feedback"))
            {
                model.Feedback = true;
            }
            else
            {
                model.Feedback = false;
            }

            model.TimeLimit = int.Parse(txtTimeLimit.Text);
            model.Remind    = int.Parse(txtRemind.Text);
            processBll.Update(model);
            PageContext.RegisterStartupScript(ActiveWindow.GetHideReference());
        }
        catch (Exception ex)
        {
            Alert.ShowInParent(ex.Message);
        }
    }
    private void LoadData()
    {
        List <FineOffice.Modules.HR_Department> list = departmentBll.GetListAll();

        ddlDepartment.Items.Clear();
        FineUI.ListItem li = new FineUI.ListItem();
        li.Value = "";
        li.Text  = "<全部>";
        ddlDepartment.Items.Add(li);
        foreach (FineOffice.Modules.HR_Department department in list)
        {
            FineUI.ListItem item = new FineUI.ListItem();
            item.Text  = department.DepartmentName;
            item.Value = department.ID.ToString();
            ddlDepartment.Items.Add(item);
        }
        FineOffice.Modules.OA_FlowProcess model = processBll.GetModel(p => p.ID == Request["Process"]);
        hiddenDepartment.Text = model.ProcessDepartment;
        hiddenPerson.Text     = model.ProcessPersonnel;
    }
Ejemplo n.º 3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string xml = txtXML.Text.Trim();

        model     = flowBll.GetModel(f => f.ID == int.Parse(txtID.Text));
        model.XML = xml;

        if (xml.Length > 0)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(xml);
            ChangeTrackingList <FineOffice.Modules.OA_FlowProcess> list = new ChangeTrackingList <FineOffice.Modules.OA_FlowProcess>();

            XmlNodeList processNodes = xmlDoc.SelectNodes("/process");
            int         flowID       = int.Parse(processNodes[0].Attributes["ID"].Value);

            XmlNodeList startNodes = xmlDoc.SelectNodes("/process/start");

            //开始节点
            if (startNodes.Count > 0)
            {
                FineOffice.Modules.OA_FlowProcess process = new FineOffice.Modules.OA_FlowProcess();
                process.ID          = startNodes[0].Attributes["id"].Value;
                process.ProcessName = startNodes[0].Attributes["name"].Value;
                process.Remark      = startNodes[0].Attributes["Remark"].Value;
                process.IsStart     = true;
                process.IsEnd       = false;
                process.FlowID      = flowID;

                XmlNodeList   toNodes = xmlDoc.SelectNodes("/process/start/transition");
                StringBuilder next    = new StringBuilder();
                foreach (XmlNode node in toNodes)
                {
                    next.Append(node.Attributes["to"].Value);
                    next.Append(",");
                }
                process.Next = next.ToString();
                list.Add(process);
            }

            XmlNodeList endNodes = xmlDoc.SelectNodes("/process/end");
            foreach (XmlNode node in endNodes)
            {
                FineOffice.Modules.OA_FlowProcess process = new FineOffice.Modules.OA_FlowProcess();
                process.ID          = node.Attributes["id"].Value;
                process.ProcessName = node.Attributes["name"].Value;
                process.Remark      = node.Attributes["Remark"].Value;
                process.IsEnd       = true;
                process.IsStart     = false;
                process.FlowID      = flowID;
                list.Add(process);
            }

            XmlNodeList taskNodes = xmlDoc.SelectNodes("/process/task");
            foreach (XmlNode node in taskNodes)
            {
                FineOffice.Modules.OA_FlowProcess process = new FineOffice.Modules.OA_FlowProcess();
                process.ID          = node.Attributes["id"].Value;
                process.ProcessName = node.Attributes["name"].Value;
                process.Remark      = node.Attributes["Remark"].Value;
                process.FlowID      = flowID;
                process.IsEnd       = false;
                process.IsStart     = false;

                XmlNodeList   toNodes = xmlDoc.SelectNodes("/process/task/transition");
                StringBuilder next    = new StringBuilder();
                foreach (XmlNode toNode in toNodes)
                {
                    next.Append(toNode.Attributes["to"].Value);
                    next.Append(",");
                }
                process.Next = next.ToString();
                list.Add(process);
            }
            model.OA_FlowProcessList = list;
        }
        try
        {
            flowBll.UpdateProcess(model);
            FineUI.Alert.ShowInParent("已保存到服务器!");
        }
        catch (Exception ex)
        {
            FineUI.Alert.ShowInParent(ex.Message);
        }
    }
Ejemplo n.º 4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.CookiePersonnel == null)
        {
            Alert.ShowInParent("当前用户不存在职员信息,不能新建工作!");
            return;
        }
        FineOffice.Modules.OA_FlowRun model = new FineOffice.Modules.OA_FlowRun();
        model.WorkNO = txtWorkNO.Text;
        model.FlowID = int.Parse(txtFlowID.Text);
        FineOffice.Modules.OA_FlowProcess process = processBll.GetModel(r => r.FlowID == model.FlowID && r.IsStart == true);
        if (process == null)
        {
            Alert.ShowInParent("工作流程没有开始步骤,不能新建工作!");
            return;
        }

        bool state = false;

        if (process.ProcessDepartment != null)
        {
            string[] deparment = process.ProcessDepartment.Split(',');
            if (deparment.Where(s => s == this.CookiePersonnel.DepartmentID.ToString()).Count() > 0)
            {
                state = true;
            }
        }
        if (process.ProcessPersonnel != null)
        {
            string[] personnel = process.ProcessPersonnel.Split(',');
            if (personnel.Where(s => s == this.CookiePersonnel.ID.ToString()).Count() > 0)
            {
                state = true;
            }
        }
        if (process.ProcessDepartment == null && process.ProcessPersonnel == null)
        {
            state = true;
        }
        if (!state)
        {
            Alert.ShowInParent("当前用户没有操作该步骤的权限,不能新建工作!");
            return;
        }
        model.WorkName   = txtWorkName.Text.Trim();
        model.CreateTime = DateTime.Parse(dtpDate.Text.Trim() + " " + dtpTime.Text);
        model.Remark     = txtRemark.Text;
        model.Creator    = CookiePersonnel.ID;
        FineOffice.Modules.OA_FlowRunProcess runProcess = new FineOffice.Modules.OA_FlowRunProcess();
        runProcess.AcceptID   = this.CookiePersonnel.ID;
        runProcess.SendID     = this.CookiePersonnel.ID;
        runProcess.ProcessID  = process.ID;
        runProcess.AcceptTime = model.CreateTime;
        runProcess.RunID      = model.ID;
        runProcess.State      = 0;
        runProcess.Pattern    = 0;
        runProcess.AcceptTime = model.CreateTime;
        runProcess.State      = 0;
        runProcess.IsEntrance = true;
        runProcess.AcceptID   = this.CookiePersonnel.ID;
        model.OA_FlowRunProcessList.Add(runProcess);

        try
        {
            model = runBll.Add(model);
            ChangeTrackingList <EntitySearcher> searchList = new ChangeTrackingList <EntitySearcher>();
            EntitySearcher searcher = new EntitySearcher();
            searcher.Content  = model.ID.ToString();
            searcher.Operator = "=";
            searcher.Field    = "RunID";
            searcher.Relation = "OR";
            searchList.Add(searcher);
            FineOffice.Modules.OA_FlowRunProcess temp = runProcessBll.GetList(searchList)[0];
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("Close&" + temp.ID));
        }
        catch (Exception ex)
        {
            Alert.ShowInParent(ex.Message);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request["ID"] != null)
            {
                btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference();
                FineOffice.Modules.OA_FlowProcess model = processBll.GetModel(p => p.ID == Request["ID"]);
                txtID.Text            = model.ID;
                txtProcessName.Text   = model.ProcessName;
                hiddenDepartment.Text = model.ProcessDepartment;
                hiddenPersonnel.Text  = model.ProcessPersonnel;

                List <string> list = new List <string>();
                if (model.AllowRefuse.Value)
                {
                    list.Add("AllowRefuse");
                }
                if (model.AllowGoBack.Value)
                {
                    list.Add("AllowGoBack");
                }
                if (model.Feedback.Value)
                {
                    list.Add("Feedback");
                }
                chkOprate.SelectedValueArray = list.ToArray();
                txtTimeLimit.Text            = model.TimeLimit.ToString();
                txtRemind.Text = model.Remind.ToString();

                model.TimeLimit = int.Parse(txtTimeLimit.Text);
                model.Remind    = int.Parse(txtRemind.Text);

                #region 职员信息绑定
                List <int> personnel = new List <int>();
                if (model.ProcessPersonnel != null)
                {
                    string[] str = model.ProcessPersonnel.Split(',');
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (str[i].Length > 0)
                        {
                            personnel.Add(int.Parse(str[i]));
                        }
                    }
                }

                List <FineOffice.Modules.HR_Personnel> personnelList = personnelBll.GetList(d => personnel.Contains(d.ID)).ToList();
                StringBuilder sbPersonnel = new StringBuilder();

                for (int i = 0; i < personnelList.Count; i++)
                {
                    sbPersonnel.Append(personnelList[i].Name);
                    sbPersonnel.Append(",");
                }
                txtPersonnel.Text = sbPersonnel.ToString();
                #endregion

                #region 部门信息绑定
                List <int> department = new List <int>();
                if (model.ProcessDepartment != null)
                {
                    string[] str = model.ProcessDepartment.Split(',');
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (str[i].Length > 0)
                        {
                            department.Add(int.Parse(str[i]));
                        }
                    }
                }
                List <FineOffice.Modules.HR_Department> departmentList = departmentBll.GetList(d => department.Contains(d.ID)).ToList();

                StringBuilder sbDepartment = new StringBuilder();
                for (int i = 0; i < departmentList.Count; i++)
                {
                    sbDepartment.Append(departmentList[i].DepartmentName);
                    sbDepartment.Append(",");
                }
                txtDepartment.Text = sbDepartment.ToString();
                #endregion

                OnClientClick();
            }
        }
        if (Request.Form["__EVENTARGUMENT"] == "param_from_selected")
        {
            OnClientClick();
        }
    }