コード例 #1
0
    private static DataTable GetLookUp(string LookUpCode, ref string SPName)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;
        DataTable  _dt  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]    = "";
            _ht["p_lookup_code"] = LookUpCode;

            _dt = _dal.GetRows("MASTER_LOOKUP_COLUMN", _ht);

            if (_dt != null && _dt.Rows.Count > 0)
            {
                SPName = _dt.Rows[0]["SP_NAME"].ToString();
            }
            else
            {
                throw new Exception("Fail to execute MASTER_LOOKUP_COLUMN");
            }

            return(_dt);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
コード例 #2
0
    private void BindData()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        DataTable _dt = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]   = "";
            _ht["p_emp_code"]   = Request.Params["emp_code"];
            _ht["p_start_date"] = Shared.ConvertToDateTime(txtStartDate.Text);
            _ht["p_end_date"]   = Shared.ConvertToDateTime(txtEndDate.Text);

            _dt = _dal.GetRows("", "xsp_employee_geotag_log_getrows_sort_by_date", _ht);

            rptMarkers.DataSource = _dt;
            rptMarkers.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #3
0
    public static void BindSubscription(string SubscribeCode, ref string TableSource, ref string TableTarget, ref string SPSaveName,
                                        ref string SPSourceToTarget, ref string SPTargetToSource, ref string SPParameterCode, ref string SPParameterUserCode)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;
        DataTable  _dt  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]       = string.Empty;
            _ht["p_subscribe_code"] = SubscribeCode;

            _dt = _dal.GetRows("MASTER_SUBSCRIPTION", _ht);

            if (_dt.Rows.Count > 0)
            {
                TableSource         = _dt.Rows[0]["SP_TABLE_SOURCE"].ToString();
                TableTarget         = _dt.Rows[0]["SP_TABLE_TARGET"].ToString();
                SPSaveName          = _dt.Rows[0]["SP_SAVE_NAME"].ToString();
                SPSourceToTarget    = _dt.Rows[0]["SP_SOURCE_TO_TARGET"].ToString();
                SPTargetToSource    = _dt.Rows[0]["SP_TARGET_TO_SOURCE"].ToString();
                SPParameterCode     = _dt.Rows[0]["SP_PARAMETER_CODE"].ToString();
                SPParameterUserCode = _dt.Rows[0]["SP_PARAMETER_USER_CODE"].ToString();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #4
0
ファイル: badanusahalist.aspx.cs プロジェクト: bpfi/SLIK-BPFI
    private void BindData(string filter)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            if (ddlBulan.SelectedItem.Value != "0" && ddlTahun.SelectedItem.Value != "0")
            {
                _ht["p_mount"] = ddlBulan.SelectedItem.Value;
                _ht["p_year"]  = ddlTahun.SelectedItem.Value;
            }
            else
            {
                _ht["p_mount"] = "";
                _ht["p_year"]  = "";
            }

            _ht["p_keywords"] = txtSearch.Text;
            _ht["p_status"]   = ddlStatus.SelectedItem.Value;
            _ht["p_filter"]   = filter;

            gvwList.DataSource = _dal.GetRows(TABLE_NAME, _ht);
            gvwList.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #5
0
    private void BindingCollection()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        //System.Diagnostics.Debugger.Break();
        if (Status == "New")
        {
            Collector = "All";
        }

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = Collector;
            // _ht["p_collector_code"] = Collector;

            gvwList.DataSource = _dal.GetRows("", "xsp_collection_main_quickview", _ht);
            gvwList.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
        finally
        {
            Status = "New";
        }
    }
コード例 #6
0
    private void BindLocationUserList()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = txtSearch.Text;
            _ht["p_position"] = FILTER_POSITION;

            _dt = _dal.GetRows("", "xsp_master_user_main_getrows_position", _ht);

            gvwList.DataSource = _dt;
            gvwList.DataBind();

            //gvwListLocationUser.DataSource = _dal.GetRows(TABLE_NAME, _ht);
            //gvwListLocationUser.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #7
0
ファイル: badanusahalist.aspx.cs プロジェクト: bpfi/SLIK-BPFI
    protected void btnExport_Click(object sender, EventArgs e)
    {
        if (ddlStatus.SelectedItem.Value == "Select Value" || ddlBulan.SelectedItem.Value == "0" || ddlTahun.SelectedItem.Value == "0")
        {
            Shared.ShowErrorMessage(this, "Bulan, Status dan tahun tidak boleh null");
            return;
        }

        DataTable  _dt   = null;
        GeneralDAL _dal  = null;
        Hashtable  _ht   = null;
        DataTable  _dtH  = null;
        GeneralDAL _dalH = null;
        Hashtable  _htH  = null;

        try
        {
            _ht   = new Hashtable();
            _dal  = new GeneralDAL();
            _dt   = new DataTable();
            _htH  = new Hashtable();
            _dalH = new GeneralDAL();
            _dtH  = new DataTable();

            _ht["p_mount"]    = ddlBulan.SelectedItem.Value;
            _ht["p_year"]     = ddlTahun.SelectedItem.Value;
            _ht["p_keywords"] = txtSearch.Text;
            _ht["p_status"]   = ddlStatus.SelectedItem.Value;
            _ht["p_filter"]   = "";

            _dt = _dal.GetRows(TABLE_NAME, _ht);

            _htH["p_code_segmen"] = SEGMENT;
            _dtH = _dalH.GetRows(TABLE_NAME_HEADER, _htH);

            List <Headers> header = new List <Headers>();
            header = cv.ConvertDataTable <Headers>(_dtH);

            List <EntityD02> list = new List <EntityD02>();
            list = cv.ConvertDataTable <EntityD02>(_dt);

            bool isCreate = dc.ValidateD02(list, header);

            if (isCreate)
            {
                Shared.ShowSuccessGritter(this, "badanusahalist.aspx");
            }
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #8
0
    private void BindDataGroup()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]  = txtSearch.Text;
            gvwList.DataSource = _dal.GetRows(TABLE_NAME, _ht);
            gvwList.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #9
0
    private static DataTable ExecRawSP(string SPName)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;


        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();
            _ht["p_keywords"] = "";

            return(_dal.GetRows("", SPName, _ht));
        }
        catch (Exception ex)
        {
            return(null);;
        }
    }
コード例 #10
0
    private void BindQuestion()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]      = txtQuestionSearch.Text;
            _ht["p_trx_no"]        = lblTrxNo.Text;
            gvwQuestion.DataSource = _dal.GetRows(TABLE_NAME_QUESTION, _ht);
            gvwQuestion.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #11
0
ファイル: masterusermain.aspx.cs プロジェクト: bpfi/SLIK-BPFI
    private void BindUserLogin()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]           = txtSearchUserLogin.Text;
            _ht["p_uid"]                = lblId.Text;
            gvwListUserLogin.DataSource = _dal.GetRows(TABLE_NAME_B, _ht);
            gvwListUserLogin.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #12
0
    private void BindSurveyPhoto()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]             = txtSearchSurveyPhoto.Text;
            _ht["p_trx_no"]               = lblTrxNo.Text;
            gvwListSurveyPhoto.DataSource = _dal.GetRows(TABLE_NAME_SURVEY, _ht);
            gvwListSurveyPhoto.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #13
0
    private void BindSubCode()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]         = txtSearchSubCode.Text;
            _ht["p_general_code"]     = txtCode.Text;
            gvwListSubCode.DataSource = _dal.GetRows(TABLE_NAME_DETAIL, _ht);
            gvwListSubCode.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #14
0
    private void BindDataEmployeeGeotag()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]        = txtSearchGeotag.Text;
            _ht["p_emp_code"]        = lblEmployeeCode.Text;
            gvwListGeotag.DataSource = _dal.GetRows(TABLE_NAME_B, _ht);
            gvwListGeotag.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #15
0
ファイル: masterusermain.aspx.cs プロジェクト: bpfi/SLIK-BPFI
    private void BindUserActivity()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]          = txtActivitySearch.Text;
            _ht["p_uid"]               = lblId.Text;
            gvwUserActivity.DataSource = _dal.GetRows("MASTER_USER_ACTIVITY_LOG", _ht);
            gvwUserActivity.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #16
0
    private void BindDataQuickView()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        //System.Diagnostics.Debugger.Break();
        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            if (Status == "New")
            {
                Collector = "All";
            }

            _ht["p_keywords"] = Collector;

            DataTable dtQuickView = _dal.GetRows("", "xsp_collection_main_quickview", _ht);

            double CountA = 0, CountB = 0, Total = 0;

            foreach (DataRow drItem in dtQuickView.Rows)
            {
                CountA = CountA + Convert.ToDouble(drItem["total_collection"].ToString());
                CountB = CountB + Convert.ToDouble(TotalAmount = drItem["payment_amount"].ToString());

                Total = CountA - CountB;
            }

            TotalCollection = "Rp. " + CountA.ToString("n0") + ".00";
            TotalAmount     = "Rp. " + CountB.ToString("n0") + ".00";
            RestOfTheBill   = "Rp. " + Total.ToString("n0") + ".00";

            BindingCollection();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #17
0
    private void BindDataTarget()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = txtSearchTarget.Text;
            _ht["p_emp_code"] = Request.Params["empcode"];

            gvwListTarget.DataSource = _dal.GetRows("", SP_TABLE_TARGET, _ht);
            gvwListTarget.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #18
0
    private void BindGroupRole()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]   = txtSearch.Text;
            _ht["p_group_code"] = Request.Params["code"];

            gvwListGroupRole.DataSource = _dal.GetRows(TABLE_NAME_DETAIL, _ht);
            gvwListGroupRole.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #19
0
    public static void BindSurveyMain(DropDownList ddl)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = "";

            ddl.DataSource     = _dal.GetRows("SURVEY_MAIN", _ht);
            ddl.DataTextField  = "TRX_NO";
            ddl.DataValueField = "TRX_NO";
            ddl.DataBind();
        }
        catch (Exception ex)
        {
        }
    }
コード例 #20
0
    public static void BindEmployee(DropDownList ddl)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = "";

            ddl.DataSource     = _dal.GetRows("EMPLOYEE_MAIN", _ht);
            ddl.DataTextField  = "EMP_NAME";
            ddl.DataValueField = "EMP_CODE";
            ddl.DataBind();
        }
        catch (Exception ex)
        {
        }
    }
コード例 #21
0
    public static void BindingQuickView(DropDownList ddl)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = "";

            ddl.DataSource     = _dal.GetRows("", "xsp_collection_main_quickview", _ht); //_dal.GetRows("COLLECTION_MAIN", _ht);
            ddl.DataTextField  = "collector";
            ddl.DataValueField = "collector_code";
            ddl.DataBind();
        }
        catch (Exception ex)
        {
        }
    }
コード例 #22
0
    private void BindData()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = "";
            _ht["p_position"] = ddlPosition.SelectedValue;

            rptMarkers.DataSource = _dal.GetRows("", "xsp_employee_geotag_log_getrows_by_position", _ht);
            rptMarkers.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #23
0
    public static void BindDevice(DropDownList ddl)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = "";

            ddl.DataSource     = _dal.GetRows("MASTER_MEREK", _ht);
            ddl.DataTextField  = "DESCRIPTION";
            ddl.DataValueField = "CODE";
            ddl.DataBind();
        }
        catch (Exception ex)
        {
        }
    }
コード例 #24
0
    private void BindDataSource()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = txtSearchSource.Text;
            // System.Diagnostics.Debugger.Break();
            for (int i = 0; i < Request.Params.Count; i++)
            {
                if (Request.Params.AllKeys[i] != null)
                {
                    if (Request.Params.AllKeys[i].StartsWith("par_"))
                    {
                        string par = Request.Params.AllKeys[i].Substring(4);

                        _ht["p_" + par] = Request.Params[i];
                    }
                    else if (Request.Params.AllKeys[i].StartsWith("parc_"))
                    {
                        string par = Request.Params.AllKeys[i].Substring(5);

                        _ht["p_" + par] = Request.Params[i];
                    }
                }
            }

            gvwListSource.DataSource = _dal.GetRows("", SP_TABLE_SOURCE, _ht);
            gvwListSource.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #25
0
    private void BindDataColletion()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]       = "";
            _ht["p_console_status"] = "ALL";
            _ht["p_result_status"]  = "ALL";

            gvwList.DataSource = _dal.GetRows(TABLE_NAME, _ht);
            gvwList.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #26
0
    public static void BindGeneralSubCode(DropDownList ddl, string GeneralCode)
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]     = "";
            _ht["p_general_code"] = GeneralCode;

            ddl.DataSource     = _dal.GetRows("MASTER_GENERAL_SUBCODE", _ht);
            ddl.DataTextField  = "DESCRIPTION";
            ddl.DataValueField = "CODE";
            ddl.DataBind();
        }
        catch (Exception ex)
        {
        }
    }
コード例 #27
0
    private void BindData()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_id"] = Request.Params["result_id"];

            _dt = _dal.GetRows("", "xsp_collection_results_getrow_attachment", _ht);

            attachment.DataSource = _dt;
            attachment.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #28
0
    private void BindApplicationDocument()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"] = txtSearch.Text;

            _ht["p_id"]             = Request.Params["id"];
            _ht["p_application_no"] = Request.Params["app_no"];

            gvwListApplicationDocument.DataSource = _dal.GetRows(TABLE_NAME_DOCUMENT, _ht);
            gvwListApplicationDocument.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #29
0
    private void BindDataColletion()
    {
        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        FILTER_STATUS = Request.Params["param"].ToString();
        if (FILTER_STATUS == "All" || FILTER_STATUS == "1")
        {
            lblFilterConsole.Visible = false;
            ddlFilterStatus.Visible  = false;
        }
        else if (FILTER_STATUS == "2" || FILTER_STATUS == "3" || FILTER_STATUS == "4")
        {
            lblFilterConsole.Visible = false;
            ddlFilterStatus.Visible  = false;

            lblFilterResult.Visible = true;
            dllFilterResult.Visible = true;
        }

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_keywords"]       = txtSearch.Text;
            _ht["p_console_status"] = FILTER_STATUS;
            _ht["p_result_status"]  = FILTER_RESULT;

            gvwList.DataSource = _dal.GetRows(TABLE_NAME, _ht);
            gvwList.DataBind();
        }
        catch (Exception ex)
        {
            Shared.ShowErrorDialog(this, ex);
        }
    }
コード例 #30
0
ファイル: Default.aspx.cs プロジェクト: bpfi/SLIK-BPFI
    //protected void Page_Load(object sender, EventArgs e)
    //{
    //    dataBranch();
    //    //LoadInit();
    //    if (!Page.IsPostBack)
    //    {
    //        //if (Request.Params["action"].Equals("edit"))
    //       // {
    //            //LoadData();
    //           // btnCancel.Text = "<i class='icon-remove'></i>Back";
    //        //}
    //    }
    //}

    //private void dataBranch()
    //{
    //    try
    //    {
    //        string constr = ConfigurationManager.ConnectionStrings["Test1"].ToString(); // connection string
    //        SqlConnection con = new SqlConnection(constr);
    //        con.Open();

    //        SqlCommand com = new SqlCommand("select * from Branch", con); // table name
    //        SqlDataAdapter da = new SqlDataAdapter(com);
    //        DataSet ds = new DataSet();
    //        da.Fill(ds);  // fill dataset
    //        txtBRANCH.DataTextField = ds.Tables[0].Columns["BranchFullName"].ToString(); // text field name of table dispalyed in dropdown
    //        txtBRANCH.DataValueField = ds.Tables[0].Columns["BranchID"].ToString();             // to retrive specific  textfield name
    //        txtBRANCH.DataSource = ds.Tables[0];      //assigning datasource to the dropdownlist
    //        txtBRANCH.DataBind();  //binding
    //        con.Close();
    //    }
    //    catch (Exception err)
    //    {

    //    }
    //}
    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        //HttpCookie cookie = new HttpCookie("CurrentLanguage");
        //cookie.Value = ddlLanguage.SelectedValue;
        //Response.SetCookie(cookie);



        /*
         * validate user
         * if row > 0, maka ambil role user tersebut
         * redirect ke main.aspx
         * jika tidak, show error
         */

        GeneralDAL _dal = null;
        Hashtable  _ht  = null;

        bool IsValidUser     = true;
        bool IsValidPassword = true;
        bool IsActiveUser    = true;

        string UID = "";

        try
        {
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_uid"]      = txtUID.Text;
            _ht["p_password"] = txtPassword.Text;

            DataRow dr = _dal.GetRow("", "xsp_master_user_main_validate", _ht);

            //dr null jika tidak ada record, langsung lari ke catch
            if (dr != null)
            {
                UID = dr["ID"].ToString();

                if (dr["UPASS"].ToString().Equals(dr["UPASSMD5"].ToString()))
                {
                    //Masukan Role disini
                    //if (dr["p_uid"].ToString() == "ADM000")
                    //{
                    //    Response.Redirect("/module/finance/agunan.aspx");
                    //}

                    if (((int)dr["LAST_FAIL_COUNT"]) >= 5)
                    {
                        IsValidPassword = false;
                    }
                    else
                    {
                        if (dr["IS_ACTIVE"].ToString().Equals("1"))    //artinya user aktif
                        {
                            //reset fail count
                            _ht["p_uid"] = UID;
                            _dal.Update("", "xsp_master_user_main_reset_fail_count", _ht);

                            //update last login
                            _ht["p_uid"]        = UID;
                            _ht["p_login_date"] = DateTime.Now;
                            _dal.Update("", "xsp_master_user_main_update_last_login", _ht);

                            //save user profile ke session
                            Session[SessionKey.CURRENT_USER_SESSION_KEY] = dr;

                            //save user role ke session
                            Session[SessionKey.CURRENT_USER_ROLE_SESSION_KEY] = _dal.GetRows("", "xsp_master_user_main_getroles", _ht);

                            //save user ip address
                            if (Request.ServerVariables["HTTP_X_FORWARDED_FOR"] == null)
                            {
                                Session[SessionKey.CURRENT_USER_IP_ADDRESS_SESSION_KEY] = Request.ServerVariables["REMOTE_ADDR"];
                            }
                            else
                            {
                                Session[SessionKey.CURRENT_USER_IP_ADDRESS_SESSION_KEY] = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                            }

                            //insert master user login log
                            _ht["p_uid"]        = UID;
                            _ht["p_ip_address"] = Shared.CurrentIPAddress;
                            _ht["p_flag_code"]  = "SUCCESS";
                            Shared.ApplyDefaultProp(_ht);
                            _dal.Insert("", "xsp_master_user_login_log_insert", _ht);

                            if (((DateTime)dr["NEXT_CHANGE_PASS"]) <= DateTime.Now)
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "fx", "fnShowModalChangePassword();", true);;
                            }
                            else
                            {
                                //redirect ke halaman main
                                //Response.Redirect("main.aspx");
                                //Masukan Role disini
                                if (dr["ID"].ToString() == "ADM000")
                                {
                                    Response.Redirect("branch/main_000.aspx");
                                }
                                else if (dr["ID"].ToString() == "1000000003")
                                {
                                    Response.Redirect("main.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM001")
                                {
                                    Response.Redirect("branch/main_001.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM002")
                                {
                                    Response.Redirect("branch/main_002.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM004")
                                {
                                    Response.Redirect("branch/main_004.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM005")
                                {
                                    Response.Redirect("branch/main_005.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM006")
                                {
                                    Response.Redirect("branch/main_006.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM007")
                                {
                                    Response.Redirect("branch/main_007.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM008")
                                {
                                    Response.Redirect("branch/main_008.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM009")
                                {
                                    Response.Redirect("branch/main_009.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM010")
                                {
                                    Response.Redirect("branch/main_010.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM011")
                                {
                                    Response.Redirect("branch/main_011.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM012")
                                {
                                    Response.Redirect("branch/main_012.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM013")
                                {
                                    Response.Redirect("branch/main_013.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM014")
                                {
                                    Response.Redirect("branch/main_014.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM015")
                                {
                                    Response.Redirect("branch/main_015.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM016")
                                {
                                    Response.Redirect("branch/main_016.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM017")
                                {
                                    Response.Redirect("branch/main_017.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM018")
                                {
                                    Response.Redirect("branch/main_018.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM019")
                                {
                                    Response.Redirect("branch/main_019.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM020")
                                {
                                    Response.Redirect("branch/main_020.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM021")
                                {
                                    Response.Redirect("branch/main_021.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM022")
                                {
                                    Response.Redirect("branch/main_022.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM023")
                                {
                                    Response.Redirect("branch/main_023.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM024")
                                {
                                    Response.Redirect("branch/main_024.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM025")
                                {
                                    Response.Redirect("branch/main_025.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM026")
                                {
                                    Response.Redirect("branch/main_026.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM027")
                                {
                                    Response.Redirect("branch/main_027.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM028")
                                {
                                    Response.Redirect("branch/main_028.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM029")
                                {
                                    Response.Redirect("branch/main_029.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM030")
                                {
                                    Response.Redirect("branch/main_030.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM031")
                                {
                                    Response.Redirect("branch/main_031.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM032")
                                {
                                    Response.Redirect("branch/main_032.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM033")
                                {
                                    Response.Redirect("branch/main_033.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM034")
                                {
                                    Response.Redirect("branch/main_034.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM035")
                                {
                                    Response.Redirect("branch/main_035.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM036")
                                {
                                    Response.Redirect("branch/main_036.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM037")
                                {
                                    Response.Redirect("branch/main_037.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM038")
                                {
                                    Response.Redirect("branch/main_038.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM039")
                                {
                                    Response.Redirect("branch/main_039.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM040")
                                {
                                    Response.Redirect("branch/main_040.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM041")
                                {
                                    Response.Redirect("branch/main_041.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM042")
                                {
                                    Response.Redirect("branch/main_042.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM043")
                                {
                                    Response.Redirect("branch/main_043.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM044")
                                {
                                    Response.Redirect("branch/main_044.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM045")
                                {
                                    Response.Redirect("branch/main_045.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM046")
                                {
                                    Response.Redirect("branch/main_046.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM047")
                                {
                                    Response.Redirect("branch/main_047.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM048")
                                {
                                    Response.Redirect("branch/main_048.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM049")
                                {
                                    Response.Redirect("branch/main_049.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM050")
                                {
                                    Response.Redirect("branch/main_050.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM051")
                                {
                                    Response.Redirect("branch/main_051.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM052")
                                {
                                    Response.Redirect("branch/main_052.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM053")
                                {
                                    Response.Redirect("branch/main_053.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM054")
                                {
                                    Response.Redirect("branch/main_054.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM055")
                                {
                                    Response.Redirect("branch/main_055.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM056")
                                {
                                    Response.Redirect("branch/main_056.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM057")
                                {
                                    Response.Redirect("branch/main_057.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM058")
                                {
                                    Response.Redirect("branch/main_058.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM059")
                                {
                                    Response.Redirect("branch/main_059.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM060")
                                {
                                    Response.Redirect("branch/main_060.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM061")
                                {
                                    Response.Redirect("branch/main_061.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM062")
                                {
                                    Response.Redirect("branch/main_062.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM063")
                                {
                                    Response.Redirect("branch/main_063.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM064")
                                {
                                    Response.Redirect("branch/main_064.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM065")
                                {
                                    Response.Redirect("branch/main_065.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM066")
                                {
                                    Response.Redirect("branch/main_066.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM067")
                                {
                                    Response.Redirect("branch/main_067.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM068")
                                {
                                    Response.Redirect("branch/main_068.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM069")
                                {
                                    Response.Redirect("branch/main_069.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM070")
                                {
                                    Response.Redirect("branch/main_070.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM071")
                                {
                                    Response.Redirect("branch/main_071.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM072")
                                {
                                    Response.Redirect("branch/main_072.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM073")
                                {
                                    Response.Redirect("branch/main_073.aspx");
                                }
                                else if (dr["ID"].ToString() == "ADM0900")
                                {
                                    Response.Redirect("branch/main_0900.aspx");
                                }
                            }
                        }
                        else
                        {
                            IsActiveUser = false;
                        }
                    }
                }
                else
                {
                    IsValidPassword = false;
                }
            }
            else
            {
                IsValidUser = false;
            }
        }
        catch
        {
            IsValidUser = false;
        }


        if (!IsActiveUser)
        {
            //show ke user message box, jika user dia tidak aktif
            ScriptManager.RegisterStartupScript(this, GetType(), "fx", "fnShowErrorNotif('User not active. Please contact your MIS/IT Department.', '');", true);
        }
        else if (!IsValidPassword)
        {
            //cek last fail count untuk uid yang login
            _dal = new GeneralDAL();
            _ht  = new Hashtable();

            _ht["p_id"] = UID;

            DataRow dr = _dal.GetRow("", "xsp_master_user_main_getrow", _ht);


            _ht["p_login_date"]     = DateTime.Now;
            _ht["p_cre_date"]       = DateTime.Now;
            _ht["p_cre_by"]         = txtUID.Text;
            _ht["p_cre_ip_address"] = "127.0.0.1";

            if (Request.ServerVariables["HTTP_X_FORWARDED_FOR"] == null)
            {
                _ht["p_ip_address"] = Request.ServerVariables["REMOTE_ADDR"];
            }
            else
            {
                _ht["p_ip_address"] = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            }


            if (((int)dr["LAST_FAIL_COUNT"]) >= 5)
            {
                _ht["p_flag_code"] = "FAIL MAX ATTEMPT";
                _ht["p_uid"]       = UID;

                //insert master user login log
                _dal.Insert("", "xsp_master_user_login_log_insert", _ht);

                //show warning max login attempt reached
                ScriptManager.RegisterStartupScript(this, GetType(), "fx", "fnShowErrorNotif('Maximum try login reached. Please contact your MIS/IT Department.', '');", true);
            }
            else // jika uid tersebut tidak ada berarti invalid user, langsung di catch
            {
                _ht["p_flag_code"]      = "FAIL PASSWORD";
                _ht["p_uid"]            = UID;
                _ht["p_mod_date"]       = DateTime.Now.ToString("yyyy-MM-dd");
                _ht["p_mod_by"]         = txtUID.Text;
                _ht["p_mod_ip_address"] = "127.0.0.1";

                //insert master user login log
                try
                {
                    _dal.Insert("", "xsp_master_user_login_log_insert", _ht);

                    //update last fail count -> ditambahkan 1
                    _dal.Update("", "xsp_master_user_main_increment_fail_count", _ht);

                    ScriptManager.RegisterStartupScript(this, GetType(), "fx", "fnShowErrorNotif('Invalid password', '');", true);
                }
                catch (Exception exp)
                {
                    string error = exp.Message;
                }
            }
        }
        else if (!IsValidUser)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "fx", "fnShowErrorNotif('Invalid user', '');", true);
        }
    }