protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["seq"] = Request.QueryString["seq"];
            //Session["seq"] = "30918";

            //Session["seq"] = "30979";

            #region offday

            sql = " select distinct(t.offday) as offday from onduty t " +
                  " where t.offday not in ('OFF','ON')      ";
            ds_temp = func.get_dataSet_access(sql, conn);

            TextBox_ARS_LINK.Text = "";

            RadioButtonList_OFFDAY.DataSource = ds_temp.Tables[0];

            RadioButtonList_OFFDAY.DataTextField  = "offday";
            RadioButtonList_OFFDAY.DataValueField = "offday";
            RadioButtonList_OFFDAY.DataBind();


            #endregion


            #region rejudge_flag

            string[] rejudge_flag = { "Y", "N" };

            RadioButtonList1.DataSource = rejudge_flag;
            RadioButtonList1.DataBind();
            RadioButtonList1.SelectedValue = "N";
            #endregion


            #region CLOSE_FLAG

            string[] CLOSE_FLAG = { "OPEN", "CLOSE" };

            RadioButtonList_CLOSE_FLAG.DataSource = rejudge_flag;
            RadioButtonList_CLOSE_FLAG.DataBind();
            RadioButtonList_CLOSE_FLAG.SelectedValue = "CLOSE";
            #endregion


            #region ALARM_FLAG

            string[] ALARM_FLAG = { "ON", "OFF" };

            RadioButtonList_ALARM_FLAG.DataSource = rejudge_flag;
            RadioButtonList_ALARM_FLAG.DataBind();
            RadioButtonList_ALARM_FLAG.SelectedValue = "OFF";
            #endregion


            #region ARS_FLAG

            string[] ARS_FLAG = { "ON", "OFF" };

            RadioButtonList_ARS_FLAG.DataSource = rejudge_flag;
            RadioButtonList_ARS_FLAG.DataBind();
            RadioButtonList_ARS_FLAG.SelectedValue = "OFF";
            #endregion


            #region CLOSE_FLAG
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CLOSE_FLAG.txt");



            RadioButtonList_CLOSE_FLAG.DataSource = arlist_temp1;
            RadioButtonList_CLOSE_FLAG.DataBind();
            #endregion

            #region ALARM_FLAG
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ALARM_FLAG.txt");


            RadioButtonList_ALARM_FLAG.DataSource = arlist_temp1;
            RadioButtonList_ALARM_FLAG.DataBind();
            #endregion


            #region ARS_FLAG
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ARS_FLAG.txt");



            RadioButtonList_ARS_FLAG.DataSource = arlist_temp1;
            RadioButtonList_ARS_FLAG.DataBind();
            #endregion

            #region ENG_DEP
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ENG_DEP.txt");



            DropDownList_ENG_DEP.DataSource = arlist_temp1;
            DropDownList_ENG_DEP.DataBind();
            #endregion

            #region ENGINEER


            DropDownList_ENGINEER.Items.Insert(0, "請選擇");

            #endregion


            #region hour
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\hour.txt");



            DropDownList1.DataSource = arlist_temp1;
            DropDownList1.DataBind();


            DropDownList3.DataSource = arlist_temp1;
            DropDownList3.DataBind();


            DropDownList5.DataSource = arlist_temp1;
            DropDownList5.DataBind();

            #endregion


            #region min
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\min.txt");



            DropDownList2.DataSource = arlist_temp1;
            DropDownList2.DataBind();


            DropDownList4.DataSource = arlist_temp1;
            DropDownList4.DataBind();


            DropDownList6.DataSource = arlist_temp1;
            DropDownList6.DataBind();

            #endregion


            #region fab
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab.txt");



            DropDownList1_FAB.DataSource = arlist_temp1;
            DropDownList1_FAB.DataBind();
            DropDownList1_FAB.Items.Insert(0, "請選擇");



            #endregion


            #region SYSTEM
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab_System.txt");



            DropDownList_SYSTEM.DataSource = arlist_temp1;
            DropDownList_SYSTEM.DataBind();
            DropDownList_SYSTEM.Items.Insert(0, "請選擇");



            #endregion

            #region TYPE
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab_TYPE.txt");



            DropDownList_TYPE.DataSource = arlist_temp1;
            DropDownList_TYPE.DataBind();
            DropDownList_TYPE.Items.Insert(0, "請選擇");



            #endregion


            #region PRODUCT_IMPACT
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_PRODUCT_IMPACT.txt");



            DropDownList_PRODUCT_IMPACT.DataSource = arlist_temp1;
            DropDownList_PRODUCT_IMPACT.DataBind();
            DropDownList_PRODUCT_IMPACT.Items.Insert(0, "請選擇");



            #endregion


            #region ASSIGN_OWNER
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CIM_MEMBER.txt");



            DropDownList_ASSIGN_OWNER.DataSource = arlist_temp1;
            DropDownList_ASSIGN_OWNER.DataBind();
            DropDownList_ASSIGN_OWNER.Items.Insert(0, "請選擇");



            #endregion

            #region BY_WHOM
            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CIM_MEMBER.txt");



            DropDownList_BY_WHOM.DataSource = arlist_temp1;
            DropDownList_BY_WHOM.DataBind();
            DropDownList_BY_WHOM.Items.Insert(0, "請選擇");



            #endregion



            bind_data1();

            #region hyperlink

            HyperLink hp = new HyperLink();
            hp = HyperLink_ARS_LINK;
            if (!TextBox_ARS_LINK.Text.Trim().Equals(""))
            {
                hp.NavigateUrl = TextBox_ARS_LINK.Text;
                hp.Target      = "_blank";
                hp.Visible     = true;
            }

            #endregion
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["seq"] = Request.QueryString["seq"];
            //Session["seq"] = "30918";

            //Session["seq"] = "30840";

            #region offday


            string[] offday = { "日A", "日B", "夜A", "夜B", "常日" };

            TextBox_ARS_LINK.Text = "";

            RadioButtonList_OFFDAY.DataSource = offday;
            RadioButtonList_OFFDAY.DataBind();

            RadioButtonList_OFFDAY.SelectedValue = GetClass(today, todayHour);
            //RadioButtonList_OFFDAY.SelectedValue = "DB";

            #endregion


            #region rejudge_flag

            string[] rejudge_flag = { "Y", "N" };

            RadioButtonList1.DataSource = rejudge_flag;
            RadioButtonList1.DataBind();
            RadioButtonList1.SelectedValue = "N";
            #endregion


            #region CLOSE_FLAG

            string[] closeFlag = { "OPEN", "CLOSE" };

            RadioButtonList_CLOSE_FLAG.DataSource = rejudge_flag;
            RadioButtonList_CLOSE_FLAG.DataBind();
            RadioButtonList_CLOSE_FLAG.SelectedValue = "OPEN";
            #endregion


            #region ALARM_FLAG

            string[] alarmFlag = { "ON", "OFF" };

            RadioButtonList_ALARM_FLAG.DataSource = rejudge_flag;
            RadioButtonList_ALARM_FLAG.DataBind();
            RadioButtonList_ALARM_FLAG.SelectedValue = "OFF";
            #endregion


            #region ARS_FLAG

            string[] arsFlag = { "ON", "OFF" };

            RadioButtonList_ARS_FLAG.DataSource = rejudge_flag;
            RadioButtonList_ARS_FLAG.DataBind();
            RadioButtonList_ARS_FLAG.SelectedValue = "OFF";
            #endregion


            #region CLOSE_FLAG
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CLOSE_FLAG.txt");



            RadioButtonList_CLOSE_FLAG.DataSource = arlistTemp1;
            RadioButtonList_CLOSE_FLAG.DataBind();
            #endregion

            #region ALARM_FLAG
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ALARM_FLAG.txt");


            RadioButtonList_ALARM_FLAG.DataSource = arlistTemp1;
            RadioButtonList_ALARM_FLAG.DataBind();
            #endregion


            #region ARS_FLAG
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ARS_FLAG.txt");



            RadioButtonList_ARS_FLAG.DataSource = arlistTemp1;
            RadioButtonList_ARS_FLAG.DataBind();
            #endregion

            #region ENG_DEP
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ENG_DEP.txt");



            DropDownList_ENG_DEP.DataSource = arlistTemp1;
            DropDownList_ENG_DEP.DataBind();
            #endregion

            #region ENGINEER


            DropDownList_ENGINEER.Items.Insert(0, "請選擇");

            #endregion

            #region date

            txtEstimateCALLTIME.SelectedDate  = Convert.ToDateTime(today);
            txtEstimateSTARTTIME.SelectedDate = Convert.ToDateTime(today);
            txtEstimateEndTime.SelectedDate   = Convert.ToDateTime(today);



            #endregion


            #region hour
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\hour.txt");



            DropDownList1.DataSource = arlistTemp1;
            DropDownList1.DataBind();
            DropDownList1.SelectedValue = todayHour;


            DropDownList3.DataSource = arlistTemp1;
            DropDownList3.DataBind();
            DropDownList3.SelectedValue = todayHour;


            DropDownList5.DataSource = arlistTemp1;
            DropDownList5.DataBind();
            DropDownList5.SelectedValue = todayHour;

            #endregion


            #region min
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\min.txt");



            DropDownList2.DataSource = arlistTemp1;
            DropDownList2.DataBind();
            DropDownList2.SelectedValue = todayMin;



            DropDownList4.DataSource = arlistTemp1;
            DropDownList4.DataBind();
            DropDownList4.SelectedValue = todayMin;

            DropDownList6.DataSource = arlistTemp1;
            DropDownList6.DataBind();
            DropDownList6.SelectedValue = todayMin;

            #endregion


            #region fab
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab.txt");



            DropDownList1_FAB.DataSource = arlistTemp1;
            DropDownList1_FAB.DataBind();
            DropDownList1_FAB.Items.Insert(0, "請選擇");



            #endregion


            #region SYSTEM
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab_System.txt");



            DropDownList_SYSTEM.DataSource = arlistTemp1;
            DropDownList_SYSTEM.DataBind();
            DropDownList_SYSTEM.Items.Insert(0, "請選擇");



            #endregion

            #region TYPE
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab_TYPE.txt");



            DropDownList_TYPE.DataSource = arlistTemp1;
            DropDownList_TYPE.DataBind();
            DropDownList_TYPE.Items.Insert(0, "請選擇");



            #endregion


            #region PRODUCT_IMPACT
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_PRODUCT_IMPACT.txt");



            DropDownList_PRODUCT_IMPACT.DataSource = arlistTemp1;
            DropDownList_PRODUCT_IMPACT.DataBind();
            DropDownList_PRODUCT_IMPACT.Items.Insert(0, "請選擇");



            #endregion


            #region ASSIGN_OWNER
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CIM_MEMBER.txt");



            DropDownList_ASSIGN_OWNER.DataSource = arlistTemp1;
            DropDownList_ASSIGN_OWNER.DataBind();
            DropDownList_ASSIGN_OWNER.Items.Insert(0, "請選擇");



            #endregion

            #region BY_WHOM
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CIM_MEMBER.txt");



            DropDownList_BY_WHOM.DataSource = arlistTemp1;
            DropDownList_BY_WHOM.DataBind();
            DropDownList_BY_WHOM.Items.Insert(0, "請選擇");



            #endregion

            #region due_time
            Label1.Text = "0";
            #endregion



            // BindData1();

            #region hyperlink

            HyperLink hp = new HyperLink();
            hp = HyperLink_ARS_LINK;
            if (TextBox_ARS_LINK.Text.Trim() != null)
            {
                hp.NavigateUrl = TextBox_ARS_LINK.Text;
                hp.Target      = "_blank";
            }

            #endregion
        }
    }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["seq"] = (Request.QueryString["seq"] != null) ? Request.QueryString["seq"].ToString() : "45787";



            //Session["seq"] = "30918";

            //Session["seq"] = "45097";

            #region offday

            sql = " select distinct(t.offday) as offday from onduty t " +
                  " where t.offday not in ('OFF','ON')      ";
            dsTemp = func.get_dataSet_access(sql, conn);

            TextBox_ARS_LINK.Text = "";

            RadioButtonList_OFFDAY.DataSource = dsTemp.Tables[0];

            RadioButtonList_OFFDAY.DataTextField  = "offday";
            RadioButtonList_OFFDAY.DataValueField = "offday";
            RadioButtonList_OFFDAY.DataBind();


            #endregion


            #region rejudge_flag

            string[] rejudge_flag = { "Y", "N" };

            RadioButtonList1.DataSource = rejudge_flag;
            RadioButtonList1.DataBind();
            RadioButtonList1.SelectedValue = "N";
            #endregion


            #region CLOSE_FLAG

            string[] closeFlag = { "OPEN", "CLOSE" };

            RadioButtonList_CLOSE_FLAG.DataSource = rejudge_flag;
            RadioButtonList_CLOSE_FLAG.DataBind();
            RadioButtonList_CLOSE_FLAG.SelectedValue = "CLOSE";
            #endregion


            #region ALARM_FLAG

            string[] alarmFlag = { "ON", "OFF" };

            RadioButtonList_ALARM_FLAG.DataSource = rejudge_flag;
            RadioButtonList_ALARM_FLAG.DataBind();
            RadioButtonList_ALARM_FLAG.SelectedValue = "OFF";
            #endregion


            #region ARS_FLAG

            string[] arsFlag = { "ON", "OFF" };

            RadioButtonList_ARS_FLAG.DataSource = rejudge_flag;
            RadioButtonList_ARS_FLAG.DataBind();
            RadioButtonList_ARS_FLAG.SelectedValue = "OFF";
            #endregion


            #region CLOSE_FLAG
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CLOSE_FLAG.txt");



            RadioButtonList_CLOSE_FLAG.DataSource = arlistTemp1;
            RadioButtonList_CLOSE_FLAG.DataBind();
            #endregion

            #region ALARM_FLAG
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ALARM_FLAG.txt");


            RadioButtonList_ALARM_FLAG.DataSource = arlistTemp1;
            RadioButtonList_ALARM_FLAG.DataBind();
            #endregion


            #region ARS_FLAG
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ARS_FLAG.txt");



            RadioButtonList_ARS_FLAG.DataSource = arlistTemp1;
            RadioButtonList_ARS_FLAG.DataBind();
            #endregion

            #region ENG_DEP
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_ENG_DEP.txt");



            DropDownList_ENG_DEP.DataSource = arlistTemp1;
            DropDownList_ENG_DEP.DataBind();
            #endregion

            #region ENGINEER


            DropDownList_ENGINEER.Items.Insert(0, "請選擇");

            #endregion


            #region hour
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\hour.txt");



            DropDownList1.DataSource = arlistTemp1;
            DropDownList1.DataBind();


            DropDownList3.DataSource = arlistTemp1;
            DropDownList3.DataBind();


            DropDownList5.DataSource = arlistTemp1;
            DropDownList5.DataBind();

            #endregion


            #region min
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\min.txt");



            DropDownList2.DataSource = arlistTemp1;
            DropDownList2.DataBind();


            DropDownList4.DataSource = arlistTemp1;
            DropDownList4.DataBind();


            DropDownList6.DataSource = arlistTemp1;
            DropDownList6.DataBind();

            #endregion


            #region fab
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab.txt");



            DropDownList1_FAB.DataSource = arlistTemp1;
            DropDownList1_FAB.DataBind();
            DropDownList1_FAB.Items.Insert(0, "請選擇");



            #endregion


            #region SYSTEM
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab_System.txt");



            DropDownList_SYSTEM.DataSource = arlistTemp1;
            DropDownList_SYSTEM.DataBind();
            DropDownList_SYSTEM.Items.Insert(0, "請選擇");



            #endregion

            #region TYPE
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_fab_TYPE.txt");



            DropDownList_TYPE.DataSource = arlistTemp1;
            DropDownList_TYPE.DataBind();
            DropDownList_TYPE.Items.Insert(0, "請選擇");



            #endregion


            #region PRODUCT_IMPACT
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_PRODUCT_IMPACT.txt");



            DropDownList_PRODUCT_IMPACT.DataSource = arlistTemp1;
            DropDownList_PRODUCT_IMPACT.DataBind();
            DropDownList_PRODUCT_IMPACT.Items.Insert(0, "請選擇");



            #endregion


            #region ASSIGN_OWNER
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CIM_MEMBER.txt");



            DropDownList_ASSIGN_OWNER.DataSource = arlistTemp1;
            DropDownList_ASSIGN_OWNER.DataBind();
            DropDownList_ASSIGN_OWNER.Items.Insert(0, "請選擇");



            #endregion

            #region BY_WHOM
            arlistTemp1 = func.FileToArray(Server.MapPath(".") + "\\config\\onduty_CIM_MEMBER.txt");



            DropDownList_BY_WHOM.DataSource = arlistTemp1;
            DropDownList_BY_WHOM.DataBind();
            DropDownList_BY_WHOM.Items.Insert(0, "請選擇");



            #endregion



            BindData1();

            #region hyperlink

            HyperLink hp = new HyperLink();
            hp = HyperLink_ARS_LINK;
            if (!TextBox_ARS_LINK.Text.Trim().Equals(""))
            {
                hp.NavigateUrl = TextBox_ARS_LINK.Text;
                hp.Target      = "_blank";
                hp.Visible     = true;
            }

            #endregion


            #region GetNetdriveFileToLocal
            string sqlfile = @"select t.file_name from onduty_file t 
                         where t.seq='{0}'
                    ";
            sqlfile = string.Format(sqlfile, Session["seq"].ToString());
            DataSet ds = new DataSet();

            ds = func.get_dataSet_access(sqlfile, conn);


            NetworkDrive oNetDrive = new NetworkDrive();
            oNetDrive.LocalDrive      = "M:";
            oNetDrive.Persistent      = true;
            oNetDrive.SaveCredentials = true;
            oNetDrive.ShareName       = @"\\172.16.12.62\ams";
            //dt_start = Convert.ToDateTime(txtEstimateSTARTTIME.SelectedDate.Value.AddDays(+0).ToString("yyyy/MM/dd")).ToString("yyyyMMdd");
            //dt_end = Convert.ToDateTime(txtEstimateSTARTTIME.SelectedDate.Value.AddDays(+1).ToString("yyyy/MM/dd")).ToString("yyyyMMdd");
            //func.delete_log_file(HttpContext.Current.Server.MapPath(".") + "\\File\\", "*", -3);
            //func.delete_log_dir(HttpContext.Current.Server.MapPath(".") + "\\File\\", "*", -3);


            try
            {
                oNetDrive.MapDrive(@"T1FAB\t1eda", "CIMabc123");

                for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                {
                    System.IO.File.Copy(@"M:\" + ds.Tables[0].Rows[i]["file_name"].ToString(), HttpContext.Current.Server.MapPath(".") + "\\FileList\\" + ds.Tables[0].Rows[i]["file_name"].ToString(), true);
                }



                // Parser_tmp_directory_file(oNetDrive.LocalDrive + "\\T1\\" + DropDownList1.SelectedValue.ToString() + "\\EDANG\\", "*.TXT", -360);
                // Delete_tmp_directory_file(HttpContext.Current.Server.MapPath(".") + "\\File\\", "*", -3);


                oNetDrive.UnMapDrive(oNetDrive.LocalDrive, true);
            }
            catch (Exception)
            {
                //oNetDrive.UnMapDrive(oNetDrive.LocalDrive, true);
            }
            finally
            {
                //oNetDrive.UnMapDrive();
            }


            //oNetDrive.MapDrive(@"T1FAB\t1eda", "CIMabc123");

            #endregion
        }

        #region GetUploadFile

        DataTable dt = new DataTable();


        sql = @"select t.file_name from onduty_file t
                           where t.seq='{0}'  order by dttm   ";

        sql = string.Format(sql, Session["seq"].ToString());



        dt = func.get_dataSet_access(sql, conn).Tables[0];


        TableRow row = new TableRow();



        for (int i = 0; i <= dt.Rows.Count - 1; i++)
        {
            TableCell cell = new TableCell();



            HyperLink alnk = new HyperLink();

            //alnk.Text = Convert.ToString(i + 1);
            alnk.Text = dt.Rows[i]["file_name"].ToString();


            alnk.ID     = (alnk + i.ToString());
            alnk.Target = "_blank";

            alnk.NavigateUrl = "http://10.56.131.22/onduty_dotnet2/FileList/" + dt.Rows[i]["file_name"].ToString();



            cell.Controls.Add(alnk);

            row.Cells.Add(cell);

            Table1.Rows.Add(row);
        }
        #endregion
    }