Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("/");
            }

            if (txtETime.Text == "")
            {
                txtETime.Text = DateTime.Now.ToString("HH.mm");
            }

            if (!this.IsPostBack)
            {
                BindData("");

                string sql = "";
                if (function.CheckLevel("Department", Session["UserPrivilegeId"].ToString()))
                {
                    sql = "SELECT * FROM tbl_cpoint ORDER BY cpoint_id";
                    function.getListItem(txtCpointSearch, sql, "cpoint_name", "cpoint_id");
                    txtCpointSearch.Items.Insert(0, new ListItem("ทั้งหมด", ""));
                }
                else
                {
                    sql = "SELECT * FROM tbl_cpoint WHERE cpoint_id = '" + Session["UserCpoint"].ToString() + "'";
                    function.getListItem(txtCpointSearch, sql, "cpoint_name", "cpoint_id");
                    //txtCpointSearch.Items.Insert(0, new ListItem("ทั้งหมด", ""));
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["codePK"] == null)
            {
                Response.Redirect("/");
            }


            ShowDiv();
            try
            {
                if (!this.IsPostBack)
                {
                    string sql = "";
                    if (Session["UserCpoint"].ToString() == "0")
                    {
                        sql = "SELECT * FROM tbl_cpoint ORDER BY cpoint_id";
                    }
                    else
                    {
                        sql = "SELECT * FROM tbl_cpoint WHERE cpoint_id = '" + Session["UserCpoint"].ToString() + "'";
                    }
                    function.getListItem(txtCpoint, sql, "cpoint_name", "cpoint_id");
                    function.GetList(txtAround, "AroundList");
                    function.GetList(txtPosAleat, "PosList");
                    function.GetList(txtPosSup, "PosList");
                    function.GetList(txtPosCom, "PosList");
                    function.GetList(txtCB, "CabinetList");
                    function.GetList(txtCBClaim, "CabinetList");

                    string sql_Device = "SELECT * FROM tbl_device ORDER BY device_name";
                    function.getListItem(txtDevice, sql_Device, "device_name", "device_id");
                    txtDevice.Items.Insert(0, new ListItem("", ""));
                    BindCom();
                    BindDevice();
                    BindImg();
                    BindDoc();
                    PageLoadData();

                    /*if(function.GetSelectValue("tbl_claim","claim_id='"+ Session["CodePK"].ToString()+"'", "claim_status") != "1")
                     * {
                     *  cardBody.Attributes.Add("readonly","true");
                     * }*/
                }
            }
            catch { }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                if (Session["UserCpoint"].ToString() != "0")
                {
                    Response.Redirect("/Claim/claimForm");
                    //TestGittttxxxx
                    //แก้้้้
                }

                string date = DateTime.Now.ToString("dd-MM") + "-" + (DateTime.Now.Year + 543);

                if (!this.IsPostBack)
                {
                    function.getListItem(txtYear, "SELECT claim_budget_year FROM tbl_claim c GROUP BY claim_budget_year", "claim_budget_year", "claim_budget_year");
                    txtYear.SelectedValue = function.getBudgetYear(date);
                }
                //Response.Redirect("/Claim/claimForm");
                getBind(txtYear.SelectedValue);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("/");
            }

            if (!this.IsPostBack)
            {
                string sql = "";
                if (function.CheckLevel("Department", Session["UserPrivilegeId"].ToString()))
                {
                    sql = "SELECT * FROM tbl_cpoint ORDER BY cpoint_id";
                    function.getListItem(txtCpoint, sql, "cpoint_name", "cpoint_id");
                    function.getListItem(txtCpointSearch, sql, "cpoint_name", "cpoint_id");
                    txtCpointSearch.Items.Insert(0, new ListItem("ทั้งหมด", ""));
                }
                else
                {
                    sql = "SELECT * FROM tbl_cpoint WHERE cpoint_id = '" + Session["UserCpoint"].ToString() + "'";
                    function.getListItem(txtCpoint, sql, "cpoint_name", "cpoint_id");
                    function.getListItem(txtCpointSearch, sql, "cpoint_name", "cpoint_id");
                    //txtCpointSearch.Items.Insert(0, new ListItem("ทั้งหมด", ""));
                }

                string sql_Device = "SELECT * FROM tbl_device ORDER BY device_name";
                function.getListItem(txtDeviceAdd, sql_Device, "device_name", "device_id");
                txtDeviceAdd.Items.Insert(0, new ListItem("", ""));
                txtSTime.Text = DateTime.Now.ToString("HH.mm");
                BindData("");

                if (Request["ref"] != null)
                {
                    txtRef.Value = Request["ref"].ToString();
                    sql          = "SELECT * FROM tbl_cm_detail WHERE cm_detail_id = '" + txtRef.Value + "'";
                    MySqlDataReader rs = function.MySqlSelect(sql);
                    if (rs.Read())
                    {
                        txtCpoint.SelectedValue    = rs.GetString("cm_cpoint");
                        txtPoint.Text              = rs.GetString("cm_point");
                        txtChannel.Text            = rs.GetString("cm_detail_channel");
                        txtSDate.Text              = rs.GetString("cm_detail_sdate");
                        txtSTime.Text              = rs.GetString("cm_detail_stime");
                        txtDeviceAdd.SelectedValue = rs.GetString("cm_detail_driver_id");
                        txtProblem.Text            = rs.GetString("cm_detail_problem");
                        txtNote.Text = rs.GetString("cm_detail_note");
                    }
                    rs.Close();
                    function.Close();

                    btnSaveCM.Visible   = false;
                    btnEditCM.Visible   = true;
                    btnCancelCM.Visible = true;

                    if (function.CheckLevel("Techno", Session["UserPrivilegeId"].ToString()))
                    {
                        btnDeleteCM.Visible = true;
                    }
                    else
                    {
                        btnDeleteCM.Visible = false;
                    }
                }
                else
                {
                    btnSaveCM.Visible   = true;
                    btnEditCM.Visible   = false;
                    btnCancelCM.Visible = false;
                    btnDeleteCM.Visible = false;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                if (Session["UserCpoint"].ToString() != "0")
                {
                    Response.Redirect("/Claim/claimForm");
                }

                if (!this.IsPostBack)
                {
                    if (txtDateOrder.Text == "")
                    {
                        txtDateOrder.Text = DateTime.Now.ToString("dd-MM-") + (DateTime.Now.Year + 543);
                    }
                    if (txtDateSendOrder.Text == "")
                    {
                        txtDateSendOrder.Text = DateTime.Now.ToString("dd-MM-") + (DateTime.Now.Year + 543);
                        txtDateSendOrder_TextChanged(null, null);
                    }
                    PageLoadData();
                    string sql = "SELECT * FROM tbl_company ORDER BY company_name";
                    function.getListItem(txtCompany, sql, "company_name", "company_id");
                    //lbTitle.Text = Session["codePK"].ToString();
                    sql = "SELECT * FROM tbl_quotations q JOIN tbl_company c ON q.quotations_company_id = c.company_id WHERE q.quotations_claim_id = '" + Session["codePK"].ToString() + "' AND quotations_delete = '0'";
                    function.getListItem(txtCompanyOrder, sql, "company_name", "company_id");
                }

                if (int.Parse(Session["status_id"].ToString()) >= 3)
                {
                    if (int.Parse(Session["status_id"].ToString()) != 3)
                    {
                        btnSaveNoteTo.Visible = false;
                    }

                    string[] readText = File.ReadAllLines(HostingEnvironment.MapPath("/Config/") + "ListDocTechno.txt");
                    int      num      = 1;
                    foreach (string s in readText)
                    {
                        if (num != 7)
                        {
                            AddControls(num, num + ". " + s + " จำนวน", Panel1);
                        }
                        else
                        {
                            AddControls(num, num + ". " + s + " " + function.GetSelectValue("tbl_claim_com", "claim_id='" + Session["codePK"].ToString() + "'", "claim_detail_insurer") + " จำนวน", Panel1);
                        }
                        num++;
                    }

                    string          sql_doc = "SELECT * FROM tbl_quotations q JOIN tbl_company c ON c.company_id = q.quotations_company_id WHERE q.quotations_claim_id = '" + Session["codePK"].ToString() + "'";
                    MySqlDataReader rs      = function.MySqlSelect(sql_doc);
                    while (rs.Read())
                    {
                        AddControls(num, num + ". ใบประเมินราคาค่าเสียหาย ของ " + rs.GetString("company_name") + " จำนวน", Panel1);
                        num++;
                    }
                    rs.Close();
                    function.Close();
                    if (!this.IsPostBack)
                    {
                        getDataStatus3();
                    }
                }

                if (int.Parse(Session["status_id"].ToString()) >= 4)
                {
                    getDataStatus4();
                }

                if (int.Parse(Session["status_id"].ToString()) >= 5)
                {
                    getDataStatus5();
                }
            }
        }
Пример #6
0
        protected void ClaimGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            LinkButton lbCpoint = (LinkButton)(e.Row.FindControl("lbCpoint"));

            if (lbCpoint != null)
            {
                lbCpoint.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
            }

            LinkButton lbNoteCom = (LinkButton)(e.Row.FindControl("lbNoteCom"));

            if (lbNoteCom != null)
            {
                lbNoteCom.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
            }


            LinkButton lbEquipment = (LinkButton)(e.Row.FindControl("lbEquipment"));

            if (lbEquipment != null)
            {
                lbEquipment.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
                lbEquipment.ToolTip     = (string)DataBinder.Eval(e.Row.DataItem, "claim_equipment");;
            }


            Label lbCpointDate = (Label)(e.Row.FindControl("lbCpointDate"));

            if (lbCpointDate != null)
            {
                lbCpointDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "claim_cpoint_date"));
            }

            Label lbStartDate = (Label)(e.Row.FindControl("lbStartDate"));

            if (lbStartDate != null)
            {
                lbStartDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "claim_start_date"));
            }

            Label lbDay = (Label)(e.Row.FindControl("lbDay"));

            if (lbDay != null)
            {
                string[]       data      = DataBinder.Eval(e.Row.DataItem, "claim_start_date").ToString().Split('-');
                DateTime       dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                DateDifference differnce = new DateDifference(dateStart);

                if (differnce.ToString() == "")
                {
                    lbDay.CssClass = "badge badge-danger";
                    lbDay.Text     = "NEW!!";
                }
                else
                {
                    lbDay.Text = differnce.ToString();
                }
            }

            Label lbStatus = (Label)(e.Row.FindControl("lbStatus"));

            if (lbStatus != null)
            {
                lbStatus.CssClass = "badge badge-" + (string)DataBinder.Eval(e.Row.DataItem, "status_alert");
            }

            LinkButton printReport1 = (LinkButton)(e.Row.FindControl("printReport1"));

            if (printReport1 != null)
            {
                printReport1.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
                //printReport1.OnClientClick = "document.forms[0].target ='_blank';";
                //printReport1.t
            }

            LinkButton printReport2 = (LinkButton)(e.Row.FindControl("printReport2"));

            if (printReport2 != null)
            {
                printReport2.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
                //printReport1.t
            }

            //*** Edit ***'
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DropDownList txtStatusEdit = (DropDownList)e.Row.FindControl("txtStatusEdit");
                if ((txtStatusEdit != null))
                {
                    string sql_status = "SELECT * FROM tbl_status";
                    function.getListItem(txtStatusEdit, sql_status, "status_name", "status_id");
                    txtStatusEdit.SelectedIndex = txtStatusEdit.Items.IndexOf(txtStatusEdit.Items.FindByValue((string)DataBinder.Eval(e.Row.DataItem, "status_id").ToString()));
                }
            }
        }