Exemple #1
0
        public ActionResult TrackNumInit()
        {
            try
            {
                string        defWHID   = string.Empty;
                List <APP_WH> appWHList = null;

                APP_USERS_BLL userBLL = new APP_USERS_BLL();
                string        appUser = Session[CHubConstValues.SessionUser].ToString();
                APP_USERS     user    = userBLL.GetAppUserByDomainName(appUser);
                defWHID = user.DEF_WH_ID;

                APP_WH_BLL whBLL = new APP_WH_BLL();
                appWHList = whBLL.GetAppWHList();

                var obj = new
                {
                    defWHID   = defWHID,
                    appWHList = appWHList
                };
                return(Json(new RequestResult(obj)));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("TrackNumInit", ex);
                return(Json(new RequestResult(false, ex.Message)));
            }
        }
Exemple #2
0
        public ActionResult SendSample(string id)
        {
            try
            {
                string toAddr  = string.Empty;
                string appUser = Session[CHubConstValues.SessionUser].ToString();

                if (IsTooOften(id, appUser))
                {
                    return(Json(new RequestResult(false, "Too Frequent,Need 10 minites interval")));
                }

                APP_USERS_BLL userBLL = new APP_USERS_BLL();
                APP_USERS     user    = userBLL.GetAppUserByDomainName(appUser);
                if (user == null)
                {
                    return(Json(new RequestResult(false, "Can't find User:"******"RunJobs", ex);
                return(Json(new RequestResult(false, ex.Message)));
            }
        }
Exemple #3
0
        public ActionResult Init()
        {
            try
            {
                string        defWHID   = string.Empty;
                List <APP_WH> appWHList = null;
                //List<RP_WAYBILL_TYPE> whTypeList = null;
                List <DistinctCarCode> carCodeList = null;

                APP_USERS_BLL userBLL = new APP_USERS_BLL();
                string        appUser = Session[CHubConstValues.SessionUser].ToString();
                APP_USERS     user    = userBLL.GetAppUserByDomainName(appUser);
                defWHID = user.DEF_WH_ID;

                APP_WH_BLL whBLL = new APP_WH_BLL();
                appWHList = whBLL.GetAppWHList();


                //RP_WAYBILL_TYPE_BLL typeBLL = new RP_WAYBILL_TYPE_BLL();
                //whTypeList = typeBLL.GetWayBillType();

                RP_CAR_MST_BLL carBLL = new RP_CAR_MST_BLL();
                carCodeList = carBLL.GetDistinctCarCode();

                var obj = new
                {
                    defWHID     = defWHID,
                    appWHList   = appWHList,
                    carCodeList = carCodeList
                };
                return(Json(new RequestResult(obj)));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("RP index Init", ex);
                return(Json(new RequestResult(false, ex.Message)));
            }
        }
Exemple #4
0
        public ActionResult Login(LoginViewModel model, string returnUrl)
        {
            APP_USERS appUser = DomainUserAuth.IsAuthenticated("CED", model.UserName, model.Password);

            if (appUser != null)
            {
                //FormsAuthentication.SetAuthCookie(model.UserName, true);

                var claims = new List <Claim>();
                claims.Add(new Claim(ClaimTypes.Name, appUser.FIRST_NAME));
                claims.Add(new Claim(ClaimTypes.Email, appUser.EMAIL_ADDR));
                claims.Add(new Claim(ClaimTypes.NameIdentifier, model.UserName));

                ClaimsIdentity cIdentity = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
                AuthenticationManager.SignIn(new AuthenticationProperties()
                {
                    IsPersistent = false
                }, cIdentity);

                APP_USERS_BLL userBLL = new APP_USERS_BLL();
                APP_USERS     user    = userBLL.GetAppUserByDomainName(model.UserName);

                if (user == null)
                {
                    if (!userBLL.AddAppUserWithRole(model.UserName, appUser.FIRST_NAME, appUser.EMAIL_ADDR))
                    {
                        throw new Exception("Fail to add App User");
                    }
                    user = userBLL.GetAppUserByDomainName(model.UserName);
                }
                Session[CHubConstValues.SessionUser] = user.APP_USER;
                LogHelper.WriteLog("log in action, user: " + user.APP_USER);
                return(RedirectToLocal(returnUrl));
            }

            //not success remail login page
            return(View());
        }