コード例 #1
0
        public void SaveUsers()
        {
            StreamReader maReader = new StreamReader(Request.InputStream);
            string       strOBJ   = maReader.ReadToEnd();
            dynamic      dData    = (dynamic)JsonConvert.DeserializeObject(strOBJ);

            try
            {
                int ID = Convert.ToInt32(dData.JsonForm.ID);

                UserLogin u = new UserLogin();
                u.ID           = ID;
                u.UserName     = dData.JsonForm.UserName.ToString();
                u.UserPassword = dData.JsonForm.UserPassword.ToString();

                if (ID == 0)
                {
                    WebApiServiceClass.NewUser(u);
                }
                else
                {
                    WebApiServiceClass.UpdateUser(u);
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        public void SaveEmailSettings()
        {
            StreamReader maReader = new StreamReader(Request.InputStream);
            string       strOBJ   = maReader.ReadToEnd();
            dynamic      dData    = (dynamic)JsonConvert.DeserializeObject(strOBJ);

            try
            {
                int ID = Convert.ToInt32(dData.JsonForm.ID);

                EmailSettings u = new EmailSettings();
                u.ID               = ID;
                u.FromMail         = dData.JsonForm.FromMail.ToString();
                u.FromMailPassword = dData.JsonForm.FromMailPassword.ToString();
                u.MailSubject      = dData.JsonForm.MailSubject.ToString();
                u.Port             = Convert.ToInt32(dData.JsonForm.Port);
                u.SmtpServer       = dData.JsonForm.SmtpServer.ToString();
                u.ToMail           = dData.JsonForm.ToMail.ToString();
                u.UserLoginID      = ((UserLogin)System.Web.HttpContext.Current.Session["User"]).ID;

                if (ID == 0)
                {
                    WebApiServiceClass.NewEmailSettings(u);
                }
                else
                {
                    WebApiServiceClass.UpdateEmailSettings(u);
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #3
0
ファイル: LoginController.cs プロジェクト: WishneSoda/pushex
 public ActionResult NewUser(UserLogin ul)
 {
     if (!String.IsNullOrEmpty(ul.UserName) && !String.IsNullOrEmpty(ul.UserPassword))
     {
         WebApiServiceClass.NewUser(ul);
     }
     return(View());
 }
コード例 #4
0
        public string GetErrorLogsList()
        {
            StreamReader maReader = new StreamReader(Request.InputStream);
            string       strOBJ   = maReader.ReadToEnd();
            dynamic      dData    = (dynamic)JsonConvert.DeserializeObject(strOBJ);
            string       Records  = WebApiServiceClass.GetErrorLogsList();

            return(Records);
        }
コード例 #5
0
        public void DeleteUsers()
        {
            StreamReader maReader = new StreamReader(Request.InputStream);
            string       strOBJ   = maReader.ReadToEnd();
            dynamic      dData    = (dynamic)JsonConvert.DeserializeObject(strOBJ);

            try
            {
                int    ID      = Convert.ToInt32(dData.ID.Value);
                string Records = WebApiServiceClass.DeleteUserByID(ID);
            }
            catch (Exception ex)
            {
            }
        }
コード例 #6
0
        public void DeleteTargetApps()
        {
            StreamReader maReader = new StreamReader(Request.InputStream);
            string       strOBJ   = maReader.ReadToEnd();
            dynamic      dData    = (dynamic)JsonConvert.DeserializeObject(strOBJ);

            try
            {
                int       ID      = Convert.ToInt32(dData.ID.Value);
                string    Records = WebApiServiceClass.DeleteTargetAppsByID(ID);
                UserLogin lu      = new UserLogin();
                lu = (UserLogin)System.Web.HttpContext.Current.Session["User"];
                MyScheduler.SetTimer(lu.ID);
            }
            catch (Exception ex)
            {
            }
        }
コード例 #7
0
        public void SaveTargetApps()
        {
            StreamReader maReader = new StreamReader(Request.InputStream);
            string       strOBJ   = maReader.ReadToEnd();
            dynamic      dData    = (dynamic)JsonConvert.DeserializeObject(strOBJ);

            try
            {
                int ID = Convert.ToInt32(dData.JsonForm.ID);

                TargetApps u = new TargetApps();
                u.ID           = ID;
                u.Name         = dData.JsonForm.Name.ToString();
                u.IntervalType = dData.JsonForm.IntervalType.ToString();
                u.TargetUrl    = dData.JsonForm.TargetUrl.ToString();
                u.TimeInterval = Convert.ToInt32(dData.JsonForm.TimeInterval);
                u.UserLoginID  = ((UserLogin)System.Web.HttpContext.Current.Session["User"]).ID;

                Uri  uriResult;
                bool result = Uri.TryCreate(u.TargetUrl, UriKind.Absolute, out uriResult) &&
                              (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);

                if (!result)
                {
                    return;
                }

                if (ID == 0)
                {
                    WebApiServiceClass.NewTargetApps(u);
                }
                else
                {
                    WebApiServiceClass.UpdateTargetApps(u);
                }
                UserLogin lu = new UserLogin();
                lu = (UserLogin)System.Web.HttpContext.Current.Session["User"];

                MyScheduler.SetTimer(lu.ID);
            }
            catch (Exception ex)
            {
            }
        }
コード例 #8
0
ファイル: LoginController.cs プロジェクト: WishneSoda/pushex
        // GET: Login

        public ActionResult Login(UserLogin ul)
        {
            System.Web.HttpContext.Current.Session["IsLogin"] = false;
            System.Web.HttpContext.Current.Session["User"]    = null;
            if (String.IsNullOrEmpty(ul.UserName) && String.IsNullOrEmpty(ul.UserPassword))
            {
            }
            else
            {
                string TokenJson = WebApiServiceClass.GetAPIToken(ul.UserName, ul.UserPassword);

                var UserLogin = WebApiServiceClass.GetLoginUser(ul.UserName, ul.UserPassword);

                UserLogin UserLoginList = JsonConvert.DeserializeObject <UserLogin>(UserLogin);
                if (UserLoginList != null)
                {
                    System.Web.HttpContext.Current.Session["User"] = UserLoginList;
                    return(Redirect(Url.Content("/Login/Home")));
                }
            }
            return(View());
        }