private void BindDDL()
    {
        SystemFunction.ListYearsDESC(ddlYear, "", "en-US", "th-TH", short.Parse(System.Configuration.ConfigurationSettings.AppSettings["startYear"].ToString()));
        SystemFunction.BindDropdownPageSize(ddlPageSize, null);

        ddlGroupIndicator.DataSource     = db.mTIndicator.OrderBy(o => o.nOrder).ToList();
        ddlGroupIndicator.DataValueField = "ID";
        ddlGroupIndicator.DataTextField  = "Indicator";
        ddlGroupIndicator.DataBind();
        ddlGroupIndicator.Items.Insert(0, new ListItem("- Select Indicator -", ""));

        int[] arrWFStatus = new int[] { 28, 29, 30, 32, 33, 34 };
        ddlStatus.DataSource     = db.TStatus_Workflow.Where(w => arrWFStatus.Contains(w.nStatustID) && w.cTypeUse == "TNF" && w.cActive == "Y").OrderBy(o => o.sShorttStatus).ToList();
        ddlStatus.DataValueField = "nStatustID";
        ddlStatus.DataTextField  = "sShorttStatus";
        ddlStatus.DataBind();
        ddlStatus.Items.Insert(0, new ListItem("- Select Status -", ""));
        ddlStatus.Items.Insert(1, new ListItem("Waiting Transfer", "0"));

        ddlFacility.DataSource = (from fptt in db.mTFacility.Where(w => w.cDel == "N" && w.cActive == "Y" && w.nLevel == 0 && w.CompanyID == 1)
                                  from fgc in db.mTFacility.Where(w => w.cDel == "N" && w.cActive == "Y" && w.nHeaderID == fptt.ID)
                                  select new
        {
            fgc.ID,
            fgc.Name
        }).OrderBy(o => o.Name).ToList();
        ddlFacility.DataTextField  = "Name";
        ddlFacility.DataValueField = "ID";
        ddlFacility.DataBind();
        ddlFacility.Items.Insert(0, new ListItem("- Select Facility -", ""));
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string sIN = Request.QueryString["in"] + "";
        string sOT = Request.QueryString["ot"] + "";

        if (!string.IsNullOrEmpty(sIN))
        {
            hdfsIndicator.Value = STCrypt.Decrypt(sIN);
        }
        if (!string.IsNullOrEmpty(sOT))
        {
            hdfsOperationType.Value = STCrypt.Decrypt(sOT);
        }
        SystemFunction.ListYearsDESC(ddlYear, "-select-", "en-US", "th-TH", short.Parse(ConfigurationSettings.AppSettings["startYear"].ToString()));
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sIN    = Request.QueryString["in"] + "";     // Indicator;
            string sOT    = Request.QueryString["ot"] + "";     // OperationType;
            string year   = Request.QueryString["year"] + "";   // Year ;
            string fac    = Request.QueryString["fac"] + "";    // Facility;
            string status = Request.QueryString["status"] + ""; //Status Approve with edit content
            if (!string.IsNullOrEmpty(sIN))
            {
                hdfsIndicator.Value = STCrypt.Decrypt(sIN);
            }
            if (!string.IsNullOrEmpty(sOT))
            {
                hdfsOperationType.Value = STCrypt.Decrypt(sOT);
            }
            if (!string.IsNullOrEmpty(fac))
            {
                hdfsFacility.Value = STCrypt.Decrypt(fac);
            }
            if (!string.IsNullOrEmpty(year))
            {
                hdfsYear.Value = STCrypt.Decrypt(year);
            }
            if (!string.IsNullOrEmpty(status))
            {
                hdfsStatus.Value = STCrypt.Decrypt(status);
            }
            if (!UserAcc.UserExpired())
            {
                hdfIsAdmin.Value = SystemFunction.IsSuperAdmin() == true ? "Y" : "N";
            }

            SystemFunction.ListYearsDESC(ddlYear, "-select-", "en-US", "th-TH", short.Parse(ConfigurationSettings.AppSettings["startYear"].ToString()));
        }
    }
    public void BindDDL()
    {
        SystemFunction.ListYearsDESC(ddlYear, "", "en-US", "th-TH", short.Parse(System.Configuration.ConfigurationSettings.AppSettings["startYear"].ToString()));

        int[]  arrStatusID = new int[] { };
        string sqlFac      = "";

        int nRole   = UserAcc.GetObjUser().nRoleID;
        int nUserID = UserAcc.GetObjUser().nUserID;

        if (nRole == 3) // L1
        {
            arrStatusID = new int[] { 1 };
            sqlFac      = @"SELECT B.ID 'nFacID',B.Name 'sFacName'
                        FROM mTWorkFlow A
                        INNER JOIN mTfacility B ON A.IDFac=B.ID
                        WHERE A.L1=" + nUserID + @"
                        AND B.cDel='N' AND B.cActive='Y' AND B.nLevel=2
                        GROUP BY B.ID,B.Name
                        ORDER BY B.Name";
        }
        else if (nRole == 4)                  // L2
        {
            arrStatusID = new int[] { 4, 2 }; //5, 9
            sqlFac      = @"SELECT B.ID 'nFacID',B.Name 'sFacName'
                        FROM mTWorkFlow A
                        INNER JOIN mTfacility B ON A.IDFac=B.ID
                        WHERE A.L2=" + nUserID + @"
                        AND B.cDel='N' AND B.cActive='Y' AND B.nLevel=2
                        GROUP BY B.ID,B.Name
                        ORDER BY B.Name";
        }
        else if (nRole == 2)                             // L0
        {
            arrStatusID = new int[] { 0, 8, 9, 24, 18 }; //0, 8, 9, 24, 18
            sqlFac      = @"SELECT B.ID 'nFacID',B.Name 'sFacName'
                        FROM mTUser_FacilityPermission A
                        INNER JOIN mTfacility B ON A.nFacilityID=B.ID
                        WHERE A.nUserID=" + nUserID + @"AND A.nRoleID=2 AND A.nPermission IN (2)
                        AND B.cDel='N' AND B.cActive='Y' AND B.nLevel=2
                        GROUP BY B.ID,B.Name
                        ORDER BY B.Name";
        }


        ddlGroupIndicator.DataSource     = db.mTIndicator.OrderBy(o => o.nOrder).ToList();
        ddlGroupIndicator.DataValueField = "ID";
        ddlGroupIndicator.DataTextField  = "Indicator";
        ddlGroupIndicator.DataBind();
        ddlGroupIndicator.Items.Insert(0, new ListItem("- Select Indicator -", ""));

        ddlStatus.DataSource     = db.TStatus_Workflow.Where(w => arrStatusID.Contains(w.nStatustID)).OrderBy(o => o.sStatusName).ToList();
        ddlStatus.DataValueField = "nStatustID";
        ddlStatus.DataTextField  = "sStatusName";
        ddlStatus.DataBind();
        ddlStatus.Items.Insert(0, new ListItem("- Select Status -", ""));

        if (nRole == 2)
        {
            ddlStatus.Items.Insert(1, new ListItem("No Action", "-1"));
        }


        SystemFunction.ListDBToDropDownList(ddlFacility, sqlFac, "- Select Sub-facility -", "nFacID", "sFacName");
    }