Example #1
0
        protected void BUTTON_SendRequest_Click(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowButtonEventArgs e)
        {
            svaedata();


            int        levid    = 0;
            DBTransfer takedata = new DBTransfer();

            SmoothEnterprise.Database.DataSet js = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
            //string idnm = "";


            ArrayList managerid = new ArrayList();  //主管id arraylist
            ArrayList managernm = new ArrayList();  //主管職稱 arraylist
            string    gid       = "";

            string[,] data = new string[1, 5];
            int    count  = 0;
            string firapp = "";
            string buf    = "";



            managerid.Add(PopupUser1.Text);
            managernm.Add("直屬主管");
            buf = PopupUser1.Text;

            int t = 0;

            js.Open("select gid from eipa.dbo.dguser where id='" + PopupUser1.Text + "'");
            //  Response.Write("select gid from eipa.dbo.dguser where id='" + PopupUser1.Text + "'");
            if (!js.EOF)
            {
                gid = js["gid"].ToString();
                while (levid < 10)
                {
                    //t++;
                    if (gid.Length > 10)
                    {
                        data = GetResGroup(gid);
                    }
                    if (data[0, 2] == null)
                    {
                        break;
                    }
                    else
                    {
                        if (data[0, 2].ToString().ToUpper() == "63D0329E-F4C2-44C6-950C-92174D233BED")
                        {
                        }
                        else
                        {
                            if (buf != data[0, 2].ToString())
                            {
                                managerid.Add(data[0, 2].ToString());
                                managernm.Add(data[0, 1].ToString());
                            }
                            buf = data[0, 2].ToString();
                        }

                        // Response.Write(data[0, 1].ToString() + "--" + data[0, 2].ToString() + "--" + data[0, 0].ToString() + "--" + data[0, 0].ToString() + "<br>");

                        gid   = data[0, 0].ToString();
                        levid = Int32.Parse(data[0, 4].ToString());
                    }

                    count++;
                    if (count > 8)
                    {
                        break;
                    }
                }
                //firapp = managerid[0].ToString();
            }
            js.Close();


            /*
             *         managerid.Add("FF0678EA-3EAF-4F1F-A012-1C54F93B48E2");
             *         managernm.Add("會計一");
             *
             *
             *         managerid.Add("D22FD429-E1EC-431D-99E6-1D7041F8A452");
             *         managernm.Add("會計主管");
             *
             *
             *
             *         managerid.Add("AB70A6C0-D106-4636-B1E1-15DFFF9A83C5");
             *         managernm.Add("財務長");
             */
            //---test --------------------
            // managerid.Clear();
            // managernm.Clear();


            // managerid.Add(PopupUser1.Text);
            // managernm.Add("主管1");
            string T1   = "";
            string T2   = "";
            string T3   = "";
            string par1 = "";

            js.Open("SELECT SUBSTRING(pmca00,1,1)T1, SUBSTRING(pmca00,1,1)+datadiff T2,datadiff T3 " +
                    "   FROM [EIPB].[dbo].[APMI610_IN] where rowid='" + Request.QueryString[0] + "'");
            if (!js.EOF)
            {
                T1 = js["T1"].ToString();
                T2 = js["T2"].ToString();
                T3 = js["T3"].ToString();
            }
            //if ((T1 != "I") || (T1 != "V")) par1 = T1;
            //else par1 = T2;

            switch (T1)
            {
            case "I":
            case "V":
                par1 = T1;
                break;

            case "U":
                par1 = T2;
                break;
            }

            // managerid.Add("D45938A7-3430-42EC-8BE6-0E1F391329E0");
            // managernm.Add("TEST");
            js.Close();

            if (par1 == "V")
            {
                if (addmemo() == "1")
                {
                    js.Open("SELECT PID,isnull(content1,'test') title FROM ERP_FLOW where ERP_NAME='APMI610Edit'" +
                            "   and  DEP_NAME='UY' order by  No asc ");
                }
                else
                {
                    js.Open("SELECT PID,isnull(content1,'test') title FROM ERP_FLOW where ERP_NAME='APMI610Edit'" +
                            "   and  DEP_NAME='" + par1 + "' order by  No asc ");
                }
            }
            else
            {
                js.Open("SELECT PID,isnull(content1,'test') title FROM ERP_FLOW where ERP_NAME='APMI610Edit'" +
                        "   and  DEP_NAME='" + par1 + "' order by  No asc ");
            }
            // Response.Write("SELECT PID,isnull(content1,'test') title FROM ERP_FLOW where ERP_NAME='APMI610Edit'" +
            //  "   and  DEP_NAME='" + par1 + "' order by  No asc ");

            while (!js.EOF)
            {
                managerid.Add(js["PID"].ToString());
                managernm.Add(js["title"].ToString());

                js.MoveNext();
            }



            //managerid.Add("13FEB136-9F48-416A-B495-7C2BE8C3B548");
            //managernm.Add("會計1");
            //managerid.Add("9D78E1CF-ED8E-47E0-8963-9534EF1FF3C3");
            //managernm.Add("會計2");
            //managerid.Add("13FEB136-9F48-416A-B495-7C2BE8C3B548");
            //managernm.Add("會計3");


            //managerid.Add("ab70a6c0-d106-4636-b1e1-15dfff9a83c5");
            //managernm.Add("財務長");
            //----------------------------



            FlowClient1.TypeName = "sharflow12_2.Flowwork.sharflow12_21";

            sharflow12_2.Flowwork.sharflow12_21 flow = new sharflow12_2.Flowwork.sharflow12_21();
            FlowClient1.Text = "供應商代號申請單"; //更改流程名稱

            switch (managerid.Count)       //依舊arraylist裡面有幾個,來判斷走那條flow
            {
            case 1:
                e.NextNode = flow.sharflow12_2Node1;
                break;

            case 2:
                e.NextNode = flow.sharflow12_2Node2;
                break;

            case 3:
                e.NextNode = flow.sharflow12_2Node4;
                break;

            case 4:
                e.NextNode = flow.sharflow12_2Node7;
                break;

            case 5:
                e.NextNode = flow.sharflow12_2Node11;
                break;

            case 6:
                e.NextNode = flow.sharflow12_2Node16;
                break;

            case 7:
                e.NextNode = flow.sharflow12_2Node22;
                break;

            case 8:
                e.NextNode = flow.sharflow12_2Node29;
                break;

            case 9:
                e.NextNode = flow.sharflow12_2Node37;
                break;

            case 10:
                e.NextNode = flow.sharflow12_2Node46;
                break;

            case 11:
                e.NextNode = flow.sharflow12_2Node56;
                break;
            }
            // e.NextNode.ReviewerURL = "/PManagement/DocControlView.aspx";
            e.NextNode.ReviewerURL = "/ERP_APMI610/APMI610View.aspx";

            count = 0;
            foreach (string i in managerid)  //將簽核人員id塞進flow
            {
                this.FlowClient1.AddParameter("USER" + count.ToString(), i);
                count++;
            }

            count = 0;

            foreach (string i in managernm)  //將簽核人員職稱塞進flow
            {
                this.FlowClient1.AddParameter("USERTITLE" + count.ToString(), i);
                count++;
            }


            //回寫單據狀泰
            string Sql = "update [EIPB].[dbo].[APMI610_IN] set   status='Y' where  rowid='" + Request.QueryString["rowid"] + "'";

            takedata.RunIUSql(Sql);


            //建立審核人員
            Sql = "insert into  [EIPB].[dbo].[doulog](rowid,appid,appdate )values('" + Request.QueryString["rowid"] + "','" +
                  PopupUser1.Text + "',getdate())";
            takedata.RunIUSql(Sql);


            //通知審核者
            js.Open("select name,email from dguser where id='" + PopupUser1.Text + "'");
            if (!js.EOF)
            {
                string snmemo = "";
                if (T1 == "U")
                {
                    if (T3 == "N")
                    {
                        snmemo = FIELD_pmcsn.Text + "類別" + FIELD_pmca00.Text + "無異動";
                    }
                    else
                    {
                        snmemo = FIELD_pmcsn.Text + "類別" + FIELD_pmca00.Text + "有異動";
                    }
                }
                else
                {
                    if (Labpmcaud01.Text == "Y")
                    {
                        snmemo = FIELD_pmcsn.Text + "類別" + FIELD_pmca00.Text + "->失效";
                    }
                    else
                    {
                        snmemo = FIELD_pmcsn.Text + "類別" + FIELD_pmca00.Text + "->有效";
                    }
                }


                MailLayout SenReq = new MailLayout();
                string     purl   = "http://eip.minaik.com.tw" + Request.RawUrl.ToLower().Replace("edit", "view");

                ShrFlowMail Backsend = new ShrFlowMail();
                // Backsend.SendMail("{166f4599-5482-4137-8060-eb1b2b82bbdb}", this.FlowClient1.Text, snmemo,
                //     js[0].ToString(), "*****@*****.**", purl, FlowClient1.Text);

                Backsend.SendMail("{166f4599-5482-4137-8060-eb1b2b82bbdb}", this.FlowClient1.Text, snmemo,
                                  js[0].ToString(), js[1].ToString(), purl, FlowClient1.Text);
            }
            js.Close();


            //通知代理人機制
            //  DeputyApprove(managerid[0].ToString());

            displayfile(false);



            BUTTON_save.Enabled = false;
            //ButCancel.Enabled = false;


            ButStop.Visible = true;

            PopupUser1.Visible = false;
            Label9.Visible     = false;
        }
Example #2
0
        protected void Btn_SendRequest_Click(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowButtonEventArgs e)
        {
            string rowid = Request.QueryString["rowid"];

            IPQC_Ra_Head db = new IPQC_Ra_Head();


            if (this.IsValid)
            {
                try
                {
                    this.Btn_SendRequest.Flow = this.FlowClient1;
                    _cStatus = status.Send;

                    db.UpdataStatus(rowid, status.Send);
                    setDisplay();
                    // lab_InspectNO.Text = AddONumber(Request.QueryString["rowid"]);

                    // Response.Write("<script>alert('執行送審');</script>");
                    //執行送審程序
                    ArrayList managerid = new ArrayList();  //主管id
                    ArrayList managernm = new ArrayList();  //主管 Text

                    managerid.Add(_leader);
                    managernm.Add("確認");

                    int count = 0;
                    foreach (string i in managerid)
                    {
                        this.FlowClient1.AddParameter("USER" + count.ToString(), i);
                        count++;
                    }
                    count = 0;
                    foreach (string i in managernm)
                    {
                        this.FlowClient1.AddParameter("USERTITLE" + count.ToString(), i);
                        count++;
                    }


                    sharflow12_2.Flowwork.sharflow12_21 flow = new sharflow12_2.Flowwork.sharflow12_21();
                    FlowClient1.Text = "IPQC Ra檢驗單 單號:" + lab_Ra_NO.Text;

                    switch (managerid.Count)  //依舊arraylist裡面有幾個,來判斷走那條flow
                    {
                    case 1:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 2:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 3:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 4:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 5:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 6:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 7:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 8:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 9:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 10:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 11:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 12:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 13:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 14:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;

                    case 15:
                        e.NextNode = flow.sharflow12_2Node1;
                        break;
                    }

                    e.NextNode.ReviewerURL = "/IPQC_Ra/IPQC_RaView.aspx";
                    FirstApprove(managerid[0].ToString());
                }
                catch (Exception ex)
                {
                    this.AddError(this, "BUTTON_save_Click()", "", ex.Message);
                }
            }
        }
        protected void BUTTON_SendRequest_Click(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowButtonEventArgs e)
        {
            //如果是 變更 單class_no=3 ,且是 MAY 的單子, 若有廠牌名稱,且要有廠牌ID

            string er = "0";

            //DBTransfer hs = new DBTransfer();//&& (this.FIELD_plantid.Text=="MAY")
            //if(Request.QueryString["class_no"]=="3"){

            // er=hs.GetTopfile("select COUNT(*) as a1 from  [EIPB].[dbo].[cimi100_turn]    where no='"+this.FIELD_NO.Text+"'"+
            //   "  and tc_imi031 is not null and  ISNULL(tc_imi03,'NA')<6 ");

            // }
            //if (er == "0")
            //{

            this.Button_AddItem.Enabled    = false;
            this.Button_UpdateItem.Enabled = false;
            this.InputButton1.Enabled      = true;
            this.InputButton2.Enabled      = false;
            this.BUTTON_save.Enabled       = true;



            SmoothEnterprise.Database.DataSet rb = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate);
            rb.Open("SELECT * FROM " + db1 + "cimi100_main WHERE id='" + Request.QueryString["id"] + "'  ");
            while (!rb.EOF)
            {
                rb["STATUS"] = "Y";

                rb.Update();
                rb.MoveNext();
            }
            rb.Close();

            this.BUTTON_SendRequest.Flow = this.FlowClient1;
            this.InputButton1.Enabled    = true;
            this.BUTTON_save.Enabled     = false;
            this.InputButton2.Enabled    = false;

            managerlevel aa        = new managerlevel(); //引用managerlevel class
            ArrayList    all       = new ArrayList();    //all arraylist
            ArrayList    managerid = new ArrayList();    //主管id arraylist
            ArrayList    managerlv = new ArrayList();    //主管階級 arraylist
            ArrayList    managernm = new ArrayList();    //主管職稱 arraylist

            #region 找集團文管id

            string LDCC = "";
            SmoothEnterprise.Database.DataSet rs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
            rs.Open("SELECT   PID FROM " + db2 + "erp_flow where erp_name='cimi100' and dep_name='DCC' and no='MAT'");
            if (!rs.EOF)
            {
                LDCC = rs["PID"].ToString();
            }
            rs.Close();

            #endregion

            if (this.FIELD_plantid.Text.Trim() == "MAT")
            {
                managerid.Add(LDCC.ToString());
                managernm.Add("集團文管中心");
            }
            else
            {
                managerid.Add(this.FIELD_DCC.Text.ToString());
                managernm.Add("子廠文管中心");

                managerid.Add(LDCC.ToString());
                managernm.Add("集團文管中心");
            }

            sharflow12_2.Flowwork.sharflow12_21 flow = new sharflow12_2.Flowwork.sharflow12_21();
            if (class_no.ToString() == "2")
            {
                FlowClient1.Text = "料件拋轉流程";
            }
            else
            {
                FlowClient1.Text = "料件變更流程";
            }
            switch (managerid.Count)  //依舊arraylist裡面有幾個,來判斷走那條flow
            {
            case 1:
                e.NextNode = flow.sharflow12_2Node1;
                break;

            case 2:
                e.NextNode = flow.sharflow12_2Node2;
                break;

            case 3:
                e.NextNode = flow.sharflow12_2Node4;
                break;

            case 4:
                e.NextNode = flow.sharflow12_2Node7;
                break;

            case 5:
                e.NextNode = flow.sharflow12_2Node11;
                break;

            case 6:
                e.NextNode = flow.sharflow12_2Node16;
                break;

            case 7:
                e.NextNode = flow.sharflow12_2Node22;
                break;

            case 8:
                e.NextNode = flow.sharflow12_2Node29;
                break;

            case 9:
                e.NextNode = flow.sharflow12_2Node37;
                break;

            case 10:
                e.NextNode = flow.sharflow12_2Node46;
                break;

            case 11:
                e.NextNode = flow.sharflow12_2Node56;
                break;

            case 12:
                e.NextNode = flow.sharflow12_2Node67;
                break;
            }
            e.NextNode.ReviewerURL = "/erp_cimi100/cimi100_turnView.aspx";

            int count = 0;
            foreach (string i in managerid)  //將簽核人員id塞進flow
            {
                this.FlowClient1.AddParameter("USER" + count.ToString(), i);
                // Response.Write("USER" + count.ToString() + ")" + i + "<br>");
                count++;
            }

            count = 0;

            foreach (string i in managernm)  //將簽核人員職稱塞進flow
            {
                this.FlowClient1.AddParameter("USERTITLE" + count.ToString(), i);
                count++;
            }

            ShrFlowMail Backsend = new ShrFlowMail();
            rs.Open("select name,email,id from " + db2 + "dguser  where id='" + this.FIELD_DCC.Text.ToString() + "' ");
            if (!rs.EOF)
            {
                Backsend.SendMail("{166f4599-5482-4137-8060-eb1b2b82bbdb}", this.FlowClient1.Text, this.FIELD_NO.Text, rs["name"].ToString(), rs["email"].ToString(), "http://eip.minaik.com.tw/ERP_Cimi100/Cimi100_turnView.aspx?id=" + Request.QueryString["id"] + "&class_no=" + Request.QueryString["class_no"], "--廠區:" + this.FIELD_plantid.Text + "<BR>--申請人員:" + this.FIELD_add_user.Text.Trim()); Dguserdeputy(rs["id"].ToString());
            }

            gridviewchange(this.FIELD_NO.Text);

            // }
            //else
            //{
            //hs.RunIUSql("delete from EIPA.dbo.dgflowqueue where requesturl='"+Request.RawUrl+"'") ;
            //   Response.Write("<script>alert('輸入的廠牌名稱/ID 是有問題!');</script>");
            // /ERP_CIMI100/CIMI100_TurnEdit.aspx?id=34ea9fc2-14a7-411b-bfa9-6840ce49f7c5&class_no=3

            //string urlc="
            // Response.Write("delete from EIPA.dbo.dgflowqueue where requesturl='" + Request.RawUrl + "'");
            //}
        }
Example #4
0
        protected void BUTTON_SendRequest_Click(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowButtonEventArgs e)
        {
            int        levid    = 0;
            DBTransfer takedata = new DBTransfer();

            SmoothEnterprise.Database.DataSet js = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
            //string idnm = "";


            ArrayList managerid = new ArrayList(); //主管id arraylist
            ArrayList managernm = new ArrayList(); //主管職稱 arraylist
            string    gid       = "";

            string[,] data = new string[1, 5];
            int    count  = 0;
            string firapp = "";
            string buf    = "";
            int    t      = 0;

            js.Open("select  pid from ERP_FLOW WHERE ERP_NAME='apmt420' and dep_name='acc'  " +
                    "  and NO  in ('2','2_2')  and company='MINAIK'  order by no asc ");

            while (!js.EOF)
            {
                t++;
                managerid.Add(js[0].ToString());
                managernm.Add("會計" + t.ToString());
                js.MoveNext();
            }


            managerid.Add(PopupUser1.Text);
            managernm.Add("直屬主管");


            t = 0;

            #region
            js.Open("select gid from eipa.dbo.dguser where id='" + PopupUser1.Text + "'");
            if (!js.EOF)
            {
                gid = js["gid"].ToString();
                while (levid <= 10)
                {
                    //t++;
                    data = GetResGroup(gid);
                    if (data[0, 2] == null)
                    {
                        break;
                    }
                    else
                    {
                        if (data[0, 2].ToString().ToUpper() == "63D0329E-F4C2-44C6-950C-92174D233BED")
                        {
                            managerid.Add("63D0329E-F4C2-44C6-950C-92174D233BED");
                            managernm.Add("CEO");
                        }
                        else
                        {
                            if (buf != data[0, 2].ToString())
                            {
                                managerid.Add(data[0, 2].ToString());
                                managernm.Add(data[0, 1].ToString());
                            }
                            buf = data[0, 2].ToString();
                        }

                        // Response.Write(data[0, 1].ToString() + "--" + data[0, 2].ToString() + "--" + data[0, 0].ToString() + "--" + data[0, 0].ToString() + "<br>");

                        gid   = data[0, 0].ToString();
                        levid = Int32.Parse(data[0, 4].ToString());
                    }

                    count++;
                    if (count > 8)
                    {
                        break;
                    }
                }
                //firapp = managerid[0].ToString();
            }
            js.Close();

            #endregion


            /*
             * managerid.Add("FF0678EA-3EAF-4F1F-A012-1C54F93B48E2");
             * managernm.Add("會計一");
             *
             *
             * managerid.Add("D22FD429-E1EC-431D-99E6-1D7041F8A452");
             * managernm.Add("會計主管");
             *
             *
             *
             * managerid.Add("AB70A6C0-D106-4636-B1E1-15DFFF9A83C5");
             * managernm.Add("財務長");
             */
            //---test --------------------
            // 1 代表是MIS 的單子

            if (FIELD_tc_cba01.Text.Substring(0, 1) == "1")
            {
                //MIS 主管
                //managerid.Add("B76FC2D3-7910-4641-A51B-8B6023C567AE");
                //managernm.Add("MIS 主管");

                //加SI
                string siid = takedata.GetTopfile("SELECT ISNULL(b.si_id,'0DC215C7-0043-4CD6-AC6E-659ECDC88994') FROM eipb.dbo.CBGI014_Head " +
                                                  " left join [EIPB].[dbo].[Sta_erpdep] b on tc_cba01=b.tip_depno " +
                                                  " WHERE rowid='" + Request.QueryString[0] + "'");

                managerid.Add(siid);
                managernm.Add("SI");
                //MIS  主管  Review
                managerid.Add("B76FC2D3-7910-4641-A51B-8B6023C567AE");
                managernm.Add("MIS 主管");


                //判斷有沒有連簽兩次
                #region
                for (int i = managerid.Count - 1; i >= 0; i--)
                {
                    for (int k = 0; k < i; k++)
                    {
                        if (managerid[i].ToString().ToUpper() == managerid[k].ToString().ToUpper())
                        {
                            managerid[k] = "";
                        }
                    }
                }

                //砍掉57334E67-59A6-4147-B447-DBCCBC90909A
                for (int i = managerid.Count - 1; i >= 0; i--)
                {
                    if (managerid[i].ToString().ToUpper() == "57334E67-59A6-4147-B447-DBCCBC90909A")
                    {
                        managerid[i] = "";
                    }
                }

                for (int i = managerid.Count - 1; i >= 0; i--)
                {
                    if (managerid[i] == "")
                    {
                        managerid.RemoveAt(i);
                        managernm.RemoveAt(i);
                        //Response.Write("-----<br>");
                    }
                }
                #endregion



                siid = takedata.GetTopfile("SELECT bossApp  FROM eipb.dbo.CBGI014_Head " +
                                           " left join [EIPB].[dbo].[Sta_erpdep] b on tc_cba01=b.tip_depno " +
                                           " WHERE rowid='" + Request.QueryString[0] + "'");

                if (siid == "Y")
                {
                    managerid.Add("57334E67-59A6-4147-B447-DBCCBC90909A");
                    managernm.Add("副營運長");
                }
            }
            else
            {
                //判斷有沒有連簽兩次
                #region
                for (int i = managerid.Count - 1; i >= 0; i--)
                {
                    for (int k = 0; k < i; k++)
                    {
                        if (managerid[i].ToString().ToUpper() == managerid[k].ToString().ToUpper())
                        {
                            managerid[k] = "";
                        }
                    }
                }

                //砍掉57334E67-59A6-4147-B447-DBCCBC90909A
                //for (int i = managerid.Count - 1; i >= 0; i--)
                //{
                //    if (managerid[i].ToString().ToUpper() == "57334E67-59A6-4147-B447-DBCCBC90909A") managerid[i] = "";

                //}

                for (int i = managerid.Count - 1; i >= 0; i--)
                {
                    if (managerid[i] == "")
                    {
                        managerid.RemoveAt(i);
                        managernm.RemoveAt(i);
                        //Response.Write("-----<br>");
                    }
                }
                #endregion
            }



            FlowClient1.TypeName = "sharflow12_2.Flowwork.sharflow12_21";

            sharflow12_2.Flowwork.sharflow12_21 flow = new sharflow12_2.Flowwork.sharflow12_21();
            FlowClient1.Text = "固定資產預算申請單"; //更改流程名稱



            string Sqlc = "insert into  [EIPB].[dbo].[doulog](rowid,appid,appdate )values('" + Request.QueryString["rowid"] + "','" +
                          managerid[0].ToString() + "',getdate())";
            takedata.RunIUSql(Sqlc);

            switch (managerid.Count) //依舊arraylist裡面有幾個,來判斷走那條flow
            {
            case 1:
                e.NextNode = flow.sharflow12_2Node1;
                break;

            case 2:
                e.NextNode = flow.sharflow12_2Node2;
                break;

            case 3:
                e.NextNode = flow.sharflow12_2Node4;
                break;

            case 4:
                e.NextNode = flow.sharflow12_2Node7;
                break;

            case 5:
                e.NextNode = flow.sharflow12_2Node11;
                break;

            case 6:
                e.NextNode = flow.sharflow12_2Node16;
                break;

            case 7:
                e.NextNode = flow.sharflow12_2Node22;
                break;

            case 8:
                e.NextNode = flow.sharflow12_2Node29;
                break;

            case 9:
                e.NextNode = flow.sharflow12_2Node37;
                break;

            case 10:
                e.NextNode = flow.sharflow12_2Node46;
                break;
            }

            string purl = "";
            // e.NextNode.ReviewerURL = "/PManagement/DocControlView.aspx";
            if (FIELD_tc_cba01.Text.Substring(0, 1) == "1")
            {
                e.NextNode.ReviewerURL = "/ERP_CBGI014/CBGI014View.aspx";
                purl = "http://eip.minaik.com.tw" + Request.RawUrl.ToLower().Replace("edit", "view");
            }
            else
            {
                e.NextNode.ReviewerURL = "/ERP_CBGI014/CBGI014_AccView.aspx";
                purl = "http://eip.minaik.com.tw/ERP_CBGI014/CBGI014_AccView.aspx";
            }
            count = 0;
            foreach (string i in managerid) //將簽核人員id塞進flow
            {
                this.FlowClient1.AddParameter("USER" + count.ToString(), i);
                count++;
            }

            count = 0;

            foreach (string i in managernm) //將簽核人員職稱塞進flow
            {
                this.FlowClient1.AddParameter("USERTITLE" + count.ToString(), i);
                count++;
            }


            //回寫單據狀泰
            string Sql = "update [EIPB].[dbo].[CBGI014_Head] set   status='Y' where  rowid='" + Request.QueryString["rowid"] + "'";
            takedata.RunIUSql(Sql);

            // Response.Write("select name,email from dguser where id='" + managerid[0].ToString() + "'");
            //通知審核者
            js.Open("select name,email from dguser where id='" + managerid[0].ToString() + "'");
            if (!js.EOF)
            {
                string snmemo = FIELD_sn.Text + "-" + FIELD_tc_cba00.Text + "-" + FIELD_ver.Text + "-" + FIELD_tc_cba01.Text;



                //Response.Write("<br>" + snmemo);
                MailLayout SenReq = new MailLayout();

                //Response.Write("<br>" + purl);
                ShrFlowMail Backsend = new ShrFlowMail();
                Backsend.SendMail("{166f4599-5482-4137-8060-eb1b2b82bbdb}", FlowClient1.Text, FIELD_sn.Text,
                                  js[0].ToString(), js[1].ToString(), purl, "");
            }
            js.Close();


            //通知代理人機制
            //  DeputyApprove(managerid[0].ToString());

            displayfile(false);



            BUTTON_save.Enabled = false;



            ButStop.Visible = true;

            PopupUser1.Visible = false;
            Label3.Visible     = false;
        }