Exemple #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    TextBox  tbNumRoom      = (TextBox)item.FindControl("TextBox2");
                    TextBox  tbNumMM        = (TextBox)item.FindControl("TextBox3");
                    Label    lbFloorType    = (Label)item.FindControl("Label1");
                    Repeater rpFlooringType = (Repeater)item.FindControl("Repeater2");

                    if (lbFloorType != null)
                    {
                        string param_floorType = lbFloorType.Text.Trim();
                        string param_numRoom   = string.Empty;
                        if (tbNumRoom != null)
                        {
                            param_numRoom = tbNumRoom.Text.Trim();
                        }
                        else
                        {
                            param_numRoom = "0";
                        }
                        if (tbNumMM != null)
                        {
                            string param_numMM = tbNumMM.Text.Trim();

                            string param_flooringType = "";
                            foreach (RepeaterItem itemF in rpFlooringType.Items)
                            {
                                RadioButton rbSelect       = (RadioButton)itemF.FindControl("RadioButton1");
                                Label       lbFlooringType = (Label)itemF.FindControl("Label2");
                                if (rbSelect != null && rbSelect.Checked == true)
                                {
                                    param_flooringType = lbFlooringType.Text;
                                }
                            }

                            string sql_command = " EXEC [set_Project_03_03-06_Floor_New] "
                                                 + " '" + param_projid + "','" + param_flooringType + "','" + param_floorType + "','" + param_numMM + "','" + param_numRoom + "','" + userID + "' ";
                            ClassConfig.GetDataSQL(sql_command);
                        }
                    }
                }

                //Function Min Max
                string sql_min_max = " EXEC [dbo].[set_min_max_all] '" + param_projid + "', '" + userID + "' ";
                ClassConfig.GetDataSQL(sql_min_max);

                //Update Status
                ClassConfig.UpdateStatus(param_projid, "On Progress", userID);

                //Redirect
                Response.Redirect("CreateProject_03_04?id=" + param_projid);
            }
            catch (Exception)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "$('#alertError').show();", true);
            }
        }
        protected void getUserInfo()
        {
            string    sql = "[dbo].[get_Home_Proj] '" + userID + "','" + param_projid + "'";
            DataTable dt1 = new DataTable();

            dt1 = ClassConfig.GetDataSQL(sql);

            if (dt1.Rows.Count > 0)
            {
                if (dt1.Rows[0]["status"].ToString() == "Complete")
                {
                    string    sql_command = "SELECT [status1],[status2],[status3],[status4],[status5],[status6] FROM [BESTBoQ].[dbo].[userinfo] WHERE [userid] = '" + userID + "'";
                    DataTable dt          = ClassConfig.GetDataSQL(sql_command);
                    if (dt.Rows.Count > 0)
                    {
                        s1 = dt.Rows[0]["status1"].ToString();
                        s2 = dt.Rows[0]["status2"].ToString();
                        s3 = dt.Rows[0]["status3"].ToString();
                        s4 = dt.Rows[0]["status4"].ToString();
                        s5 = dt.Rows[0]["status5"].ToString();
                        s6 = dt.Rows[0]["status6"].ToString();
                    }
                }
                else
                {
                    s1 = "false";
                    s2 = "false";
                    s3 = "false";
                    s4 = "false";
                    s5 = "false";
                    s6 = "false";
                }
            }
        }
Exemple #3
0
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            string   param_floorType = (string)DataBinder.Eval(e.Item.DataItem, "floorType");
            TextBox  tbNumRoom       = (TextBox)e.Item.FindControl("TextBox2");
            TextBox  tbNumM          = (TextBox)e.Item.FindControl("TextBox3");
            Repeater rp = (Repeater)e.Item.FindControl("Repeater2");

            string    sql_command = " EXEC [dbo].[get_template_03_06] '" + param_projid + "'";
            DataTable dt          = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                rp.DataSource = dt;
                rp.DataBind();
            }

            if (dt_old.Rows.Count > 0)
            {
                foreach (DataRow dr in dt_old.Rows)
                {
                    if (dr["floorType"].ToString().Trim() == param_floorType.Trim())
                    {
                        tbNumRoom.Text = dr["numRoom"].ToString().Trim();
                        tbNumM.Text    = dr["numMM"].ToString().Trim();
                    }
                }
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    RadioButton rbSelect  = (RadioButton)item.FindControl("RadioButton1");
                    Label       lbcolorID = (Label)item.FindControl("Label1");
                    if (lbcolorID != null)
                    {
                        string param_colorID = lbcolorID.Text.Trim();
                        //string param_MMTotal = lbTotal.Text.Trim().Replace("ตรม.รวม = ", "");
                        double param_MMTotal = getMM();
                        if (rbSelect != null && rbSelect.Checked == true)
                        {
                            string sql_command = " EXEC [dbo].[set_Project_03_12_Color] "
                                                 + " '" + param_projid + "','"
                                                 + param_colorID + "','"
                                                 + param_MMTotal + "','"
                                                 + userID + "' ";
                            ClassConfig.GetDataSQL(sql_command);
                        }
                    }
                }

                Response.Redirect("CreateProject_03_13?id=" + param_projid);
            }
            catch (Exception)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "$('#alertError').show();", true);
            }
        }
Exemple #5
0
        protected void Repeater2_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var repeater       = (Repeater)sender;
            var parentItem     = (RepeaterItem)repeater.NamingContainer;
            var parentDataItem = parentItem.DataItem;

            string      param_floorType = (string)DataBinder.Eval(parentDataItem, "floorType");
            RadioButton rb             = (RadioButton)e.Item.FindControl("RadioButton1");
            Label       lbFlooringType = (Label)e.Item.FindControl("Label2");

            //rb.ID = param_floorType.Trim();

            string    sql_command_06 = " SELECT [projectid],[flooringType],[numMM],[floorType] FROM [BESTBoQ].[dbo].[Project_03_06_Flooring] WHERE [projectid] = '" + param_projid + "' AND floorType ='" + param_floorType + "' AND floorType <> 'A6'";
            DataTable dt_old_06      = ClassConfig.GetDataSQL(sql_command_06);

            if (dt_old_06.Rows.Count > 0)
            {
                if (param_floorType.Trim().ToString() == dt_old_06.Rows[0]["floorType"].ToString().Trim())
                {
                    if (lbFlooringType.Text.Trim() == dt_old_06.Rows[0]["flooringType"].ToString().Trim())
                    {
                        rb.Checked = true;
                    }
                }
            }
        }
Exemple #6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (RepeaterItem item in Repeater2.Items)
                {
                    RadioButton rbSelect = (RadioButton)item.FindControl("RadioButton1");
                    Label       lbHomeId = (Label)item.FindControl("Label1");
                    if (lbHomeId != null)
                    {
                        string param_homeid = lbHomeId.Text.Trim();
                        if (rbSelect != null && rbSelect.Checked == true)
                        {
                            //Execute
                            string sql_command = "EXEC [set_Project_02_Home] '"
                                                 + param_projid + "','"
                                                 + param_homeid + "','"
                                                 + userID + "' ";
                            ClassConfig.GetDataSQL(sql_command);
                        }
                    }
                }
                //Update Status
                ClassConfig.UpdateStatus(param_projid, "On Progress", userID);

                //Response.Write("<script>alert('Insert Data 02 Success');</script>");
                Response.Redirect("CreateProject_03_01?id=" + param_projid);
            }
            catch (Exception)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "$('#alertError').show();", true);
                //Response.Write("<script>alert('Insert Data 02 Please Contract Admin');</script>");
            }
        }
Exemple #7
0
        protected void getOldData()
        {
            string    sql_command = " EXEC [dbo].[get_userinfo_Logo] '" + Session["UserID"] + "'";
            DataTable dt          = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                //Set Data to Label
                lbUsername.Text      = dt.Rows[0]["username"].ToString().Trim();
                rbType.SelectedValue = dt.Rows[0]["type"].ToString().Trim();
                lbEmail.Text         = dt.Rows[0]["email"].ToString().Trim();
                lbMobile.Text        = dt.Rows[0]["mobile"].ToString().Trim();
                lbName.Text          = dt.Rows[0]["name"].ToString().Trim();
                lbAddress.Text       = dt.Rows[0]["address"].ToString().Trim();
                lbId.Text            = dt.Rows[0]["idcard"].ToString().Trim();
                lbTax.Text           = dt.Rows[0]["taxname"].ToString().Trim();
                lbNational.Text      = dt.Rows[0]["idnation"].ToString().Trim();

                //Set Date to Textbox
                tbEmail.Text    = dt.Rows[0]["email"].ToString().Trim();
                tbMobile.Text   = dt.Rows[0]["mobile"].ToString().Trim();
                tbName.Text     = dt.Rows[0]["name"].ToString().Trim();
                tbAddress.Text  = dt.Rows[0]["address"].ToString().Trim();
                tbId.Text       = dt.Rows[0]["idcard"].ToString().Trim();
                tbTax.Text      = dt.Rows[0]["taxname"].ToString().Trim();
                tbNational.Text = dt.Rows[0]["idnation"].ToString().Trim();

                imgLogoCompany.ImageUrl = dt.Rows[0]["pathpic"].ToString();
            }
        }
Exemple #8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    RadioButton rbSelect = (RadioButton)item.FindControl("RadioButton1");
                    Label       lbType   = (Label)item.FindControl("Label1");
                    if (lbType != null)
                    {
                        string param_type = lbType.Text.Trim();
                        if (rbSelect != null && rbSelect.Checked == true)
                        {
                            string sql_command = " EXEC [dbo].[set_Project_03_11_Electric_New] "
                                                 + " '" + param_projid + "','" + userID + "','" + param_type + "' ";
                            ClassConfig.GetDataSQL(sql_command);
                        }
                    }
                }

                Response.Redirect("CreateProject_03_12?id=" + param_projid);
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "$('#alertError').show();", true);
            }
        }
        protected void btnReNew_Click(object sender, EventArgs e)
        {
            //Get val form control
            string param_username = tbCuser.Text.Trim();
            string param_old      = tbCold.Text.Trim();
            string param_new      = tbCnew.Text.Trim();
            string param_confirm  = tbCcon.Text.Trim();
            string param_password;

            string sql_chk = "SELECT * FROM [BESTBoQ].[dbo].[userinfo] WHERE [username] = '" + param_username
                             + "' AND [password] = N'" + ClassConfig.CalculateMD5Hash(param_old + "AISNQM") + "'  ";
            DataTable dt_chk = ClassConfig.GetDataSQL(sql_chk);

            if (dt_chk.Rows.Count > 0)
            {
                string user_id = dt_chk.Rows[0]["userid"].ToString();

                if (param_new == param_confirm)
                {
                    string sql_delete_flag = "DELETE [BESTBoQ].[dbo].[FlagNew] WHERE [userid] = '" + user_id + "'";
                    ClassConfig.GetDataSQL(sql_delete_flag);

                    param_password = ClassConfig.CalculateMD5Hash(param_new + "AISNQM");
                    string sql_command = " UPDATE [BESTBoQ].[dbo].[userinfo]  "
                                         + " SET [password] = '" + param_password + "' "
                                         + " WHERE [username] = N'" + param_username
                                         + "' AND [password] = N'" + ClassConfig.CalculateMD5Hash(tbCold.Text.Trim() + "AISNQM") + "' ";
                    DataTable dt = ClassConfig.GetDataSQL(sql_command);

                    Response.Redirect("Default?r=forgetComplete");
                }
            }
        }
Exemple #10
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    TextBox tbNumMM        = (TextBox)item.FindControl("TextBox1");
                    Label   lbflooringType = (Label)item.FindControl("Label2");
                    if (lbflooringType != null)
                    {
                        string param_flooringType = lbflooringType.Text.Trim();
                        if (tbNumMM != null && tbNumMM.Text.Trim() != "0")
                        {
                            string param_numMM = tbNumMM.Text.Trim();
                            string sql_command = " EXEC [dbo].[set_Project_03_06_Flooring] "
                                                 + " '" + param_projid + "','" + param_flooringType + "','" + param_numMM + "','" + userID + "' ";
                            ClassConfig.GetDataSQL(sql_command);
                        }
                    }
                }
                //Update Status
                ClassConfig.UpdateStatus(param_projid, "On Progress", userID);

                //Redirect
                Response.Redirect("CreateProject_03_07?id=" + param_projid);
            }
            catch (Exception)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "$('#alertError').show();", true);
            }
        }
Exemple #11
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //Get val form control
            string param_username = tbLoginUsername.Text.Trim();
            string param_password = ClassConfig.CalculateMD5Hash(tbLoginPassword.Text.Trim() + "AISNQM");

            //Execute Command
            try
            {
                string sql_command = "SELECT [status1],[status2],[status3],[status4],[status5],[status6],[userid] FROM [BESTBoQ].[dbo].[userinfo] "
                                     + " WHERE [username] = '" + param_username + "' AND [password] = '" + param_password + "' ";
                DataTable dt = ClassConfig.GetDataSQL(sql_command);

                if (dt.Rows.Count < 1)
                {
                    //No Data in userinfo
                    Response.Redirect("Default?r=loginPermission");
                    //Response.Write("<script>alert('กรุณาลงทะเบียนก่อนเข้าใช้งาน');</script>");
                }
                else
                {
                    if (dt.Rows[0][0].ToString() != "true")
                    {
                        //Not Yet Approve
                        Response.Redirect("Default?r=userPermission");
                        //Response.Write("<script>alert('username ของท่านยังไม่ได้รับการอนุมัติ กรุณาติดต่อผู้ดูแล');</script>");
                    }
                    else
                    {
                        Session["Username"] = param_username;
                        Session["UserID"]   = dt.Rows[0][6].ToString();
                        Session.Timeout     = 24 * 60;

                        //log data to database
                        string dqlLog = " INSERT INTO [BESTBoQ].[dbo].[Log_Usage] ( [user],[login_date] ) " +
                                        " VALUES(N'" + param_username + "', GETDATE())";
                        ClassConfig.GetDataSQL(dqlLog);

                        //log data to database
                        string    sqlChk = "SELECT * FROM [BESTBoQ].[dbo].[FlagNew] WHERE [userid] = '" + Session["UserID"].ToString() + "'";
                        DataTable dtFlag = ClassConfig.GetDataSQL(sqlChk);

                        if (dtFlag.Rows.Count > 0)
                        {
                            Response.Redirect("ChangePassword.aspx", false);
                        }
                        else
                        {
                            Response.Redirect("Home.aspx");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //SQL Error or Network Error
                Response.Write("<script>alert('ระบบมีปัญหา กรุณาติดต่อผู้ดูแล');</script>");
            }
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    projectID = Request["projectID"];
            DataTable dt        = ClassConfig.GetDataSQL("EXECUTE [dbo].[get_Plan] '<projectID>'".Replace("<projectID>", projectID));

            if (dt.Rows.Count > 0)
            {
                DateTime startTime = Convert.ToDateTime(dt.Rows[0]["start"].ToString());
                Year  = startTime.Year.ToString();
                Month = startTime.Month.ToString();
                Day   = startTime.Day.ToString();

                TotalDate = dt.Rows[0]["Total"].ToString();

                ProjectName = dt.Rows[0]["projectName"].ToString();

                int stop1  = Convert.ToInt16(dt.Rows[0]["s1"]);
                int stop2  = stop1 + Convert.ToInt16(dt.Rows[0]["s2"]);
                int stop3  = stop2 + Convert.ToInt16(dt.Rows[0]["s3"]);
                int stop4  = stop3 + Convert.ToInt16(dt.Rows[0]["s4"]);
                int stop5  = stop4 + Convert.ToInt16(dt.Rows[0]["s5"]);
                int stop6  = stop5 + Convert.ToInt16(dt.Rows[0]["s6"]);
                int stop7  = stop6 + Convert.ToInt16(dt.Rows[0]["s7"]);
                int stop8  = stop7 + Convert.ToInt16(dt.Rows[0]["s8"]);
                int stop9  = stop8 + Convert.ToInt16(dt.Rows[0]["s9"]);
                int stop10 = stop9 + Convert.ToInt16(dt.Rows[0]["s10"]);

                Phase1Start = 0.ToString();
                Phase1Stop  = stop1.ToString();

                Phase2Start = (stop1 - Math.Round(Convert.ToDouble(dt.Rows[0]["s1"]) * 0.2)).ToString();
                Phase2Stop  = stop2.ToString();

                Phase3Start = (stop2 - Math.Round(Convert.ToDouble(dt.Rows[0]["s2"]) * 0.2)).ToString();
                Phase3Stop  = stop3.ToString();

                Phase4Start = (stop3 - Math.Round(Convert.ToDouble(dt.Rows[0]["s3"]) * 0.2)).ToString();
                Phase4Stop  = stop4.ToString();

                Phase5Start = (stop4 - Math.Round(Convert.ToDouble(dt.Rows[0]["s4"]) * 0.2)).ToString();
                Phase5Stop  = stop5.ToString();

                Phase6Start = (stop5 - Math.Round(Convert.ToDouble(dt.Rows[0]["s5"]) * 0.2)).ToString();
                Phase6Stop  = stop6.ToString();

                Phase7Start = (stop6 - Math.Round(Convert.ToDouble(dt.Rows[0]["s6"]) * 0.2)).ToString();
                Phase7Stop  = stop7.ToString();

                Phase8Start = (stop7 - Math.Round(Convert.ToDouble(dt.Rows[0]["s7"]) * 0.2)).ToString();
                Phase8Stop  = stop8.ToString();

                Phase9Start = (stop8 - Math.Round(Convert.ToDouble(dt.Rows[0]["s8"]) * 0.2)).ToString();
                Phase9Stop  = stop9.ToString();

                Phase10Start = (stop9 - Math.Round(Convert.ToDouble(dt.Rows[0]["s9"]) * 0.2)).ToString();
                Phase10Stop  = stop10.ToString();
            }
        }
Exemple #13
0
        protected void getData()
        {
            string    sql = "[dbo].[get_Home_Proj] '" + userID + "','" + param_projid + "'";
            DataTable dt  = new DataTable();

            dt = ClassConfig.GetDataSQL(sql);

            if (dt.Rows.Count > 0)
            {
                img.ImageUrl      = dt.Rows[0]["homepic"].ToString();
                lbProjName.Text   = dt.Rows[0]["projectname"].ToString();
                lbProjName2.Text  = dt.Rows[0]["projectname"].ToString();
                lbProjType.Text   = dt.Rows[0]["homename"].ToString();
                lbCusName.Text    = dt.Rows[0]["customername"].ToString();
                lbCusName2.Text   = dt.Rows[0]["customername"].ToString();
                lbCusAddress.Text = dt.Rows[0]["address"].ToString() + ' ' + dt.Rows[0]["province"].ToString() + ' ' + dt.Rows[0]["country"].ToString();
                lbProjStart.Text  = dt.Rows[0]["projectstart"].ToString();
                lbContract.Text   = dt.Rows[0]["contractid"].ToString();
                lbStatus.Text     = dt.Rows[0]["status"].ToString();

                double totalPrice = 0.00;
                double feePrice   = 0.00;
                double promoPrice = 0.00;
                double otherPrice = 0.00;
                double lastPrice  = 0.00;

                if (dt.Rows[0]["status"].ToString() == "Complete")
                {
                    string    sql_price = " SELECT * FROM [BESTBoQ].[dbo].[Project_Last_Price] WHERE [projectid] = '" + param_projid + "' ";
                    DataTable dt_price  = ClassConfig.GetDataSQL(sql_price);
                    if (dt_price.Rows.Count > 0)
                    {
                        Double.TryParse(dt_price.Rows[0]["TotalMoney"].ToString(), out totalPrice);
                        Double.TryParse(dt_price.Rows[0]["FreeMoney"].ToString(), out feePrice);
                        Double.TryParse(dt_price.Rows[0]["PromoMoney"].ToString(), out promoPrice);
                        Double.TryParse(dt_price.Rows[0]["OtherMoney"].ToString(), out otherPrice);
                        Double.TryParse(dt_price.Rows[0]["LastMoney"].ToString(), out lastPrice);
                    }
                }
                else
                {
                    Double.TryParse(dt.Rows[0]["Total"].ToString(), out totalPrice);
                    Double.TryParse(dt.Rows[0]["Free"].ToString(), out feePrice);
                    Double.TryParse(dt.Rows[0]["Promo"].ToString(), out promoPrice);
                    Double.TryParse(dt.Rows[0]["Other"].ToString(), out otherPrice);
                    Double.TryParse(dt.Rows[0]["Last"].ToString(), out lastPrice);
                }

                lbTotalPrice.Text = String.Format("{0:N2}", totalPrice);
                lbFeePrice.Text   = String.Format("{0:N2}", feePrice);
                lbPromoPrice.Text = String.Format("{0:N2}", promoPrice);
                lbOtherPrice.Text = String.Format("{0:N2}", otherPrice);
                lbLastPrice.Text  = String.Format("{0:N2}", lastPrice);
            }
        }
        protected void bindDD()
        {
            string    sql_command = " EXEC [dbo].[get_template_03_05] '" + param_projid + "'";
            DataTable dt          = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
        }
Exemple #15
0
        protected void bindData()
        {
            string sql_command = " SELECT RTRIM([flooringType]) AS [flooringType],[cost_mm],[detail],[picpath] "
                                 + " FROM [BESTBoQ].[dbo].[CFG_3_6_Flooring] ";
            DataTable dt = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
        }
Exemple #16
0
        protected void bindCountry()
        {
            string    sql_command = "SELECT [country] FROM [BESTBoQ].[dbo].[CFG_Province] GROUP BY [country]";
            DataTable dt          = ClassConfig.GetDataSQL(sql_command);

            ddCountry.DataSource     = dt;
            ddCountry.DataTextField  = "country";
            ddCountry.DataValueField = "country";
            ddCountry.DataBind();

            ddCountry.Items.Insert(0, new ListItem("กรุณาเลือกประเทศ", ""));
        }
Exemple #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string projectID = Request["projectID"];

            DataTable dt = ClassConfig.GetDataSQL("exec dbo.get_Contract_Info '" + projectID + "'");

            HomeName    = dt.Rows[0]["homename"] == null ? "" : dt.Rows[0]["homename"].ToString();
            ProjectName = dt.Rows[0]["projectname"] == null ? "" : dt.Rows[0]["projectname"].ToString();
            Customer    = dt.Rows[0]["customername"] == null ? "" : dt.Rows[0]["customername"].ToString();
            CompanyName = "";
            ContractID  = dt.Rows[0]["contractid"] == null ? "" : dt.Rows[0]["contractid"].ToString();
        }
Exemple #18
0
        protected void bindProjectType()
        {
            string    sql_command = "SELECT [homegroup] FROM [BESTBoQ].[dbo].[CFG_Home_Type] GROUP BY [homegroup]";
            DataTable dt          = ClassConfig.GetDataSQL(sql_command);

            ddProjectType.DataSource     = dt;
            ddProjectType.DataTextField  = "homegroup";
            ddProjectType.DataValueField = "homegroup";
            ddProjectType.DataBind();

            ddProjectType.Items.Insert(0, new ListItem("กรุณาเลือกประเภทของโครงการ", ""));
        }
Exemple #19
0
        protected void ddCountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            string    param_country = ddCountry.SelectedValue.ToString().Trim();
            string    sql_command   = "SELECT [province] FROM [BESTBoQ].[dbo].[CFG_Province] WHERE [country] = N'" + param_country + "'";
            DataTable dt            = ClassConfig.GetDataSQL(sql_command);

            ddProvince.DataSource     = dt;
            ddProvince.DataTextField  = "province";
            ddProvince.DataValueField = "province";
            ddProvince.DataBind();

            ddProvince.Items.Insert(0, new ListItem("กรุณาเลือกจังหวัด", ""));
        }
Exemple #20
0
        private void bindHomeGroup()
        {
            string sql_command = " SELECT B.[homeid],B.[homename],B.[homepic] "
                                 + " FROM[BESTBoQ].[dbo].[Project_01_Desc] A LEFT JOIN[BESTBoQ].[dbo].[CFG_Home_Type] B "
                                 + " ON A.[projecttype] = B.[homegroup] WHERE A.[projectid] = '" + param_projid + "' ";
            DataTable dt = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                Repeater2.DataSource = dt;
                Repeater2.DataBind();
            }
        }
        private void getSectionPrice()
        {
            string    sql_price_command = " [dbo].[get_Last_Price] '" + param_projid + "'";
            DataTable dtPrice           = ClassConfig.GetDataSQL(sql_price_command);

            if (dtPrice.Rows.Count > 0)
            {
                foreach (DataRow dr in dtPrice.Rows)
                {
                    section_price = dr[4].ToString();
                }
            }
        }
Exemple #22
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    //RadioButtonList rbSelect = (RadioButtonList)item.FindControl("RadioButtonList1");

                    Label       lbRoofStyle = (Label)item.FindControl("Label1");
                    Label       lbRoofType  = (Label)item.FindControl("Label2");
                    RadioButton rbSelect    = (RadioButton)item.FindControl("RadioButton1");

                    if (lbRoofStyle != null && lbRoofType != null)
                    {
                        string param_roofStyle = lbRoofStyle.Text.Trim();
                        string param_roofType  = lbRoofType.Text.Trim();

                        if (rbSelect != null && rbSelect.Checked == true)
                        {
                            string sql_command = " EXEC [dbo].[set_Project_03_04_Roof] "
                                                 + " '" + param_projid + "','" + param_roofStyle + "','" + param_roofType + "','" + userID + "','All'";
                            ClassConfig.GetDataSQL(sql_command);
                        }

                        //    foreach (ListItem li in rbSelect.Items)
                        //    {
                        //if (rbSelect != null && li.Selected == true)
                        //{
                        //string param_roofType = li.Value.ToString().Trim();
                        //string sql_command = " EXEC [dbo].[set_Project_03_04_Roof] "
                        //         + " '" + param_projid + "','" + param_roofStyle + "','" + param_roofType + "','" + userID + "'";
                        //ClassConfig.GetDataSQL(sql_command);
                        //}
                    }
                }

                //Update Spec
                ClassConfig.UpdateSpec(param_projid, "", userID);

                //Update Status
                ClassConfig.UpdateStatus(param_projid, "On Progress", userID);

                //Redirect
                Response.Redirect("CreateProject_03_05?id=" + param_projid);
            }
            catch (Exception)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "$('#alertError').show();", true);
            }
        }
Exemple #23
0
        public void checkUser(string username)
        {
            string    sql = "SELECT * FROM [BESTBoQ].[dbo].[userinfo] WHERE [username] = '" + username + "'";
            DataTable dt  = ClassConfig.GetDataSQL(sql);

            if (dt.Rows.Count > 0)
            {
                HttpContext.Current.Response.Write("Yes");
            }
            else
            {
                HttpContext.Current.Response.Write("No");
            }
        }
Exemple #24
0
        protected void RepeaterDetail_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Repeater r2         = (Repeater)e.Item.FindControl("Repeater2");
            string   param_type = (string)DataBinder.Eval(e.Item.DataItem, "type");

            string    sql_command = " EXEC [dbo].[get_template_03_11_Detail] '" + param_projid + "','" + param_type + "'";
            DataTable dt          = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                r2.DataSource = dt;
                r2.DataBind();
            }
        }
        protected string getMM3()
        {
            string    sql_command = "EXEC [dbo].[get_MM_All_A5] '" + param_projid + "'";
            DataTable dt          = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                return(dt.Rows[0][0].ToString());
            }
            else
            {
                return("0");
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    RadioButton rbSelect     = (RadioButton)item.FindControl("RadioButton1");
                    Label       lbindoorType = (Label)item.FindControl("Label2");
                    if (lbindoorType != null)
                    {
                        string param_indoorType = lbindoorType.Text.Trim();
                        if (rbSelect != null && rbSelect.Checked == true)
                        {
                            string sql_command = " EXEC [dbo].[set_Project_03_10_Ceiling] "
                                                 + " '" + param_projid + "','INDOOR','" + param_indoorType + "','" + getMM3() + "','" + userID + "' ";
                            ClassConfig.GetDataSQL(sql_command);
                        }
                    }
                }

                foreach (RepeaterItem item in Repeater2.Items)
                {
                    RadioButton rbSelect      = (RadioButton)item.FindControl("RadioButton2");
                    Label       lboutdoorType = (Label)item.FindControl("Label4");
                    if (lboutdoorType != null)
                    {
                        string param_outdoorType = lboutdoorType.Text.Trim();
                        if (rbSelect != null && rbSelect.Checked == true)
                        {
                            string sql_command = " EXEC [dbo].[set_Project_03_10_Ceiling] "
                                                 + " '" + param_projid + "','OUTDOOR','" + param_outdoorType + "','" + (double.Parse(getMM3(), CultureInfo.InvariantCulture) * 0.45).ToString() + "','" + userID + "' ";
                            ClassConfig.GetDataSQL(sql_command);
                        }
                    }
                }

                //Update Spec
                ClassConfig.UpdateSpec(param_projid, "", userID);

                //Update Status
                ClassConfig.UpdateStatus(param_projid, "On Progress", userID);

                //Redirect
                Response.Redirect("CreateProject_03_11?id=" + param_projid);
            }
            catch (Exception)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "$('#alertError').show();", true);
            }
        }
        protected static double getMM(string param_projID)
        {
            string    sql_command = "EXEC [dbo].[get_MM] '" + param_projID + "'";
            DataTable dt          = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                return(double.Parse((dt.Rows[0][0].ToString()), CultureInfo.InvariantCulture));
            }
            else
            {
                return(0);
            }
        }
Exemple #28
0
        protected void getOldData()
        {
            string sql_command = " SELECT [projectid],[projectname],[customername],[projecttype] "
                                 + " ,[country],[province],[address],[projectstart]"
                                 + " ,[contractid],[userid],[transdate],[customerphone],[customeremail] "
                                 + " ,[birthdate], [customerid] "
                                 + " FROM [BESTBoQ].[dbo].[Project_01_Desc] WHERE [projectid] = '" + param_projid + "'";
            DataTable dt = ClassConfig.GetDataSQL(sql_command);

            if (dt.Rows.Count > 0)
            {
                tbProjectName.Text          = dt.Rows[0]["projectname"].ToString().Trim();
                tbCustomerName.Text         = dt.Rows[0]["customername"].ToString().Trim();
                ddProjectType.SelectedValue = dt.Rows[0]["projecttype"].ToString().Trim();
                ddCountry.SelectedValue     = dt.Rows[0]["country"].ToString().Trim();

                string    param_country = dt.Rows[0]["country"].ToString().Trim();
                string    sql           = "SELECT [province] FROM [BESTBoQ].[dbo].[CFG_Province] WHERE [country] = N'" + param_country + "'";
                DataTable dt1           = ClassConfig.GetDataSQL(sql);
                ddProvince.DataSource     = dt1;
                ddProvince.DataTextField  = "province";
                ddProvince.DataValueField = "province";
                ddProvince.DataBind();

                ddProvince.SelectedValue = dt.Rows[0]["province"].ToString().Trim();
                tbAddress.Text           = dt.Rows[0]["address"].ToString().Trim();
                tbStartProject.Text      = dt.Rows[0]["projectstart"].ToString().Trim();

                tbTelephoneCus.Text = dt.Rows[0]["customerphone"].ToString().Trim();
                tbEmailCus.Text     = dt.Rows[0]["customeremail"].ToString().Trim();

                tbBirthdate.Text = dt.Rows[0]["birthdate"].ToString().Trim();
                tbCusID.Text     = dt.Rows[0]["customerid"].ToString().Trim();
            }


            sql_command = "SELECT [spec] FROM [BESTBoQ].[dbo].[Project_Spec] WHERE [projectid] = '" + param_projid + "'";
            dt          = ClassConfig.GetDataSQL(sql_command);

            rbCostFunction.SelectedValue = "";

            if (dt.Rows.Count > 0)
            {
                string spec = dt.Rows[0]["spec"].ToString().ToLower().Trim();
                if (spec.Equals("min") || spec.Equals("max"))
                {
                    rbCostFunction.SelectedValue = spec;
                }
            }
        }
Exemple #29
0
        protected void getData()
        {
            string    sql = "[dbo].[get_Home_Proj] '" + userID + "','%'";
            DataTable dt  = new DataTable();

            dt = ClassConfig.GetDataSQL(sql);
            gvData.DataSource = dt;
            gvData.DataBind();

            if (dt.Rows.Count > 0)
            {
                gvData.UseAccessibleHeader    = true;
                gvData.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
        }
Exemple #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    projectID = Request["projectID"];
            DataTable dt        = ClassConfig.GetDataSQL("EXECUTE [dbo].[get_Report] '<projectID>'".Replace("<projectID>", projectID));

            if (dt.Rows.Count > 0)
            {
                MaterialAmount  = Math.Round(Convert.ToDouble(dt.Rows[0]["bMaterial"]), 2).ToString("N0");
                MaterialPct     = dt.Rows[0]["pMaterial"].ToString();
                ManhourAmount   = Math.Round(Convert.ToDouble(dt.Rows[0]["bPower"]), 2).ToString("N0");
                ManhourPct      = dt.Rows[0]["pPower"].ToString();
                OperationAmount = Math.Round(Convert.ToDouble(dt.Rows[0]["bBenefit"]), 2).ToString("N0");
                OperationPct    = dt.Rows[0]["pBenefit"].ToString();
            }
        }