Example #1
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName.Equals("cmdEdit"))
                {
                    string strUrl = ResolveUrl(string.Format("~/RunDownAddEdit.aspx?id={0}", e.CommandArgument.ToString()));
                    Response.Redirect(strUrl);
                }
                if (e.CommandName.Equals("cmdDel"))
                {
                    conn = new MyConnection();
                    string     strsql = "select * from [HMC_PkgRundown] where Rundown_Id=@Rundown_Id ";
                    SqlCommand cmd    = new SqlCommand(strsql);
                    cmd.Parameters.Add("@Rundown_Id", SqlDbType.Int).Value = e.CommandArgument.ToString();
                    dt = conn.GetData(cmd);

                    if (dt.Rows.Count > 0)
                    {
                        PublicLib.showAlert("此流程已被設定在套餐內,無法刪除");
                    }
                    else
                    {
                        deleteData(e.CommandArgument.ToString());
                        querySql();
                    }
                }
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #2
0
    public static void queryDscweek(object sender)
    {
        try
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            List <System.Web.UI.WebControls.ListItem> listItem = new List <System.Web.UI.WebControls.ListItem>();

            string strSql = "Select b.doc_code, b.emp_name From dscdocm b Inner Join dscweek a On a.emp_id=b.emp_id Where p_yymm=? And shift_no='A13'";
            System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(strSql);
            cmd.Parameters.Add("@Param1", System.Data.Odbc.OdbcType.Char).Value = DateTime.Now.ToString("yyyyMM");
            //cmd.Parameters.Add("@Param2", System.Data.Odbc.OdbcType.Char).Value = DateTime.Now.ToString("yyyyMM");
            Dev.ODBCSql.MyODBCConnection conn = new Dev.ODBCSql.MyODBCConnection();
            dt = conn.GetData(cmd);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    listItem.Add(new System.Web.UI.WebControls.ListItem(dt.Rows[i]["doc_code"].ToString().Trim() + " " + dt.Rows[i]["emp_name"].ToString().Trim(), dt.Rows[i]["doc_code"].ToString().Trim()));
                }

                ((System.Web.UI.WebControls.DropDownList)sender).Items.AddRange(listItem.ToArray());
                ((System.Web.UI.WebControls.DropDownList)sender).DataBind();
            }
        }
        catch (Exception ex)
        {
            PublicLib.handleError("", "PublicLib", ex.Message);
        }
    }
Example #3
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName.Equals("cmdView"))
                {
                    string strUrl = ResolveUrl(string.Format("~/PkgRelative.aspx?PID={0}", e.CommandArgument.ToString()));
                    Response.Redirect(strUrl, false);
                }

                if (e.CommandName.Equals("cmdEdit"))
                {
                    string strUrl = ResolveUrl(string.Format("~/ClassAddEdit.aspx?cmd={0}&pid={1}&ID={2}", "edit", strPID, e.CommandArgument));
                    Response.Redirect(strUrl);
                }

                if (e.CommandName.Equals("cmdDel"))
                {
                    if (have_child(e.CommandArgument.ToString()))
                    {
                        PublicLib.showAlert("請先刪除子項目內的資料");
                    }
                    else
                    {
                        delete_Relative(e.CommandArgument.ToString());
                        querySql();
                    }
                }
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #4
0
    public static void queryCodeFile(object sender, string strType, string strParam)
    {
        try
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            List <System.Web.UI.WebControls.ListItem> listItem = new List <System.Web.UI.WebControls.ListItem>();

            string strSql = "Select item_code, description From code_file Where check_flag='Y' And item_type=?" + strParam;
            System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(strSql);
            cmd.Parameters.Add("@Param", System.Data.Odbc.OdbcType.Char).Value = strType;
            Dev.ODBCSql.MyODBCConnection conn = new Dev.ODBCSql.MyODBCConnection();
            dt = conn.GetData(cmd);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    listItem.Add(new System.Web.UI.WebControls.ListItem(dt.Rows[i]["item_code"].ToString().Trim() + " " + dt.Rows[i]["description"].ToString().Trim(), dt.Rows[i]["item_code"].ToString().Trim()));
                }

                ((System.Web.UI.WebControls.DropDownList)sender).Items.AddRange(listItem.ToArray());
                ((System.Web.UI.WebControls.DropDownList)sender).DataBind();
            }
        }
        catch (Exception ex)
        {
            PublicLib.handleError("", "PublicLib", ex.Message);
        }
    }
Example #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                var list_seq = new List <string>();

                foreach (GridViewRow row in GridView1.Rows)
                {
                    TextBox txtseq = (TextBox)row.FindControl("txtSeqNo");
                    if (list_seq.Contains(txtseq.Text))
                    {
                        PublicLib.showAlert("歐歐 排序有重複喔");
                        return;
                    }
                    list_seq.Add(txtseq.Text);
                }

                conn = new MyConnection();
                if (1 == 1)
                {
                    Delete_PkgRunDown();
                    Insert_PkgRunDown();
                    conn.Muti_Insert(list_sqlcmd);
                }
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }

            Response.Redirect("~/PkgIndex.aspx");
        }
Example #6
0
        protected void queryPkgM(object sender)
        {
            try
            {
                System.Data.DataTable dt = new System.Data.DataTable();
                List <System.Web.UI.WebControls.ListItem> listItem = new List <System.Web.UI.WebControls.ListItem>();

                string strSql = "Select * From [HMC_PkgM] Where Rec_Status = 'A' ";
                System.Data.SqlClient.SqlCommand cmd  = new System.Data.SqlClient.SqlCommand(strSql);
                Dev.Sql.MyConnection             conn = new Dev.Sql.MyConnection();
                dt = conn.GetData(cmd);

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        listItem.Add(new System.Web.UI.WebControls.ListItem(dt.Rows[i]["PkgCode"].ToString().Trim() + " " + dt.Rows[i]["Name"].ToString().Trim(), dt.Rows[i]["Id"].ToString().Trim()));
                    }

                    ((System.Web.UI.WebControls.DropDownList)sender).Items.AddRange(listItem.ToArray());
                    ((System.Web.UI.WebControls.DropDownList)sender).DataBind();
                }
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", "PublicLib", ex.Message);
            }
        }
Example #7
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (strQueID != null && strQueID != "")
         {
             if (1 == 1)
             {
                 Update_Rundown();
             }
         }
         else
         {
             if (1 == 1)
             {
                 Insert_Rundown();
             }
         }
     }
     catch (Exception ex)
     {
         PublicLib.handleError("", this.GetType().Name, ex.Message);
     }
     Response.Redirect("~/RunDown.aspx");
 }
Example #8
0
        protected void GetPatientData(string strParam)
        {
            try
            {
                System.Data.DataTable dt = new System.Data.DataTable();

                string strSql = "Select to_char(birth_date) As birthday, * From reg_file Where reg_no=?";
                System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(strSql);
                cmd.Parameters.Add("@Param", System.Data.Odbc.OdbcType.Char).Value = strParam;
                Dev.ODBCSql.MyODBCConnection conn = new Dev.ODBCSql.MyODBCConnection();
                dt = conn.GetData(cmd);

                if (dt.Rows.Count > 0)
                {
                    txtReg_No_Show.Text       = dt.Rows[0]["reg_no"].ToString();
                    txtId_No_Show.Text        = dt.Rows[0]["id_no"].ToString();
                    txtName_Show.Text         = dt.Rows[0]["p_name"].ToString();
                    ddlSex_Show.SelectedValue = dt.Rows[0]["sex"].ToString();
                    txtBirth_Date_Show.Text   = dt.Rows[0]["birthday"].ToString();
                }
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #9
0
        protected void querySql()
        {
            try
            {
                string strParam = String.Empty;
                if (!txtSearch.Text.Equals(""))
                {
                    strParam += " and NAME Like '%' + @Param + '%'";
                }

                string strSql;
                strSql = "Select * From [HMC_Rundown] Where Rec_Status = 'A'" + strParam + " Order By ID";

                SqlCommand cmd = new SqlCommand(strSql);
                if (!txtSearch.Text.Equals(""))
                {
                    cmd.Parameters.Add("@Param", SqlDbType.NVarChar).Value = txtSearch.Text;
                }
                conn = new MyConnection();
                dt   = conn.GetData(cmd);

                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                #region 初始化控制項
                txtReg_No_Show     = (TextBox)this.Master.Master.FindControl("myForm").FindControl("MainContent").FindControl("txtReg_No_Show");
                txtId_No_Show      = (TextBox)this.Master.Master.FindControl("myForm").FindControl("MainContent").FindControl("txtId_No_Show");
                txtName_Show       = (TextBox)this.Master.Master.FindControl("myForm").FindControl("MainContent").FindControl("txtName_Show");
                ddlSex_Show        = (DropDownList)this.Master.Master.FindControl("myForm").FindControl("MainContent").FindControl("ddlSex_Show");
                txtBirth_Date_Show = (TextBox)this.Master.Master.FindControl("myForm").FindControl("MainContent").FindControl("txtBirth_Date_Show");

                PublicLib.queryCodeFile(ddlReg_Type, "26", " And (item_code='A' Or item_code='1' Or item_code='9')");
                PublicLib.queryCodeFile(ddlTime_Shift, "25", "");
                PublicLib.queryCodeFile(ddl_Dep_No, "07", " And item_code='I9'");
                PublicLib.queryCodeFile(ddlRoom_No, "36", " And item_code='HE'");
                PublicLib.queryCodeFile(ddlCard_No, "99", "");
                PublicLib.queryDscweek(ddlDoc_Code);

                txtOpd_Date.Text = DateTime.Now.ToString("yyyy/MM/dd");
                //txtOpd_Date.Text = DateTime.Now.ToString("yyyy/MM/dd" + DateTime.Now.DayOfWeek.ToString("d"));
                #endregion

                GetPatientData(Request.QueryString["ID"].ToString());
                GetOpd_Reg(Request.QueryString["ID"].ToString());
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #11
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (strQueCmd == "add")
         {
             conn = new MyConnection();
             if (1 == 1)
             {
                 Insert_PkgM();
                 Insert_PkgD();
                 conn.Muti_Insert(list_sqlcmd);
             }
         }
         else if (strQueCmd == "edit")
         {
             conn = new MyConnection();
             if (1 == 1)
             {
                 Update_PkgM();
                 Delete_PkgD();
                 Insert_PkgD();
                 conn.Muti_Insert(list_sqlcmd);
             }
         }
     }
     catch (Exception ex)
     {
         PublicLib.handleError("", this.GetType().Name, ex.Message);
     }
     Response.Redirect("~/PkgIndex.aspx");
 }
Example #12
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName.Equals("cmdEdit"))
                {
                    string strUrl = ResolveUrl(string.Format("~/PermitEdit.aspx?cmd={0}&ID={1}", "edit", e.CommandArgument.ToString()));
                    Response.Redirect(strUrl);
                }

                if (e.CommandName.Equals("cmdDel"))
                {
                    if (1 == 1)
                    {
                        string     strSql = "Update [Account] Set Rec_Status='R' Where ID=@ID";
                        SqlCommand cmd    = new SqlCommand(strSql);
                        cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = new Guid(e.CommandArgument.ToString());
                        conn = new MyConnection();
                        conn.ExecuteQuery(cmd);
                    }

                    querySql();
                }
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                #region 初始化控制項
                //Show
                PublicLib.queryCodeFile(ddlSex_Show, "28", "");
                //Edit
                PublicLib.queryCodeFile(ddlSex_Edit, "28", "");
                PublicLib.queryCodeFile(ddlNative_Edit, "27", "");
                PublicLib.queryCodeFile(ddlMerry_Edit, "29", "");
                PublicLib.queryCodeFile(ddlBelief_Edit, "68", "");
                PublicLib.queryCodeFile(ddlP_Type_Edit, "12", "");
                PublicLib.queryCodeFile(ddlInsurance_Edit, "01", "");
                PublicLib.queryCodeFile(ddlSpecial_Edit, "41", "");
                PublicLib.queryCodeFile(ddlPay_Type_Edit, "03", "");
                PublicLib.queryCodeFile(ddlArea_Edit, "30", "");
                PublicLib.queryCodeFile(ddlArea1_Edit, "30", "");
                PublicLib.queryCodeFile(ddlCont_Area_Edit, "30", "");
                //Add
                PublicLib.queryCodeFile(ddlSex, "28", "");

                hfReg_No = (HiddenField)this.Master.FindControl("hfReg_No");
                #endregion
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #14
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (strQueCmd == "add")
                {
                    conn = new MyConnection();
                    if (1 == 1)
                    {
                        Insert_Relative();
                        conn.Muti_Insert(list_sqlcmd);
                    }
                }
                else if (strQueCmd == "edit")
                {
                    conn = new MyConnection();
                    if (1 == 1)
                    {
                        Update_Relative();
                        conn.Muti_Insert(list_sqlcmd);
                    }
                }
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
            string strUrl = ResolveUrl(string.Format("~/PkgRelative.aspx?PID={0}", strQuePID));

            Response.Redirect(strUrl, false);
        }
Example #15
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string strSql = "Insert Into reg_file (reg_no, p_name, birth_date, sex, id_no, area, merry, native, belief, insurance, p_type, special, pay_type, first_opd_date, last_opd_date, opd_count, miss_count, rent_man, iccard_id)" +
                                " Values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
                System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(strSql);
                #region 測試資料
                //cmd.Parameters.Add("@reg_no", System.Data.Odbc.OdbcType.Char).Value = "Y99001";
                //cmd.Parameters.Add("@p_name", System.Data.Odbc.OdbcType.Char).Value = "測試號";
                //cmd.Parameters.Add("@birth_date", System.Data.Odbc.OdbcType.Date).Value = "1989/06/20";
                //cmd.Parameters.Add("@sex", System.Data.Odbc.OdbcType.Char).Value = "1";
                //cmd.Parameters.Add("@id_no", System.Data.Odbc.OdbcType.Char).Value = "E123456789";
                //cmd.Parameters.Add("@area", System.Data.Odbc.OdbcType.Char).Value = "4301";
                //cmd.Parameters.Add("@merry", System.Data.Odbc.OdbcType.Char).Value = "0";
                //cmd.Parameters.Add("@native", System.Data.Odbc.OdbcType.Char).Value = "01";
                //cmd.Parameters.Add("@belief", System.Data.Odbc.OdbcType.Char).Value = "0";
                //cmd.Parameters.Add("@insurance", System.Data.Odbc.OdbcType.Char).Value = "01";
                //cmd.Parameters.Add("@p_type", System.Data.Odbc.OdbcType.Char).Value = "00";
                //cmd.Parameters.Add("@special", System.Data.Odbc.OdbcType.Char).Value = "00";
                //cmd.Parameters.Add("@pay_type", System.Data.Odbc.OdbcType.Char).Value = "01";
                //cmd.Parameters.Add("@first_opd_date", System.Data.Odbc.OdbcType.Date).Value = DateTime.Now.Date;
                //cmd.Parameters.Add("@last_opd_date", System.Data.Odbc.OdbcType.Date).Value = DateTime.Now.Date;
                //cmd.Parameters.Add("@opd_count", System.Data.Odbc.OdbcType.SmallInt).Value = "0";
                //cmd.Parameters.Add("@miss_count", System.Data.Odbc.OdbcType.SmallInt).Value = "0";
                //cmd.Parameters.Add("@rent_man", System.Data.Odbc.OdbcType.Char).Value = "f872";
                //cmd.Parameters.Add("@iccard_id", System.Data.Odbc.OdbcType.Char).Value = "";
                #endregion
                cmd.Parameters.Add("@reg_no", System.Data.Odbc.OdbcType.Char).Value         = txtReg_No.Text;
                cmd.Parameters.Add("@p_name", System.Data.Odbc.OdbcType.Char).Value         = txtName.Text;
                cmd.Parameters.Add("@birth_date", System.Data.Odbc.OdbcType.Date).Value     = txtBirth.Text;
                cmd.Parameters.Add("@sex", System.Data.Odbc.OdbcType.Char).Value            = ddlSex.SelectedValue;
                cmd.Parameters.Add("@id_no", System.Data.Odbc.OdbcType.Char).Value          = txtId_No.Text;
                cmd.Parameters.Add("@area", System.Data.Odbc.OdbcType.Char).Value           = "4301";
                cmd.Parameters.Add("@merry", System.Data.Odbc.OdbcType.Char).Value          = "0";
                cmd.Parameters.Add("@native", System.Data.Odbc.OdbcType.Char).Value         = "01";
                cmd.Parameters.Add("@belief", System.Data.Odbc.OdbcType.Char).Value         = "0";
                cmd.Parameters.Add("@insurance", System.Data.Odbc.OdbcType.Char).Value      = "01";
                cmd.Parameters.Add("@p_type", System.Data.Odbc.OdbcType.Char).Value         = "00";
                cmd.Parameters.Add("@special", System.Data.Odbc.OdbcType.Char).Value        = "00";
                cmd.Parameters.Add("@pay_type", System.Data.Odbc.OdbcType.Char).Value       = "01";
                cmd.Parameters.Add("@first_opd_date", System.Data.Odbc.OdbcType.Date).Value = DateTime.Now.Date;
                cmd.Parameters.Add("@last_opd_date", System.Data.Odbc.OdbcType.Date).Value  = DateTime.Now.Date;
                cmd.Parameters.Add("@opd_count", System.Data.Odbc.OdbcType.SmallInt).Value  = "0";
                cmd.Parameters.Add("@miss_count", System.Data.Odbc.OdbcType.SmallInt).Value = "0";
                cmd.Parameters.Add("@rent_man", System.Data.Odbc.OdbcType.Char).Value       = "f872";
                cmd.Parameters.Add("@iccard_id", System.Data.Odbc.OdbcType.Char).Value      = "";
                Dev.ODBCSql.MyODBCConnection conn = new Dev.ODBCSql.MyODBCConnection();
                conn.ExecuteQuery(cmd);

                hfReg_No.Value = txtReg_No.Text;
                Response.Redirect(ResolveUrl(string.Format("~/AppointOnsite.aspx?ID={0}", hfReg_No.Value)));
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #16
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName.Equals("cmdEdit"))
                {
                    string strUrl = ResolveUrl(string.Format("~/PkgAddEdit.aspx?cmd={0}&PkgId={1}", "edit", e.CommandArgument.ToString()));
                    Response.Redirect(strUrl);
                }
                if (e.CommandName.Equals("cmdEditR"))
                {
                    string strUrl = ResolveUrl(string.Format("~/PkgRunDownSet.aspx?PkgId={0}", e.CommandArgument.ToString()));
                    Response.Redirect(strUrl);
                }
                if (e.CommandName.Equals("cmdDel"))
                {
                    string strPkgid   = e.CommandArgument.ToString().Split(',')[0].Trim();
                    string strPkgCode = e.CommandArgument.ToString().Split(',')[1].Trim();

                    //刪除套餐....
                    string     strcmd = "DELETE FROM [HMC_PkgM] Where Id=@Id";
                    SqlCommand cmd    = new SqlCommand(strcmd);
                    cmd.Parameters.Add("@Id", SqlDbType.Int).Value = int.Parse(strPkgid);
                    conn = new MyConnection();
                    conn.ExecuteQuery(cmd);

                    //刪除關聯階層...
                    strcmd = "DELETE FROM [HMC_Relative] Where Pkg_Id=@Pkg_Id";
                    cmd    = new SqlCommand(strcmd);
                    cmd.Parameters.Add("@Pkg_Id", SqlDbType.Int).Value = int.Parse(strPkgid);
                    conn = new MyConnection();
                    conn.ExecuteQuery(cmd);

                    //刪除細項...
                    strcmd = "DELETE FROM [HMC_PkgD] Where PkgCode=@PkgCode";
                    cmd    = new SqlCommand(strcmd);
                    cmd.Parameters.Add("@PkgCode", SqlDbType.VarChar).Value = strPkgCode;
                    conn = new MyConnection();
                    conn.ExecuteQuery(cmd);

                    //刪除流程...
                    strcmd = "DELETE FROM [HMC_PkgRunDown] Where Pkg_Id=@Pkg_Id";
                    cmd    = new SqlCommand(strcmd);
                    cmd.Parameters.Add("@Pkg_Id", SqlDbType.Int).Value = int.Parse(strPkgid);
                    conn = new MyConnection();
                    conn.ExecuteQuery(cmd);

                    Response.Redirect("~/PkgIndex.aspx");
                }
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #17
0
 protected void btnOpd_Click(object sender, EventArgs e)
 {
     try
     {
         Response.Redirect(ResolveUrl(string.Format("~/AppointOnsite.aspx?ID={0}", hfReg_No.Value)));
     }
     catch (Exception ex)
     {
         PublicLib.handleError("", this.GetType().Name, ex.Message);
     }
 }
Example #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         PublicLib.queryCodeFile(ddlSex_Show, "28", "");
     }
     catch (Exception ex)
     {
         PublicLib.handleError("", this.GetType().Name, ex.Message);
     }
 }
Example #19
0
        protected void querySql()
        {
            try
            {
                string strParam = String.Empty;
                if (!txtSearch.Text.Equals(""))
                {
                    strParam += " And NAME Like '%' + @Param + '%'";

                    string     strsql_pkgm = "select id from [HMC_PkgM] where Name Like '%' + @Param + '%'";
                    SqlCommand cmd_pkgm    = new SqlCommand(strsql_pkgm);
                    cmd_pkgm.Parameters.Add("@Param", SqlDbType.NVarChar).Value = txtSearch.Text;
                    conn = new MyConnection();
                    dt   = conn.GetData(cmd_pkgm);

                    if (dt.Rows.Count > 0)
                    {
                        string strid = string.Empty;
                        foreach (DataRow row in dt.Rows)
                        {
                            strid += row.Field <int>("ID") + ",";
                        }
                        strid    = strid.Substring(0, strid.Length - 1);
                        strParam = " And (NAME Like '%' + @Param + '%' or Pkg_Id in (" + strid + "))";
                    }
                }

                string strSql;

                if (strPID != null && strPID != "")
                {
                    strSql = "Select * From [HMC_Relative] Where Parent_Id =" + strPID + strParam + " Order By Type,ID";
                }
                else
                {
                    strSql = "Select * From [HMC_Relative] Where Parent_Id is null " + strParam + " Order By Type,ID";
                }
                SqlCommand cmd = new SqlCommand(strSql);
                if (!txtSearch.Text.Equals(""))
                {
                    cmd.Parameters.Add("@Param", SqlDbType.NVarChar).Value = txtSearch.Text;
                }
                conn = new MyConnection();
                dt   = conn.GetData(cmd);

                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #20
0
        protected void BindGrid()
        {
            try
            {
                string     strSql = "Select RunDown_ID,Seq_No From [HMC_PkgRunDown] Where Pkg_Id = '" + strQuePkgId + "' order by seq_no";
                SqlCommand cmd    = new SqlCommand(strSql);
                conn = new MyConnection();
                DataTable dt = conn.GetData(cmd);

                dt.Columns.Add("Name", typeof(string));

                if (dt.Rows.Count == 0)
                {
                    dt.Rows.Add();
                }
                else
                {
                    foreach (DataRow row in dt.Rows) //細項名稱
                    {
                        string strRunDounID = row["RunDown_ID"].ToString();
                        using (conn = new MyConnection())
                        {
                            string     strSql1 = "Select Name From [HMC_RunDown] Where Id = @Id";
                            SqlCommand cmd1    = new SqlCommand(strSql1);
                            cmd1.Parameters.Add("Id", SqlDbType.Int).Value = int.Parse(strRunDounID);
                            DataTable dt1 = conn.GetData(cmd1);

                            if (dt1.Rows.Count > 0)
                            {
                                row["Name"] = dt1.Rows[0].Field <string>("Name");
                            }
                            else
                            {
                                string strmsg = string.Format("代碼{0},資料庫中無此流程", strRunDounID);
                                PublicLib.showAlert(strmsg);
                            }
                            cmd1.Cancel();
                            conn.Dispose();
                        }
                    }
                }

                ViewState["Pkg_Rundown"] = dt;
                GridView1.DataSource     = dt;
                GridView1.DataBind();
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #21
0
        protected void querySql()
        {
            try
            {
                string strParam = " and a.opd_date=?";

                if (!txtRegSearch.Text.Equals(""))
                {
                    strParam += " and a.reg_no=?";
                }

                if (!txtIdNo.Text.Equals(""))
                {
                    strParam += " and b.id_no=?";
                }
                // and room_no = 'HE'
                string strSql = "select to_char(a.opd_date) as opd_date,a.reg_no,a.card_no, b.p_name, b.id_no from opd_reg a,reg_file b where a.reg_no = b.reg_no and dep_no = 'I9' " + strParam + " Order by opd_date desc, a.reg_no";
                System.Data.Odbc.OdbcCommand cmd  = new System.Data.Odbc.OdbcCommand(strSql);
                Dev.ODBCSql.MyODBCConnection conn = new Dev.ODBCSql.MyODBCConnection();

                cmd.Parameters.Add("opd_date", System.Data.Odbc.OdbcType.Date).Value = DateTime.Now.ToString("yyyy/MM/dd");

                if (!txtRegSearch.Text.Equals(""))
                {
                    cmd.Parameters.Add("reg_no", System.Data.Odbc.OdbcType.Char).Value = txtRegSearch.Text;
                }
                if (!txtIdNo.Text.Equals(""))
                {
                    cmd.Parameters.Add("id_no", System.Data.Odbc.OdbcType.Char).Value = txtIdNo.Text;
                }

                dt = conn.GetData(cmd);
                PlaceHolder1.Controls.Clear();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    string strName  = dr["p_name"].ToString();
                    string strRegNo = dr["reg_no"].ToString();
                    PlaceHolder1.Controls.Add(creat_div_tophalf(strName, strRegNo));
                    PlaceHolder1.Controls.Add(creat_detail_btn(strName, strRegNo));
                    PlaceHolder1.Controls.Add(creat_div_bottomhalf(strRegNo));
                }

                ViewState["Generated"] = "true";
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #22
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName.Equals("cmdDel"))
         {
             delete_row(e.CommandArgument.ToString());
         }
     }
     catch (Exception ex)
     {
         PublicLib.handleError("", this.GetType().Name, ex.Message);
     }
 }
Example #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             Get_AppointmentList();
         }
         catch (Exception ex)
         {
             PublicLib.handleError("", this.GetType().Name, ex.Message);
         }
     }
 }
Example #24
0
 private void delete_Relative(string ID)
 {
     try
     {
         conn = new MyConnection();
         string     strcmd = "Delete From [HMC_Relative] Where Id=@Id";
         SqlCommand cmd    = new SqlCommand(strcmd);
         cmd.Parameters.Add("@Id", SqlDbType.Int).Value = int.Parse(ID);
         conn.ExecuteQuery(cmd);
     }
     catch (Exception ex)
     {
         PublicLib.handleError("", this.GetType().Name, ex.Message);
     }
 }
Example #25
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName.Equals("cmdEdit"))
         {
             string strUrl = ResolveUrl(string.Format("~/PkgRunDownSet.aspx?PkgId={0}", e.CommandArgument.ToString()));
             Response.Redirect(strUrl);
         }
     }
     catch (Exception ex)
     {
         PublicLib.handleError("", this.GetType().Name, ex.Message);
     }
 }
Example #26
0
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                //if (e.Row.RowType == DataControlRowType.DataRow)
                //{
                //    LinkButton btnDelete = (LinkButton)e.Row.FindControl("btnDelete");

                //    btnDelete.OnClientClick = "return confirm('確定要刪除:" + e.Row.Cells[0].Text + "?');";
                //}
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
        }
Example #27
0
 public static void showAlert(string Message)
 {
     try
     {
         System.Web.UI.Page page      = HttpContext.Current.CurrentHandler as System.Web.UI.Page;
         string             strScript = string.Format("showAlert('{0}');", Message);
         if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alertMsg"))
         {
             page.ClientScript.RegisterStartupScript(page.GetType(), "alertMsg", strScript, true /* addScriptTags */);
         }
     }
     catch (Exception ex)
     {
         PublicLib.handleError("", "PublicLib", ex.Message);
     }
 }
Example #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToString(ViewState["Generated"]) == "true")
            {
                querySql();
            }


            if (!Page.IsPostBack)
            {
                try
                {
                    querySql();
                }
                catch (Exception ex)
                {
                    PublicLib.handleError("", this.GetType().Name, ex.Message);
                }
            }
        }
Example #29
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                conn = new MyConnection();
                string     strSql = "Insert Into [HMC_Relative] (Type,Pkg_Id,Parent_Id, Cre_Date, Cre_User) Values (@Type,@Pkg_Id, @Parent_Id, @Cre_Date, @Cre_user)";
                SqlCommand cmd    = new SqlCommand(strSql);
                cmd.Parameters.Add("@Type", SqlDbType.Int).Value          = 1;
                cmd.Parameters.Add("@Pkg_Id", SqlDbType.Int).Value        = ddlPkgCode.SelectedValue;
                cmd.Parameters.Add("@Parent_Id", SqlDbType.Int).Value     = strQuePID;
                cmd.Parameters.Add("@Cre_Date", SqlDbType.DateTime).Value = DateTime.Now;
                cmd.Parameters.Add("@Cre_User", SqlDbType.VarChar).Value  = "05890";
                conn.ExecuteQuery(cmd);
            }
            catch (Exception ex)
            {
                PublicLib.handleError("", this.GetType().Name, ex.Message);
            }
            string strUrl = ResolveUrl(string.Format("~/PkgRelative.aspx?PID={0}", strQuePID));

            Response.Redirect(strUrl);
        }