コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired() && SystemFunction.GetURL(Page.AppRelativeVirtualPath.ToString()) != "helper_indicator.aspx")
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         //var DataRole = UserAcc.GetRolePermission(UserAcc.GetObjUser().nUserID + "");
         //dvUSer.Visible = true;
         //if (DataRole.Count == 1)
         //{
         //    liChange.Visible = false;
         //    liChange2.Visible = false;
         //}
         string Url = SystemFunction.GetURL(Page.AppRelativeVirtualPath);
         if (SystemFunction.GetURL(Page.AppRelativeVirtualPath.ToString()) != "helper_indicator.aspx")
         {
             lrtMenu.Text         = SystemFunction.HTML_Menubar(Url);
             lrtNav_menu.Text     = SystemFunction.HTML_Navtab(Url);
             lrtNav_UserMenu.Text = SystemFunction.HTML_NavtabUser(Url);
         }
         else
         {
             dvUSer.Visible = false;
         }
         ltrFullName1.Text   = ltrFullName2.Text = UserAcc.GetObjUser().sFullName;
         ltrActionRole1.Text = ltrActionRole2.Text = UserAcc.GetObjUser().sActionRoleName;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             UserAcc ua = UserAcc.GetObjUser();
             hidUserID.Value        = ua.nUserID + "";
             hidEncryptUserID.Value = STCrypt.Encrypt(hidUserID.Value);
             SetData(hidUserID.Value.toIntNullToZero());
             //txtOldPass.Attributes.Add("type", "password");
             //string strID = Request.QueryString["strid"];
             //if (!string.IsNullOrEmpty(strID))
             //{
             //    hidUserID.Value = STCrypt.Decrypt(strID);
             //    SetData(hidUserID.Value.toIntNullToZero());
             //    hidEncryptUserID.Value = STCrypt.Encrypt(hidUserID.Value);
             //}
         }
     }
 }
コード例 #3
0
    public static TRetunrLoadData Get_Facility(string operationID)
    {
        //if (lst == null) lst = new List<string>();
        TRetunrLoadData   result = new TRetunrLoadData();
        PTTGC_EPIEntities db     = new PTTGC_EPIEntities();

        if (UserAcc.UserExpired())
        {
            result.Status = SystemFunction.process_SessionExpired;
        }
        else
        {
            int nRoleID = UserAcc.GetObjUser().nRoleID;
            int nUserID = UserAcc.GetObjUser().nUserID;

            List <sysGlobalClass.T_Facility> lstFacility = new List <sysGlobalClass.T_Facility>();
            if (!string.IsNullOrEmpty(operationID))
            {
                int nID = int.Parse(operationID);
                lstFacility = SystemFunction.Get_SubFacility(nID, nUserID, nRoleID);
            }
            result.lstData_Facility = lstFacility.Distinct().ToList();
        }
        return(result);
    }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["user"] == null)
         {
             Response.Redirect("~/ThaPoTuMi/Home");
         }
         UserAcc user = UserAccService.GetUser(Session["user"].ToString());
         txtEmail.Text          = user.Email;
         lbPoint.Text           = "Your point is: " + user.Point;
         drTitle.DataSource     = TitleService.GetTitleSuitable(user.Point);
         drTitle.DataTextField  = "TitleName";
         drTitle.DataValueField = "TitleID";
         drTitle.DataBind();
         if (drTitle.SelectedItem == null)
         {
             btnChangeTitle.Enabled = false;
         }
         if (user.TitleID == 0)
         {
             btnRemoveTitle.Visible = true;
         }
     }
 }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                int Prms = SystemFunction.GetPermissionMenu(34);
                hdfPrmsMenu.Value = Prms + "";
                IsView            = Prms == 1;
                if (IsView)
                {
                    ckbAll.Visible    = false;
                    btnDel.Visible    = false;
                    btnCreate.Visible = false;
                }

                SystemFunction.BindDropdownPageSize(ddlPageSize, null);
                BlindDDL();
            }
        }
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                SystemFunction.BindDropdownPageSize(ddlPageSize, null);
                GETDDL();

                int Prms = SystemFunction.GetPermissionMenu(36);
                //hdfPrmsMenu.Value = Prms + "";
                //bool isView = Prms == 1;
                //if (isView)
                //{
                //    DivCreate_Workflow.Visible = false;
                //    ckbAll.Visible = false;
                //    btnDel.Visible = false;
                //}
            }
        }
    }
コード例 #7
0
        public IActionResult AddUnUserAcc(UserAcc useracc)
        {
            var useraccService = new UserAccService();
            var count          = useraccService.AddUnUserAcc(useracc);

            return(Redirect("/User/Apoint?uid=" + useracc.Uid));
        }
    public static sysGlobalClass.CResutlWebMethod getOperationTypePTT(string sFacilityPTT_ID)
    {
        sysGlobalClass.CResutlWebMethod result = new sysGlobalClass.CResutlWebMethod();
        PTTGC_EPIEntities db = new PTTGC_EPIEntities();

        if (!UserAcc.UserExpired())
        {
            int nFacilityPTT_ID = SystemFunction.GetIntNullToZero(sFacilityPTT_ID);
            var item            = db.mTFacility.FirstOrDefault(w => w.ID == nFacilityPTT_ID);
            if (item != null)
            {
                result.Content = item.OperationTypeID + "";
                result.Status  = SystemFunction.process_Success;
            }
            else
            {
                result.Msg    = "Data operation type not found.";
                result.Status = SystemFunction.process_Failed;
            }
        }
        else
        {
            result.Status = SystemFunction.process_SessionExpired;
        }
        return(result);
    }
コード例 #9
0
        public ActionResult CreateUser()
        {
            UserAcc users = new UserAcc();

            TempData.Keep();
            return(View("UserForm", users));
        }
コード例 #10
0
 public static sysGlobalClass.CResutlWebMethod DeleteData(string[] arrValue)
 {
     sysGlobalClass.CResutlWebMethod result = new sysGlobalClass.CResutlWebMethod();
     if (!UserAcc.UserExpired())
     {
         PTTGC_EPIEntities db       = new PTTGC_EPIEntities();
         List <int>        lstDelID = new List <int>();
         if (arrValue != null)
         {
             lstDelID = arrValue.Select(s => s.toIntNullToZero()).ToList();
         }
         int nUserID = UserAcc.GetObjUser().nUserID;
         db.mTCompany.Where(w => w.ID != EPIFunc.DataType.Company.PTTGCID && lstDelID.Contains(w.ID)).ToList().ForEach(x =>
         {
             x.cDel     = "Y";
             x.dUpdate  = DateTime.Now;
             x.UpdateID = nUserID;
         });
         db.mTFacility.Where(w => lstDelID.Contains(w.CompanyID)).ToList().ForEach(x =>
         {
             x.cDel     = "Y";
             x.dUpdate  = DateTime.Now;
             x.UpdateID = nUserID;
         });
         db.SaveChanges();
         result.Status = SystemFunction.process_Success;
     }
     else
     {
         result.Status = SystemFunction.process_SessionExpired;
     }
     return(result);
 }
コード例 #11
0
    private bool SetUserLogin(string sUserID, string sRoleID)
    {
        int nUserID = SystemFunction.ParseInt(sUserID);
        int nRoleID = SystemFunction.ParseInt(sRoleID);

        var dataUser = db.mTUser.FirstOrDefault(w => w.ID == nUserID);
        var dataRole = db.mTUserRole.FirstOrDefault(w => w.ID == nRoleID);

        var lst_RoleAdmin = db.TMenu_Permission.Where(w => w.nUserID == nUserID && w.nRoleID == nRoleID).ToList();          // Role_Admin
        var lst_RoleOther = db.mTUser_FacilityPermission.Where(w => w.nUserID == nUserID && w.nRoleID == nRoleID).ToList(); // Role_Other
        var lstDataRole   = db.mTUserRole.ToList();                                                                         // Query Role_Name

        if (dataUser != null && dataRole != null)
        {
            string  sNameRole = lstDataRole.Any() ? lstDataRole.First(w => w.ID == nRoleID).Name : "";
            UserAcc us        = new UserAcc();
            us.nUserID         = dataUser.ID;
            us.sFullName       = dataUser.Firstname + " " + dataUser.Lastname;
            us.nRoleID         = lst_RoleAdmin.Any() ? lst_RoleAdmin.First().nRoleID : lst_RoleOther.Any() ? lst_RoleOther.First().nRoleID : 0;
            us.sActionRoleName = sNameRole;
            UserAcc.SetObjUser(us);
            return(true);
        }
        else
        {
            return(false);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!UserAcc.UserExpired())
        {
            if (!IsPostBack)
            {
                setCBL();
                string sQueryStrIndID = Request.QueryString["in"];
                if (!string.IsNullOrEmpty(sQueryStrIndID))
                {
                    hdfIndID.Value = STCrypt.Encrypt(sQueryStrIndID);

                    ((_MP_EPI_FORMS)this.Master).hdfPRMS      = SystemFunction.GetPermissionMenu(15) + "";
                    ((_MP_EPI_FORMS)this.Master).hdfCheckRole = UserAcc.GetObjUser().nRoleID + "";
                }
                else
                {
                    SetBodyEventOnLoad(SystemFunction.DialogWarningRedirect(SystemFunction.Msg_HeadWarning, "Invalid Data", "Intensity_from.aspx"));// กรณีเข้ามาด้วย link ที่ไม่มี Querystring
                }
            }
        }
        else
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
    }
コード例 #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             PTTGC_EPIEntities db  = new PTTGC_EPIEntities();
             string            str = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(str))
             {
                 int nFacID = SystemFunction.GetIntNullToZero(STCrypt.Decrypt(str));
                 hdfFacID.Value = str;
                 ltrCreate.Text = "<a class=\"btn btn-primary btn-sm btn-block\" href=\"admin_asset_update.aspx?strid=" + HttpUtility.UrlEncode(str) + "\"><i class=\"fa fa-plus\"></i>&nbsp;Create Sub-facility</a>";
                 var itemHeader = db.mTFacility.FirstOrDefault(w => w.ID == nFacID);
                 if (itemHeader != null)
                 {
                     var itemCompany = db.mTCompany.FirstOrDefault(w => w.ID == itemHeader.CompanyID);
                     ltrHeader.Text = "<a href='admin_company_lst.aspx' style='color:white'>Organization</a> >  <a style='color:white' href='admin_facility_lst.aspx?strid=" + HttpUtility.UrlEncode(STCrypt.Encrypt(itemCompany.ID + "")) + "'> " + itemCompany.Name + "</a> > " + itemHeader.Name;//กำหนด Header
                 }
             }
             SystemFunction.BindDropdownPageSize(ddlPageSize, null);
         }
     }
 }
コード例 #14
0
        public IActionResult UserAccDelete(UserAcc useracc)
        {
            var useraccService = new UserAccService();
            var useraccs       = useraccService.UserAccDelete(useracc);

            return(Redirect("/User/Apoint?uid=" + useracc.Uid));
        }
コード例 #15
0
    public static sysGlobalClass.CResutlWebMethod SaveAction(List <int> lstMonth, int FormID, string sComment, string sMode)
    {
        sysGlobalClass.CResutlWebMethod r = new sysGlobalClass.CResutlWebMethod();

        if (!UserAcc.UserExpired())
        {
            int nRoleID = UserAcc.GetObjUser().nRoleID;
            int nUserID = UserAcc.GetObjUser().nUserID;
            if (nRoleID == 3)
            {
                r = new Workflow().WorkFlowAction(FormID, lstMonth, sMode, nUserID, nRoleID, sComment);
            }// L1
            else if (nRoleID == 2)
            {
            }//
            else if (nRoleID == 4)
            {
                r = new Workflow().WorkFlowAction(FormID, lstMonth, sMode, nUserID, nRoleID, sComment);
            }//L2
        }
        else
        {
            r.Status = SystemFunction.process_SessionExpired;
            r.Msg    = "";
        }

        //r = new Workflow().WorkFlowAction();
        return(r);
    }
コード例 #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserAcc.UserExpired())
     {
         SetBodyEventOnLoad(SystemFunction.PopupLogin());
     }
     else
     {
         if (!IsPostBack)
         {
             string strID = Request.QueryString["strid"];
             if (!string.IsNullOrEmpty(strID))
             {
                 hdfEncryptCompanyID.Value = STCrypt.Decrypt(strID);
                 SetData(hdfEncryptCompanyID.Value.toIntNullToZero());
                 hdfEncryptCompanyID.Value = STCrypt.Encrypt(hdfEncryptCompanyID.Value);
             }
             else
             {
                 //CR. 06.02.2019 Sync from SAP
                 txtCode.Enabled        = false;
                 txtCompanyName.Enabled = false;
             }
         }
     }
 }
コード例 #17
0
        public ActionResult Signup()
        {
            UserAcc users = new UserAcc();

            TempData.Keep();
            return(View("Signup", users));
        }
    public static CResultHistory ViewHistory(int nFacID, int nYear, int nIndID, int nQuarter)
    {
        CResultHistory result = new CResultHistory();

        if (!UserAcc.UserExpired())
        {
            PTTGC_EPIEntities   db      = new PTTGC_EPIEntities();
            List <TDataHistory> lstData = new List <TDataHistory>();
            lstData = (from d in db.TEPI_TransferPTT_Log.Where(w => w.nFacilityID == nFacID && w.nYear == nYear && w.nIndicatorID == nIndID && w.nQuarter == nQuarter)
                       from u in db.mTUser.Where(w => w.ID == d.nActionBy).DefaultIfEmpty()
                       from st in db.TStatus_Workflow.Where(w => w.nStatustID == d.nStatusID && w.cActive == "Y" && w.cTypeUse == "TNF").DefaultIfEmpty()
                       orderby d.dAction descending
                       select new TDataHistory
            {
                dAction = d.dAction,
                sStatus = st != null ? st.sStatusName : "-",
                sActionBy = u != null ? u.Firstname + " " + u.Lastname : d.nActionBy == -1 ? "PTT" : "",
                sComment = d.sRemark
            }).ToList();
            foreach (var item in lstData)
            {
                item.sDate    = item.dAction.DateString();
                item.sComment = (item.sComment + "").Replace("\n", "<br/>");
            }
            result.lstData = lstData;
            result.Status  = SystemFunction.process_Success;
        }
        else
        {
            result.Status = SystemFunction.process_SessionExpired;
        }
        return(result);
    }
コード例 #19
0
    public static sysGlobalClass.CResutlWebMethod ApproveWithEditContent(int FormID)
    {
        PTTGC_EPIEntities env = new PTTGC_EPIEntities();

        sysGlobalClass.CResutlWebMethod r = new sysGlobalClass.CResutlWebMethod();
        int nOperationType = 0;

        if (!UserAcc.UserExpired())
        {
            var gData = env.TEPI_Forms.FirstOrDefault(f => f.FormID == FormID);
            if (gData != null)
            {
                r.Msg    = SystemFunction.ReturnPath(gData.IDIndicator, gData.OperationTypeID, gData.FacilityID.ToString(), gData.sYear, "27");
                r.Status = SystemFunction.process_Success;
            }
            else
            {
                r.Msg    = "";
                r.Status = SystemFunction.process_Failed;
            }
        }
        else
        {
            r.Msg    = "";
            r.Status = SystemFunction.process_SessionExpired;
        }
        return(r);
    }
コード例 #20
0
        private void SetUserMethod()
        {
            var user           = ApplicationState.GetValue <UserAcc>("User");
            var settingsFolder = ApplicationState.GetValue <string>("SettingsAppFolder");

            if (user != null)
            {
                User = user;

                var logRepository = new LogRepository();
                UserLogList = new ObservableCollection <Log>(logRepository.GetAllByUserId(User.Id, 0));

                var imagePath = settingsFolder + user.UserImagePath;
                if (File.Exists(imagePath))
                {
                    UserImageSource = new BitmapImage(new Uri(imagePath));
                }
            }
            else
            {
                _user           = new UserAcc();
                UserLogList     = null;
                UserImageSource = (BitmapImage)Application.Current.Resources["UserAccBitmapImage"];
            }
        }
コード例 #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserAcc.UserExpired())
        {
            SetBodyEventOnLoad(SystemFunction.PopupLogin());
        }
        else
        {
            if (!IsPostBack)
            {
                SystemFunction.BindDropdownPageSize(ddlPageSize, null);

                int nRole = UserAcc.GetObjUser().nRoleID;
                if (nRole == 3 || nRole == 4)
                {
                    hdfPrmsMenu.Value = "2";
                }
                else
                {
                    hdfPrmsMenu.Value = "0";
                }

                BindDDL();
            }
        }
    }
コード例 #22
0
        public ActionResult CreateEvent(UserAcc userAcc)
        {
            EventM events = new EventM();

            events.usernameId = userAcc.usernameId;
            TempData.Keep();
            return(View("EventForm", events));
        }
コード例 #23
0
 public static int Register(UserAcc user)
 {
     if (IsExist(user.Username))
     {
         return(0);
     }
     return(dal.Insert(user));
 }
コード例 #24
0
        public ActionResult EditUser(int id)
        {
            UserDAO userDAO = new UserDAO();
            UserAcc users   = userDAO.FetchOne(id);

            TempData.Keep();
            return(View("UserForm", users));
        }
コード例 #25
0
ファイル: CartController.cs プロジェクト: luong012/QLHS
        public async Task <IActionResult> Confirm(string fullname, string gender, string id, string email, string birthday, string address, string phone)
        {
            string  userid   = Guid.NewGuid().ToString().Substring(0, 15);
            string  userpass = Guid.NewGuid().ToString().Substring(0, 15);
            UserAcc useracc  = new UserAcc
            {
                User_ID   = userid,
                User_Pass = userpass,
                User_Role = 3
            };

            _context.Add(useracc);
            await _context.SaveChangesAsync();

            Customer customer = new Customer
            {
                Cus_Address = address,
                Cus_Birth   = DateTime.ParseExact(birthday, "yyyy-MM-dd",
                                                  System.Globalization.CultureInfo.InvariantCulture),
                Cus_Email  = email,
                Cus_Gender = gender,
                Cus_ID     = id,
                Cus_Name   = fullname,
                Cus_Phone  = phone,
                User_ID    = userid
            };
            var flag = await _context.Customer.Where(p => p.Cus_ID == id).CountAsync();

            if ((int)flag > 0)
            {
                _context.Update(customer);
            }
            else
            {
                _context.Add(customer);
            }

            HttpContext.Session.SetString("cusName", fullname);
            HttpContext.Session.SetString("cusEmail", email);
            HttpContext.Session.SetString("cusPhone", phone);
            HttpContext.Session.SetString("cusAddress", address);

            double discount = 0;

            if (HttpContext.Session.GetInt32("Voucher") != null)
            {
                discount = (double)HttpContext.Session.GetInt32("Voucher");
            }
            double grandtotal = (HttpContext.Session.GetInt32("GrandTotal") ?? 0);

            ViewBag.GrandTotal = (grandtotal * (double)((100 - discount) / 100)).ToString("C0", new CultureInfo("vi-vn"));
            ViewBag.VValue     = discount;

            HttpContext.Session.SetString("CusID", customer.Cus_ID);
            await _context.SaveChangesAsync();

            return(View(customer));
        }
コード例 #26
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            string  username = txtUsername.Text;
            string  password = txtPassword.Text;
            string  email    = txtEmail.Text;
            UserAcc user     = new UserAcc(username, password, email);

            UserAccService.Register(user);
        }
コード例 #27
0
        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";
            UserAcc _uobj = Session["userInfo"] as UserAcc;

            TempData.Keep();
            return(View());
            //return View("About", userAcc);
        }
コード例 #28
0
        public ActionResult ProcessUser(UserAcc userAcc)
        {
            //save to the db.
            UserDAO userDAO = new UserDAO();

            userDAO.CreateOrUpdate(userAcc);
            TempData.Keep();
            return(View("UserDetails", userAcc));
        }
コード例 #29
0
        public static Boolean IsExist(string username)
        {
            UserAcc user = dal.GetUserByName(username);

            if (user == null || !user.Password.Equals(username))
            {
                return(false);
            }
            return(true);
        }
コード例 #30
0
        public static int CheckLogin(string username, string password)
        {
            UserAcc user = dal.GetUserByName(username);

            if (user == null || !user.Password.Equals(password) || !user.Status)
            {
                return(0);
            }
            return(1);
        }