Ejemplo n.º 1
0
 protected void ToDo_OnClick(object sender, EventArgs e)
 {
     if (GridView1.Rows.Count == 0)
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('目前沒有資料');", true);
     }
     else
     {
         DataTable dt = new DataTable();
         dt.TableName = "upload";
         dt.Columns.Add("sid");
         dt.Columns.Add("status");
         Lib.DataUtility center = new Lib.DataUtility(Lib.DataUtility.ConnectionType.CenterDB);
         List <Dictionary <string, object> > list_u = new List <Dictionary <string, object> >();
         foreach (GridViewRow row in GridView1.Rows)
         {
             DataRow _row = dt.NewRow();
             Dictionary <string, object> d_u = new Dictionary <string, object>();
             RadioButtonList             dbl = (RadioButtonList)row.Cells[6].FindControl("rbl");
             var _v = dbl.SelectedValue;
             _row["sid"]    = row.Cells[7].Text;
             _row["status"] = _v;
             d_u.Add("sid", row.Cells[7].Text);
             d_u.Add("status", _v);
             dt.Rows.Add(_row);
             list_u.Add(d_u);
         }
         try
         {
             MainWS.WebService MainWs = new MainWS.WebService();
             string            msg    = MainWs.UploadResult(dt, "pending");
             if (msg == "done")
             {
                 center.executeNonQueryByText("update result set status = @status where sid = @sid", list_u);
                 Dictionary <string, object> d_log = new Dictionary <string, object>();
                 d_log.Add("acc", ((Lib.Center.Account_c)Session["account"]).Account);
                 d_log.Add("name", ((Lib.Center.Account_c)Session["account"]).Name);
                 d_log.Add("log", "上傳未檢錄成績 " + GridView1.Rows.Count.ToString() + " 筆");
                 d_log.Add("date", DateTime.Now);
                 center.executeNonQueryByText("insert into log values (@acc,@name,@log,@date)", d_log);
                 Account_c acc = (Account_c)Session["account"];
                 Lib.SysSetting.AddLog("成績上傳", acc.Account, "上傳未檢錄成績 " + GridView1.Rows.Count.ToString() + " 筆", DateTime.Now);
                 list_u.Clear();
                 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('上傳成功');",
                                                         true);
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + msg + "\");", true);
             }
         }
         catch (Exception ex)
         {
             Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString());
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message + "\");", true);
         }
         GridView1.DataBind();
         TabContainer1.ActiveTabIndex = 4;
     }
 }
Ejemplo n.º 2
0
    protected void ReNew_Click(object sender, EventArgs e)
    {
        try
        {
            MainWS.WebService mainWS = new MainWS.WebService();
            DataTable         dt     = mainWS.UnitData();
            Lib.DataUtility   du     = new Lib.DataUtility();
            du.executeNonQueryByText("delete from unit");
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            foreach (DataRow row in dt.Rows)
            {
                Dictionary <string, object> d = new Dictionary <string, object>();
                d.Add("unit_code", row["unit_code"]);
                d.Add("unit_title", row["unit_title"]);
                d.Add("parent_unit_code", row["parent_unit_code"]);
                d.Add("service", row["service_code"]);
                list.Add(d);
                du.executeNonQueryByText("insert into unit (unit_code,unit_title,parent_unit_code,service_code) values (@unit_code,@unit_title,@parent_unit_code,@service)", list);
                list.Clear();
            }


            du.executeNonQueryBysp("add_roc_order");
            GridView1.DataSource = dt;
            GridView1.DataBind();
            version.Text = mainWS.Unit_Version();
            Lib.SysSetting.Unit_Version = mainWS.Unit_Version();
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message.Replace("\"", "").Replace("'", "") + "\");", true);
            Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString());
        }
    }
Ejemplo n.º 3
0
    protected void btn_Upload_105_666_Click(object sender, EventArgs e)//105補測成績上傳(現報)
    {
        //DialogResult dialogResult = MessageBox.Show("確認批次上傳「補測」成績(現報)?", "確認Yes/No", MessageBoxButtons.YesNo);
        //if (dialogResult == DialogResult.Yes)
        //{
        lab_Count.Text = null;
        string data_count = "1";

        data_count = txb_P_count.Text;                                                                                                                                                                                                                   //上傳筆數
        Lib.DataUtility du = new Lib.DataUtility();
        DataTable       dt = du.getDataTableByText("select top " + data_count + " * from result where status = @status and result = '666' and date between '" + txb_StartTime.Text + "' and '" + txb_EndTime.Text + "' order by date", "status", "105"); // 105 未上傳補測

        if (dt.Rows.Count == 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('目前沒有「補測」成績(現報)');", true);
        }
        else
        {
            //上傳更新總部資料
            dt.TableName = "upload";
            MainWS.WebService MainWs = new MainWS.WebService();
            string            msg    = MainWs.UploadResult(dt, "present");
            if (msg == "done")
            {
                List <Dictionary <string, object> > list_u = new List <Dictionary <string, object> >();
                foreach (DataRow row in dt.Rows)
                {
                    Dictionary <string, object> d_u = new Dictionary <string, object>();
                    d_u.Add("id", row["id"]);
                    list_u.Add(d_u);
                }
                try
                {
                    // 更新鑑測站資料狀態
                    du.executeNonQueryByText("update result set status = '205' , result = '777' where id = @id and result = '666' ", list_u);
                    dt.Dispose();
                    list_u.Clear();
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('上傳補測成績成功(現報)');", true);
                    lab_Count.Text = "成功上傳補測成績(現報)共計「" + dt.Rows.Count + "」筆";
                }
                catch (Exception ex)
                {
                    Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString());
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message + "\");", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + msg + "\");", true);
            }
        }
        btn_no_upload_Click(btn_no_upload, e);
        //}
        //else if (dialogResult == DialogResult.No)
        //{
        //    //do something else
        //}
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MainWS.WebService m  = new MainWS.WebService();
        Lib.DataUtility   du = new Lib.DataUtility();
        DataTable         dt = du.getDataTableByText("select unit_title from unit where parent_unit_code = @code", "code", "10001");

        dt.TableName = "toAdd";
        string toget = m.Datatable(dt);
    }
Ejemplo n.º 5
0
    protected void upload_OnClick(object sender, EventArgs e)
    {
        Lib.DataUtility du = new Lib.DataUtility();
        DataTable       dt = du.getDataTableByText("select * from result where status = @status and result = '666' ", "status", "102"); // 102 未上傳合格

        if (dt.Rows.Count == 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('目前沒有成績');", true);
            GridView3.DataBind();
        }
        else
        {
            dt.TableName = "upload";
            MainWS.WebService MainWs = new MainWS.WebService();
            string            msg    = MainWs.UploadResult(dt, "present");
            if (msg == "done")
            {
                //Lib.DataUtility main = new Lib.DataUtility(Lib.DataUtility.ConnectionType.MainDB);
                //List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
                List <Dictionary <string, object> > list_u = new List <Dictionary <string, object> >();
                foreach (DataRow row in dt.Rows)
                {
                    Dictionary <string, object> d_u = new Dictionary <string, object>();
                    d_u.Add("id", row["id"]);
                    list_u.Add(d_u);
                }
                try
                {
                    //    // 上傳更新總部資料
                    //    main.executeNonQueryByText("update result set height = @height, weight=@weight, BMI = @BMI, bodyfat = @bodyfat, sit_ups = @sit_ups, sit_ups_score = @sit_ups_score, push_ups = @push_ups, push_ups_score = @push_ups_score, run = @run, run_score = @run_score, status = @status where sid = @sid", list);
                    // 更新鑑測站資料狀態
                    du.executeNonQueryByText("update result set status = '202' , result = '777' where id = @id and result = '666' and status = '102' ", list_u);
                    Dictionary <string, object> d_log = new Dictionary <string, object>();
                    d_log.Add("acc", ((Lib.Center.Account_c)Session["account"]).Account);
                    d_log.Add("name", ((Lib.Center.Account_c)Session["account"]).Name);
                    d_log.Add("log", "上傳合格成績 " + dt.Rows.Count.ToString() + " 筆");
                    d_log.Add("date", DateTime.Now);
                    du.executeNonQueryByText("insert into log values (@acc,@name,@log,@date)", d_log);
                    dt.Dispose();
                    //list.Clear();
                    list_u.Clear();
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('上傳合格成績成功');", true);
                }
                catch (Exception ex)
                {
                    Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString());
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message + "\");", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + msg + "\");", true);
            }
            GridView3.DataBind();
        }
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            version.Text = Lib.SysSetting.Unit_Version;
            MainWS.WebService MainWs = new MainWS.WebService();
            HQ_version.Text = MainWs.Unit_Version();
        }
        DataTable dt = new DataTable();

        Lib.DataUtility du = new Lib.DataUtility();
        dt = du.getDataTableByText("select count(*) as count from Result_Bak");
        if (dt.Rows[0]["count"].ToString() != "0")
        {
            Button1.Enabled = false;
        }
    }
Ejemplo n.º 7
0
 protected void downLoad_Click(object sender, EventArgs e)
 {
     Lib.DataUtility du = new Lib.DataUtility(Lib.DataUtility.ConnectionType.MainDB);
     try
     {
         DataTable         dt             = new DataTable();
         MainWS.WebService MainWebService = new MainWS.WebService();
         dt = MainWebService.DownLoadResult(Lib.SysSetting.CenterCode);
         Lib.DataUtility local = new Lib.DataUtility(Lib.DataUtility.ConnectionType.CenterDB);
         if (dt.Rows.Count != 0)
         {
             List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
             foreach (DataRow row in dt.Rows)
             {
                 Dictionary <string, object> d = new Dictionary <string, object>();
                 d.Add("sid", row["sid"].ToString());
                 d.Add("id", row["id"].ToString());
                 d.Add("name", row["name"].ToString());
                 d.Add("gender", row["gender"].ToString());
                 d.Add("birth", row["birth"]);
                 d.Add("age", row["age"].ToString());
                 d.Add("unit_code", row["unit_code"].ToString());
                 d.Add("rank_code", row["rank_code"].ToString());
                 d.Add("date", Convert.ToDateTime(row["date"]));
                 d.Add("center_code", row["center_code"].ToString());
                 d.Add("status", "999");
                 d.Add("op_id", row["op_id"].ToString());
                 d.Add("sit_ups", row["sit_ups"]);
                 d.Add("sit_ups_score", row["sit_ups_score"]);
                 d.Add("push_ups", row["push_ups"]);
                 d.Add("push_ups_score", row["push_ups_score"]);
                 d.Add("run", row["run"]);
                 d.Add("run_score", row["run_score"]);
                 d.Add("memo", row["memo"]);
                 list.Add(d);
             }
             DataTable ds    = local.getDataTableBysp("Download", list);
             int       count = 0;
             foreach (DataRow DR in ds.Rows)
             {
                 count = count + Convert.ToInt32(DR[0]);
             }
             Dictionary <string, object> log_d = new Dictionary <string, object>();
             log_d.Add("date", DateTime.Now);
             log_d.Add("log", "已下載" + count.ToString() + "筆資料");
             log_d.Add("account", ((Lib.Center.Account_c)Session["account"]).Account);
             local.executeNonQueryByText("insert into downloadlog values (@date,@log,@account)", log_d);
             log_d.Clear();
             list.Clear();
             dt.Dispose();
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('下載作業完成');", true);
             GridView1.DataBind();
         }
         else
         {
             Dictionary <string, object> d = new Dictionary <string, object>();
             d.Add("date", DateTime.Now);
             d.Add("log", "目前沒有資料可以下載");
             d.Add("account", ((Lib.Center.Account_c)Session["account"]).Account);
             local.executeNonQueryByText("insert into downloadlog values (@date,@log,@account)", d);
             d.Clear();
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('目前沒有資料可以下載');", true);
             GridView1.DataBind();
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message.Replace("\"", "").Replace("'", "") + "\");", true);
         System.Collections.Generic.Dictionary <string, object> d = new System.Collections.Generic.Dictionary <string, object>();
         Lib.DataUtility local = new Lib.DataUtility(Lib.DataUtility.ConnectionType.CenterDB);
         d.Add("date", DateTime.Now);
         d.Add("log", ex.Message);
         d.Add("account", ((Lib.Center.Account_c)Session["account"]).Account);
         local.executeNonQueryByText("insert into downloadlog values (@date,@log,@account)", d);
     }
     //呼叫取得近七日測考人數方法
     //Update_7DayTable();
 }
Ejemplo n.º 8
0
    protected void ReActionUpload_OnClick(object sender, EventArgs e)
    {
        Lib.DataUtility du = new Lib.DataUtility();
        DataTable       dt = du.getDataTableByText("select * from result where status = @status and result = '666' and (sit_ups is null or push_ups is null or run is null)", "status", "105"); // 未上傳補測

        if (dt.Rows.Count == 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('目前沒有成績');", true);
        }
        else
        {
            foreach (DataRow _row in dt.Rows)
            {
                foreach (GridViewRow row in GridView5.Rows)
                {
                    RadioButtonList dbl = (RadioButtonList)row.Cells[8].FindControl("rb2");
                    var             _v  = dbl.SelectedValue;
                    if (_row["id"].ToString() == row.Cells[1].Text)
                    {
                        _row["status"] = _v;
                    }
                }
            }
            dt.TableName = "upload";
            MainWS.WebService MainWs = new MainWS.WebService();
            string            msg    = MainWs.UploadResult(dt, "present");
            if (msg == "done")
            {
                List <Dictionary <string, object> > list_u = new List <Dictionary <string, object> >();
                foreach (DataRow row in dt.Rows)
                {
                    Dictionary <string, object> d_u = new Dictionary <string, object>();
                    d_u.Add("id", row["id"]);
                    d_u.Add("status", row["status"].ToString().Replace("1", "2"));
                    list_u.Add(d_u);
                }
                try
                {
                    // 上傳更新總部資料
                    //main.executeNonQueryByText("update result set height = @height, weight=@weight, BMI = @BMI, bodyfat = @bodyfat, sit_ups = @sit_ups, sit_ups_score = @sit_ups_score, push_ups = @push_ups, push_ups_score = @push_ups_score, run = @run, run_score = @run_score, status = @status where sid = @sid", list);
                    // 更新鑑測站資料狀態
                    du.executeNonQueryByText("update result set status = @status , result = '777' where id = @id and result = '666' ", list_u);
                    Dictionary <string, object> d_log = new Dictionary <string, object>();
                    d_log.Add("acc", ((Lib.Center.Account_c)Session["account"]).Account);
                    d_log.Add("name", ((Lib.Center.Account_c)Session["account"]).Name);
                    d_log.Add("log", "上傳補測成績 " + dt.Rows.Count.ToString() + " 筆");
                    d_log.Add("date", DateTime.Now);
                    du.executeNonQueryByText("insert into log values (@acc,@name,@log,@date)", d_log);
                    dt.Dispose();
                    list_u.Clear();
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('上傳補測成績成功');", true);
                }
                catch (Exception ex)
                {
                    Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString());
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message + "\");", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + msg + "\");", true);
            }
            GridView5.DataBind();
            TabContainer1.ActiveTabIndex = 3;
        }
    }
Ejemplo n.º 9
0
    protected void NoneUpload_OnClick(object sender, EventArgs e)
    {
        Lib.DataUtility du = new Lib.DataUtility();
        DataTable       dt = du.getDataTableByText("select * from result where status = @status and result is NULL", "status", "104"); // 未上傳免測

        if (dt.Rows.Count == 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('目前沒有成績');", true);
        }
        else
        {
            dt.TableName = "upload";
            MainWS.WebService MainWs = new MainWS.WebService();
            string            msg    = MainWs.UploadResult(dt, "104");
            if (msg == "done")
            {
                //Lib.DataUtility main = new Lib.DataUtility(Lib.DataUtility.ConnectionType.MainDB);
                //List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
                List <Dictionary <string, object> > list_u = new List <Dictionary <string, object> >();
                foreach (DataRow row in dt.Rows)
                {
                    //Dictionary<string, object> d = new Dictionary<string, object>();
                    Dictionary <string, object> d_u = new Dictionary <string, object>();
                    //d.Add("sid", row["sid"]);
                    d_u.Add("sid", row["sid"]);
                    //d.Add("height", row["height"]);
                    //d.Add("weight", row["weight"]);
                    //d.Add("BMI", row["BMI"]);
                    //d.Add("bodyfat", row["bodyfat"]);
                    //d.Add("sit_ups", row["sit_ups"]);
                    //d.Add("sit_ups_score", row["sit_ups_score"]);
                    //d.Add("push_ups", row["push_ups"]);
                    //d.Add("push_ups_score", row["push_ups_score"]);
                    //d.Add("run", row["run"]);
                    //d.Add("run_score", row["run_score"]);
                    //d.Add("status", "204");  // 204 已上傳免測
                    //list.Add(d);
                    list_u.Add(d_u);
                }
                try
                {
                    // 上傳更新總部資料
                    //main.executeNonQueryByText("update result set status = @status where sid = @sid", list);
                    // 更新鑑測站資料狀態
                    du.executeNonQueryByText("update result set status = '204' where sid = @sid", list_u);
                    Dictionary <string, object> d_log = new Dictionary <string, object>();
                    d_log.Add("acc", ((Lib.Center.Account_c)Session["account"]).Account);
                    d_log.Add("name", ((Lib.Center.Account_c)Session["account"]).Name);
                    d_log.Add("log", "上傳免測成績 " + dt.Rows.Count.ToString() + " 筆");
                    d_log.Add("date", DateTime.Now);
                    du.executeNonQueryByText("insert into log values (@acc,@name,@log,@date)", d_log);
                    Account_c acc = (Account_c)Session["account"];
                    Lib.SysSetting.AddLog("成績上傳", acc.Account, "上傳免測成績 " + dt.Rows.Count.ToString() + " 筆", DateTime.Now);
                    dt.Dispose();
                    //list.Clear();
                    list_u.Clear();
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('上傳免測成績成功');", true);
                }
                catch (Exception ex)
                {
                    Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString());
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message + "\");", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + msg + "\");", true);
            }
            GridView4.DataBind();
            TabContainer1.ActiveTabIndex = 2;
        }
    }