Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }

            if (!Page.IsPostBack)
            {
                Session["CompanyUserRPT"] = null;

                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                if (retUser.RolesNo > 0)
                {
                    if (retUser.RolesNo == 1)
                    {
                        btnExport.Visible = true;
                    }
                    else
                    {
                        btnExport.Visible = false;
                    }
                }

                ViewState["SortGridview"] = "CompanyNo ";

                BindCompanyUser();
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] != null)
            {
                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                if (retUser.RolesNo == 1)
                {
                    MenuItem parent1 = NavigationMenu.FindItem("2");
                    NavigationMenu.Items.Remove(parent1);

                    MenuItem parent = NavigationMenu.FindItem("8");
                    NavigationMenu.Items.Remove(parent);
                }
                else
                {
                    //(retUser.RolesNo == 2)
                    SetVendorMenu();
                }
            }
            else
            {
                FormsAuthentication.SignOut();
                SetDefaultMenu();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }

            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            if (!Page.IsPostBack)
            {
                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                if (retUser.RolesNo > 0)
                {
                    hdfCompanyNo.Value = retUser.CompanyNo.ToString().Trim();
                    hdfUserName.Value  = retUser.UserName;
                    hdfUserNo.Value    = retUser.UsersNo.ToString().Trim();
                    hdfRoleNo.Value    = retUser.RolesNo.ToString();

                    //Mas_BiddingCompany_Manage cManage = new Mas_BiddingCompany_Manage();
                    //MAS_BIDDINGCOMPANY comData = new MAS_BIDDINGCOMPANY();
                    //comData = cManage.GetBiddingCompany(retUser.CompanyNo.ToString());
                    //lblCompanyName.Text = comData.CompanyName;
                }

                InitialControl();
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }

            if (!IsPostBack)
            {
                Session["UpdResult"] = null;

                string _companyNo = Request.QueryString["CompanyNo"];

                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                hdfUserName.Value = retUser.UserName.ToString().Trim();
                hdfUsersNo.Value  = retUser.UsersNo.ToString().Trim();
                hdfRoleNo.Value   = retUser.RolesNo.ToString().Trim();

                hdfCompanyNo.Value = string.IsNullOrWhiteSpace(_companyNo) ? retUser.CompanyNo.ToString().Trim() : _companyNo;

                GetCompanyUserDetail();
                //GetCompanyUserAttachFile();
            }
        }
Exemple #5
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            MAS_COMPANYUSER_DTO       sessionUserDet = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
            Mas_BiddingCompany_Manage manage         = new Mas_BiddingCompany_Manage();
            MAS_USERS userUpdate = new MAS_USERS();

            userUpdate.UsersNo     = Int64.Parse(hdfUserNo.Value.Trim());
            userUpdate.Status      = "Approved";
            userUpdate.UpdatedBy   = sessionUserDet.UserName;
            userUpdate.UpdatedDate = DateTime.Now;

            bool bReset = manage.UpdateUserStatus(userUpdate);

            if (bReset)
            {
                lblMsgResult1.Text = "บันทึกสถานะ การอนุมัติข้อมูลสำเร็จ";
                lblMsgResult2.Text = string.Empty;
                lbtnPopup_ModalPopupExtender.Show();

                /************** Send Email Notify***************/
                string _userName    = lblUserName.Text.Trim();
                string _companyName = lblCompanyName.Text.Trim();
                string _emailNotify = ConfigurationManager.GetConfiguration().EmailNotify;
                string sBody        = GenEmailBodyMailNotify(_userName, _companyName);
                SendMailNotify(sBody, _emailNotify);
                /*************************************************************/
            }
            else
            {
                lblMsgResult1.Text = "บันทึกสถานะ การอนุมัติข้อมูลไม่สำเร็จ";
                lblMsgResult2.Text = "กรุณาติดต่อผู้ดูแลระบบ";
                lbtnPopup_ModalPopupExtender.Show();
            }
        }
Exemple #6
0
        protected void ValidatePass_ServerValidate(object source, ServerValidateEventArgs args)
        {
            try
            {
                int _passLength = int.Parse(ConfigurationManager.GetConfiguration().PasswordLength);
                if (txtNewPassword.Text.Trim().Length < _passLength)
                {
                    //Minimum 6 characters required.
                    //logger.Info("Minimum 6 characters required. [UserName:"******"]");

                    ValidatePass.ErrorMessage = "กรุณาระบุรหัสผ่านใหม่อย่างน้อย 6 ตัวอักษร.";
                    args.IsValid = false;
                    return;
                }

                Mas_BiddingCompany_Manage manage  = new Mas_BiddingCompany_Manage();
                MAS_COMPANYUSER_DTO       retUser = new MAS_COMPANYUSER_DTO();


                retUser = manage.GetUserLogin(hdfUserName.Value);

                if (retUser.UsersNo != null)
                {
                    GlobalFunction func         = new GlobalFunction();
                    string         _currentPass = func.Encrypt(txtCurrentPassword.Text.Trim());
                    string         _newPass     = txtNewPassword.Text.Trim();
                    string         _confirmPass = txtConfirmNewPassword.Text.Trim();

                    string _oldPass = retUser.Password.Trim();
                    if (!_oldPass.Equals(_currentPass))
                    {
                        //รหัสผ่านเก่าไม่ถูกต้อง
                        //logger.Info("Old password is incorrect. [UserName:"******"]");

                        ValidatePass.ErrorMessage = "รหัสผ่านเก่าไม่ถูกต้อง";
                        args.IsValid = false;
                        return;
                    }

                    if (!_newPass.Equals(_confirmPass))
                    {
                        //ยืนยันรหัสผ่านไม่ถูกต้อง
                        //logger.Info("The Confirm New Password must match the New Password entry. [UserName:"******"]");

                        ValidatePass.ErrorMessage = "ยืนยันรหัสผ่านไม่ถูกต้อง";
                        args.IsValid = false;
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB", false);
                Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();");

                if (!Page.IsPostBack)
                {
                    GlobalFunction func       = new GlobalFunction();
                    string         _ProjectNo = Request.QueryString["ProjectNo"];
                    string         _CompanyNo = Request.QueryString["CompanyNo"];
                    if (string.IsNullOrEmpty(_ProjectNo) || string.IsNullOrEmpty(_CompanyNo))
                    {
                        Session.Clear();
                        Session.Abandon();
                        ViewState.Clear();
                        FormsAuthentication.SignOut();

                        Response.Redirect("~/Account/Login.aspx");
                    }
                    else
                    {
                        hdfProjectNo.Value = func.Decrypt(_ProjectNo.Trim());
                        hdfCompanyNo.Value = func.Decrypt(_CompanyNo.Trim());
                    }

                    MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                    if (retUser.UsersNo > 0)
                    {
                        string _RoleNo = retUser.RolesNo.ToString();
                        GetCompQuestionaire(_RoleNo);
                    }
                    else
                    {
                        Session.Clear();
                        Session.Abandon();
                        ViewState.Clear();
                        FormsAuthentication.SignOut();

                        logger.Info("Session UserLogin has no data..!");
                        Response.Redirect("~/Account/Login.aspx", true);
                    }
                }
            }
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }

            if (!Page.IsPostBack)
            {
                MAS_COMPANYUSER_DTO sessionUserDet = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                hdfRoleNo.Value    = sessionUserDet.RolesNo.ToString().Trim();
                hdfCompanyNo.Value = sessionUserDet.CompanyNo.ToString().Trim();

                if (!string.IsNullOrWhiteSpace(Request.QueryString["UserName"]))
                {
                    string         _strPara = Request.QueryString["UserName"];
                    GlobalFunction fDecrypt = new GlobalFunction();
                    string         decPara  = fDecrypt.Decrypt(_strPara);

                    hdfUserName.Value  = decPara;
                    hdfCompanyNo.Value = null;
                }
                else
                {
                    hdfUserName.Value = sessionUserDet.UserName.ToString().Trim();
                    if (sessionUserDet.RolesNo == 2)
                    {
                        linkQuestionaire.Visible = false;
                        btnCancel.Visible        = false;

                        linkChangePass.Attributes["href"]    = "~/Account/ChangePassword.aspx";
                        linkChangeProfile.Attributes["href"] = "~/Form/EditUserRegister.aspx";
                    }
                    else if (sessionUserDet.RolesNo == 1)
                    {
                        linkQuestionaire.Visible = true;
                        btnCancel.Visible        = true;
                    }
                }

                GetUserAccountDetail();

                GetCompanyUserDetail();

                GetCompanyUserAttachFile();
            }
        }
Exemple #9
0
        private void GetUserAccountDetail()
        {
            Mas_BiddingCompany_Manage manage = new Mas_BiddingCompany_Manage();
            MAS_COMPANYUSER_DTO       ret    = new MAS_COMPANYUSER_DTO();

            ret = manage.GetCompanyUserDetail(hdfUserName.Value.ToString());

            if (ret != null && ret.CompanyNo > 0)
            {
                hdfUserNo.Value    = ret.UsersNo.ToString().Trim();
                hdfCompanyNo.Value = ret.CompanyNo.ToString().Trim();

                lblUserName.Text    = ret.UserName;
                lblProjectName.Text = ret.ProjectName;
                lblStatus.Text      = ret.Status;

                if (hdfRoleNo.Value.Trim().Equals("1"))
                {
                    if (!string.IsNullOrWhiteSpace(ret.Status))
                    {
                        if (ret.Status.Trim().Equals("Not Verify"))
                        {
                            btnVerify.Visible  = true;
                            btnApprove.Visible = false;
                        }

                        if (ret.Status.Trim().Equals("Verified"))
                        {
                            btnVerify.Visible  = false;
                            btnApprove.Visible = true;
                        }
                    }
                }

                /******************** Decrypt Password *******************/
                GlobalFunction func         = new GlobalFunction();
                string         _password    = ret.Password;
                string         _decryptPass = func.Decrypt(_password);
                /********************************************************/
                lblPassword.Text = _decryptPass;

                if (string.IsNullOrWhiteSpace(hdfRoleNo.Value) || hdfRoleNo.Value.Trim().Equals("1"))
                {
                    linkChangePass.Attributes["href"]    = "~/Account/ChangePassword.aspx?UsersNo=" + ret.UsersNo.ToString().Trim() + "&UserName="******"href"] = "~/Form/EditUserRegister.aspx?CompanyNo=" + ret.CompanyNo.ToString().Trim();
                    linkQuestionaire.Attributes["href"]  = "~/Form/ViewQuestionnaire.aspx?CompanyNo=" + ret.CompanyNo.ToString().Trim() + "&ProjectNo=" + ret.ProjectNo.ToString().Trim();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Session["UserLogin"] == null)
            //{
            //    Response.Redirect("~/Account/Login.aspx");
            //}

            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB", false);
            if (!Page.IsPostBack)
            {
                //ViewState["PathFilePDF"] = null;
                if (Session["UserLogin"] != null)
                {
                    MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                    if (retUser.RolesNo > 0)
                    {
                        if (retUser.RolesNo == 1)
                        {
                            btnAccept.Visible = false;
                            btnCancel.Visible = false;
                            btnBack.Visible   = true;
                        }
                    }
                }

                string _UrlEncrypt = string.IsNullOrWhiteSpace(Request.QueryString["ProjectNo"]) ? "" : Request.QueryString["ProjectNo"];
                if (!string.IsNullOrEmpty(_UrlEncrypt))
                {
                    GlobalFunction fDEcrypt = new GlobalFunction();
                    //_UrlEncrypt = _UrlEncrypt.Replace(" ", "+");
                    string _UrlDecrypt = fDEcrypt.Decrypt(_UrlEncrypt);

                    hdfProjectNo.Value = _UrlDecrypt;

                    ViewState["PathFile"] = null;

                    GetProjectBidding();
                }
                else
                {
                    Session.Clear();
                    Session.Abandon();
                    ViewState.Clear();
                    FormsAuthentication.SignOut();

                    Response.Redirect("~/Account/Login.aspx");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }

            if (!IsPostBack)
            {
                Session["VendorBiddingDetailRPT"] = null;

                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                if (retUser.RolesNo > 0)
                {
                    if (retUser.RolesNo == 1)
                    {
                        btnExport.Visible = true;
                    }
                    else
                    {
                        btnExport.Visible = false;
                    }
                }

                hdfProjectNo.Value = Request.QueryString["ProjectNo"];
                hdfBiddingNo.Value = Request.QueryString["BiddingNo"];

                ViewState["TemplateNo"]      = string.Empty;
                ViewState["TemplateColName"] = null;

                GetProjectBidding();
                BindGvAttachFile();
                GetPriceDetail();
            }

            //else
            //{
            //    string _templateNo = (string)ViewState["TemplateNo"];
            //    BindItemProject(_templateNo);
            //    BindGvAttachFile();
            //}
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Response.Redirect("~/Account/Login.aspx", true);
            }

            if (!IsPostBack)
            {
                string _userNo   = Request.QueryString["UsersNo"];
                string _userName = Request.QueryString["UserName"];

                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                hdfUserName.Value = string.IsNullOrWhiteSpace(_userName) ? retUser.UserName.ToString().Trim() : _userName.Trim();
                hdfUsersNo.Value  = string.IsNullOrWhiteSpace(_userNo) ? retUser.UsersNo.ToString().Trim() : _userNo.Trim();
                hdfRoleNo.Value   = retUser.RolesNo.ToString().Trim();
            }
        }
        private void InitialControl()
        {
            MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];

            if (retUser.RolesNo > 0)
            {
                if (retUser.RolesNo == 1)
                {
                    btnExport.Visible = true;
                }
                else
                {
                    btnExport.Visible = false;
                }
            }


            BindGridview();
        }
Exemple #14
0
        protected void ValidatePass_ServerValidate(object source, ServerValidateEventArgs args)
        {
            try
            {
                string _userName = txtUserName.Text.Trim();
                string _password = txtPassword.Text.Trim();

                Mas_BiddingCompany_Manage manage  = new Mas_BiddingCompany_Manage();
                MAS_COMPANYUSER_DTO       retUser = new MAS_COMPANYUSER_DTO();
                retUser = manage.GetUserLogin(_userName);

                /***************** Verify Username *******************/
                if (retUser.UsersNo == null)
                {
                    logger.Info("User is not Exist [UserName:"******"]");
                    args.IsValid = false;
                    return;
                }
                /*****************************************************/

                /******************** Varify Password *******************/
                GlobalFunction func         = new GlobalFunction();
                string         _encryptPass = func.Encrypt(_password);
                if (!retUser.Password.Equals(_encryptPass))
                {
                    logger.Info("Password is Incorrect [UserName:"******"]& [Password:"******"]");
                    args.IsValid = false;
                    return;
                }
                /********************************************************/

                FormsAuthentication.SetAuthCookie(_userName, true);
                Session["UserLogin"] = retUser;
            }
            catch (Exception ex)
            {
                args.IsValid = false;

                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Response.Redirect("~/Account/Login.aspx");
            }


            if (!IsPostBack)
            {
                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                if (retUser.RolesNo > 0)
                {
                    hdfUserName.Value = retUser.UserName;
                }

                ViewState["AddNewItem"] = null;
                Session["CreateResult"] = null;

                InitialControl();
                InitialDDLDepartment();
            }
            else
            {
                //pnListItem.Visible = true;
                GetItemTemplateNSetGridview(ddlItemTemplate.SelectedValue);

                //if (ddlItemTemplate.SelectedIndex != 0)
                //{
                //    pnListItem.Visible = true;
                //    GetItemTemplateNSetGridview(ddlItemTemplate.SelectedValue);
                //}
                //else
                //{
                //    pnListItem.Visible = false;
                //}
            }
        }
        //protected void lbtnAttachFile_Click(object sender, EventArgs e)
        //{
        //    if (ViewState["PathFile"] != null)
        //    {
        //        string _pathfile = (string)ViewState["PathFile"];
        //        DownloadAttachFile(_pathfile);
        //    }
        //}

        protected void btnAccept_Click(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                /******************************************/
                //// Check Questionnaire ///////////////////
                /******************************************/

                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                if (retUser.RolesNo > 0)
                {
                    hdfCompanyNo.Value = retUser.CompanyNo.ToString().Trim();
                    hdfUserName.Value  = retUser.UserName;
                    hdfUserNo.Value    = retUser.UsersNo.ToString().Trim();
                    hdfRoleNo.Value    = retUser.RolesNo.ToString();
                }

                Inf_Questionnaire_Manage manage  = new Inf_Questionnaire_Manage();
                INF_QUESTIONNAIRE        retData = new INF_QUESTIONNAIRE();
                retData.ProjectNo = hdfProjectNo.Value.Trim();
                retData.CompanyNo = hdfCompanyNo.Value.Trim();
                retData           = manage.GetQuestionaire(retData);
                if (retData != null && retData.QuestionNo > 0)
                {
                    Response.Redirect("~/Form/BiddingProcess.aspx?ProjectNo=" + hdfProjectNo.Value);
                }
                else
                {
                    //Response.Redirect("~/Form/Questionnaire.aspx?ProjectNo=" + hdfProjectNo.Value);
                    Response.Redirect("~/Form/UserRegister.aspx", true);
                }
                /*******************************************/
            }
        }
Exemple #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }

            if (!Page.IsPostBack)
            {
                ViewState["SortGridview_BidingHistory"] = "BiddingsNo DESC";
                Session["BidingProjectHistoryRPT"]      = null;

                MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                if (retUser.RolesNo > 0)
                {
                    hdfCompanyNo.Value = retUser.CompanyNo.ToString().Trim();
                    hdfUserName.Value  = retUser.UserName;
                    hdfUserNo.Value    = retUser.UsersNo.ToString().Trim();
                    hdfRoleNo.Value    = retUser.RolesNo.ToString();

                    if (retUser.RolesNo == 1)
                    {
                        btnExport.Visible = true;
                    }
                    else
                    {
                        btnExport.Visible = false;
                    }
                }

                InitialControl();
            }
        }
Exemple #18
0
        public MAS_COMPANYUSER_DTO GetUserLogin(string UserName)
        {
            IDbConnection       conn = null;
            MAS_COMPANYUSER_DTO ret  = new MAS_COMPANYUSER_DTO();

            try
            {
                //SET CONNECTION
                conn = ConnectionFactory.GetConnection();
                conn.ConnectionString = ConfigurationManager.GetConfiguration().DbConnectionString;

                //OPEN CONNECTION
                conn.Open();

                Mas_BiddingCompanyBL bl = new Mas_BiddingCompanyBL(conn);
                ret = bl.GetUserByUserName(UserName);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            finally
            {
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Dispose();
                }
            }

            return(ret);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    string _projectNo = string.Empty;
                    _projectNo = Request.QueryString["ProjectNo"];

                    if (!string.IsNullOrEmpty(_projectNo))
                    {
                        GlobalFunction fDecrypt = new GlobalFunction();
                        hdfProjectNo.Value = fDecrypt.Decrypt(_projectNo);

                        MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                        if (retUser.RolesNo > 0)
                        {
                            hdfCompanyNo.Value = retUser.CompanyNo.ToString().Trim();
                            hdfUserName.Value  = retUser.UserName;
                            hdfUserNo.Value    = retUser.UsersNo.ToString().Trim();
                            hdfRoleNo.Value    = retUser.RolesNo.ToString();

                            if (retUser.RolesNo == 2)
                            {
                                if (!retUser.ProjectNo.ToString().Trim().Equals(hdfProjectNo.Value.Trim()))
                                {
                                    Session.Clear();
                                    Session.Abandon();
                                    ViewState.Clear();
                                    FormsAuthentication.SignOut();

                                    Response.Redirect("~/Account/Login.aspx");
                                }
                            }
                        }

                        ViewState["PathFile"]        = null;
                        ViewState["TemplateNo"]      = string.Empty;
                        ViewState["TemplateColName"] = null;
                        ViewState["tbAttachFile"]    = null;

                        GetProjectBidding();
                    }
                    else
                    {
                        Session.Clear();
                        Session.Abandon();
                        ViewState.Clear();
                        FormsAuthentication.SignOut();

                        Response.Redirect("~/Account/Login.aspx");
                    }
                }
                else
                {
                    string _templateNo = (string)ViewState["TemplateNo"];
                    BindItemProject(_templateNo);
                }
            }
        }
Exemple #20
0
        private void GetCompQuestionaire(string RoleNo)
        {
            try
            {
                MAS_COMPANYUSER_DTO _UserLogin = (MAS_COMPANYUSER_DTO)Session["UserLogin"];

                Inf_Questionnaire_Manage manage  = new Inf_Questionnaire_Manage();
                INF_QUESTIONNAIRE        retData = new INF_QUESTIONNAIRE();
                retData.ProjectNo = hdfProjectNo.Value.Trim();
                retData.CompanyNo = hdfCompanyNo.Value.Trim();

                retData = manage.GetQuestionaire(retData);
                if (retData.QuestionNo > 0)
                {
                    if ((!retData.CompanyNo.Trim().Equals(_UserLogin.CompanyNo.ToString().Trim()) ||
                         !retData.ProjectNo.Equals(_UserLogin.ProjectNo.ToString().Trim())) &&
                        (RoleNo.Trim().Equals("2")))
                    {
                        Session.Clear();
                        Session.Abandon();
                        ViewState.Clear();
                        FormsAuthentication.SignOut();

                        Response.Redirect("~/Account/Login.aspx", true);
                    }
                    else
                    {
                        Mas_BiddingCompany_Manage cManage = new Mas_BiddingCompany_Manage();
                        MAS_BIDDINGCOMPANY        comData = new MAS_BIDDINGCOMPANY();
                        comData         = cManage.GetBiddingCompany(retData.CompanyNo);
                        lblCompany.Text = comData.CompanyName;

                        if (retData.AnsQuestion1 != null)
                        {
                            lblQ1.Text = (retData.AnsQuestion1 == 1 ? "ใช่" : "ไม่ใช่");
                        }

                        lblQ2.Text = retData.AnsQuestion2;

                        if (retData.AnsQuestion3 != null)
                        {
                            lblQ3.Text = (retData.AnsQuestion3 == 1 ? "ใช่" : "ไม่ใช่");
                        }

                        if (retData.AnsQuestion4 != null)
                        {
                            lblQ4.Text = (retData.AnsQuestion4 == 1 ? "ใช่" : "ไม่ใช่");
                        }

                        if (retData.AnsQuestion5 != null)
                        {
                            lblQ5.Text = (retData.AnsQuestion5 == 1 ? "ใช่" : "ไม่ใช่");
                        }

                        if (retData.AnsQuestion6 != null)
                        {
                            lblQ6.Text = (retData.AnsQuestion6 == 1 ? "ใช่" : "ไม่ใช่");
                        }

                        if (retData.AnsQuestion7 != null)
                        {
                            lblQ7.Text = (retData.AnsQuestion7 == 1 ? "ใช่" : "ไม่ใช่");
                        }

                        if (!string.IsNullOrEmpty(retData.AnsQuestion8))
                        {
                            lblQ8.Text = retData.AnsQuestion8;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }
Exemple #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    GlobalFunction fDecrypt = new GlobalFunction();

                    string _ProjectNo = Request.QueryString["ProjectNo"];
                    string _BiddingNo = Request.QueryString["BiddingNo"];

                    if (string.IsNullOrEmpty(_ProjectNo) || string.IsNullOrEmpty(_BiddingNo))
                    {
                        Session.Clear();
                        Session.Abandon();
                        ViewState.Clear();
                        FormsAuthentication.SignOut();

                        Response.Redirect("~/Account/Login.aspx");
                    }
                    else
                    {
                        hdfProjectNo.Value = fDecrypt.Decrypt(_ProjectNo);
                        hdfBiddingNo.Value = fDecrypt.Decrypt(_BiddingNo);
                    }

                    Session["BiddingDetailRPT"] = null;

                    MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                    if (retUser.RolesNo > 0)
                    {
                        if (retUser.RolesNo == 1)
                        {
                            btnExport.Visible = true;
                        }
                        else
                        {
                            btnExport.Visible = false;
                            //********************* Authen User **********************************//
                            if (!retUser.ProjectNo.ToString().Trim().Equals(hdfProjectNo.Value.Trim()))
                            {
                                Session.Clear();
                                Session.Abandon();
                                ViewState.Clear();
                                FormsAuthentication.SignOut();

                                Response.Redirect("~/Account/Login.aspx");
                            }

                            Mas_ProjectITemBidding_Manage manage = new Mas_ProjectITemBidding_Manage();
                            INF_BIDDINGS bData = new INF_BIDDINGS();
                            bData = manage.GetInfBidding(hdfBiddingNo.Value.Trim());
                            if (bData.BiddingsNo == null)
                            {
                                Session.Clear();
                                Session.Abandon();
                                ViewState.Clear();
                                FormsAuthentication.SignOut();

                                Response.Redirect("~/Account/Login.aspx");
                            }
                            else
                            {
                                if (bData.CompanyNo != retUser.CompanyNo && bData.ProjectNo != retUser.ProjectNo)
                                {
                                    Session.Clear();
                                    Session.Abandon();
                                    ViewState.Clear();
                                    FormsAuthentication.SignOut();

                                    Response.Redirect("~/Account/Login.aspx");
                                }
                            }
                            //******************************************************//
                        }
                    }

                    ViewState["TemplateNo"]      = string.Empty;
                    ViewState["TemplateColName"] = null;

                    GetProjectBidding();
                    BindGvAttachFile();
                    GetPriceDetail();

                    linkViewQuestionaire.Attributes["href"] = "~/Form/ViewQuestionnaire.aspx?ProjectNo=" + fDecrypt.Encrypt(hdfProjectNo.Value.Trim()) +
                                                              "&CompanyNo=" + fDecrypt.Encrypt(hdfCompanyNo.Value.Trim());
                }
            }
        }