Exemplo n.º 1
0
        public void Configuration(IAppBuilder app)
        {
            string language = Ultils.GetCookie("lang");

            if (!string.IsNullOrEmpty(language))
            {
                LanguageHelper.languageId = language;
            }
            ConfigureAuth(app);
        }
    public static bool isLogged()
    {
        string UId = Ultils.GetCookie("UserId");

        if (!string.IsNullOrWhiteSpace(UId))
        {
            return(true);
        }
        return(false);
    }
    public static bool checkPermission()
    {
        string per = Ultils.GetCookie("UserPermission");

        if (!string.IsNullOrWhiteSpace(per) && (per.IndexOf("manager") != -1 || per.IndexOf("admin") != -1))
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
        public ResourceManagerModel repairResourceManagerModel(int?page)
        {
            ResourceManagerModel rmm = new ResourceManagerModel();

            if (Ultils.GetCookie("RMMSelectedLang") != null)
            {
                rmm.Language = Ultils.GetCookie("RMMSelectedLang");
            }
            List <SelectListItem> slm        = new List <SelectListItem>();
            DataTable             dtLanguage = LanguageHelper.GetListLanguage();

            foreach (DataRow dr in dtLanguage.Rows)
            {
                try
                {
                    slm.Add(new SelectListItem {
                        Value = dr["languageId"].ToString().Trim(), Text = LanguageHelper.GetResource(dr["languageId"].ToString())
                    });
                    if (string.IsNullOrEmpty(rmm.Language))
                    {
                        rmm.Language = dr["languageId"].ToString().Trim();
                    }
                }
                catch (Exception exc) { }
            }
            rmm.listLanguage = slm;

            //For paging
            int totalRecord = getTotalRecord(rmm.Language);
            int totalPage   = totalRecord / PagerModel.PageSize;

            if (totalRecord % PagerModel.PageSize != 0)
            {
                totalPage += 1;
            }
            ViewBag.Pager = new PagerModel("Index", "Resources", "Administrators", page == null ? 1 : (int)page, totalPage);

            if (page == null)
            {
                page = 1;
            }
            rmm.curentPage   = page;
            rmm.listResource = getListResourceModel(rmm.Language, page, PagerModel.PageSize);

            return(rmm);
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            //Default display language
            string languageId = Ultils.GetCookie("language");

            if (string.IsNullOrWhiteSpace(languageId))
            {
                languageId = LanguageHelper.languageEN;
            }
            LanguageHelper.languageId = LanguageHelper.languageEN;
            //session timeout
            if (Context.Session != null)
            {
                Session.Timeout = 120;
            }
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());
        }
Exemplo n.º 6
0
 public void CreateApprover(ApproverModel am)
 {
     if (am != null)
     {
         SQLServerDBHelper db        = new SQLServerDBHelper("EsignDB");
         string            InsertSQL = "INSERT INTO Approver(SiteID, BUID, ApproverType, ApproverEmpNo, ApproverEmpName, SetupEmp) VALUES('" + am.SiteId + "','" + am.BUID + "',N'" + am.ApproverType + "','" + am.ApproverEmpNo + "',N'" + am.ApproverEmpName + "','" + Ultils.GetCookie("UserId") + "')";
         if (db.ExcuteNonQuery(InsertSQL))
         {
             Ultils.WriteCookie("Success", LanguageHelper.GetResource("AddSuccess"));
         }
         else
         {
             Ultils.WriteCookie("Error", LanguageHelper.GetResource("AddFail"));
         }
     }
     else
     {
         Ultils.WriteCookie("Error", LanguageHelper.GetResource("ApproverUpdateEmpty"));
     }
 }
Exemplo n.º 7
0
 public void UpdateApprover(ApproverModel am)
 {
     if (am != null && !string.IsNullOrWhiteSpace(am.ApproverID))
     {
         SQLServerDBHelper db        = new SQLServerDBHelper("EsignDB");
         string            UpdateSql = "UPDATE Approver SET SiteID='" + am.SiteId + "',BUID='" + am.BUID + "',ApproverType=N'" + am.ApproverType + "',ApproverEmpNo='" + am.ApproverEmpNo + "',ApproverEmpName=N'" + am.ApproverEmpName + "',SetupEmp='" + Ultils.GetCookie("UserId") + "',SetupTime=getDate() WHERE ApproverID='" + am.ApproverID.Trim() + "'";
         if (db.ExcuteNonQuery(UpdateSql))
         {
             Ultils.WriteCookie("Success", LanguageHelper.GetResource("UpdateSuccess"));
         }
         else
         {
             Ultils.WriteCookie("Error", LanguageHelper.GetResource("UpdateFail"));
         }
     }
     else
     {
         Ultils.WriteCookie("Error", LanguageHelper.GetResource("ApproverUpdateEmpty"));
     }
 }
 public static string getUserPermission()
 {
     return(Ultils.GetCookie("UserPermission"));
 }
 public static string getUserName()
 {
     return(Ultils.GetCookie("UserName"));
 }
Exemplo n.º 10
0
 public static string getUserId()
 {
     return(Ultils.GetCookie("UserId"));
 }