Пример #1
0
        public static ResponseJson Send(string to, string subject, string body)
        {
            ResponseJson response = new ResponseJson();

            try
            {
                MailMessage mail = new MailMessage();
                mail.To.Add(to);
                mail.From    = new MailAddress("*****@*****.**");
                mail.Subject = subject;
                string Body = body;
                mail.Body       = Body;
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.gmail.com";
                smtp.Port = 587;
                smtp.UseDefaultCredentials = false;
                smtp.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "NsVtEa1&Ei+iGbZK");// Enter seders User name and password
                smtp.EnableSsl             = true;
                smtp.Send(mail);
            }
            catch (Exception e)
            {
                response.IsError = true;
                response.Id      = -6;
            }
            return(response);
        }
        public ActionResult Get(Page model)
        {
            ResponseJson response = new ResponseJson()
            {
                Data = new List <object>()
            };
            var data = new Pagger <dynamic>();

            using (AppDB db = new AppDB())
            {
                response = IEnumerableData.GetPageResponse <BundleModel>(model, (from b in db.Bundles
                                                                                 join s in db.Styles on b.StyleId equals s.Id
                                                                                 join st in db.Status on b.Status equals st.Id
                                                                                 join o in db.Employees on b.OperatorId equals o.Id
                                                                                 join l in db.Employees on b.LinkingBy equals l.Id
                                                                                 where b.Status == 2
                                                                                 select new BundleModel()
                {
                    BarCode = b.BarCode,
                    Style = s.Name,
                    StyleId = b.StyleId,
                    Id = b.Id,
                    Quantity = b.Quantity,
                    Status = st.Name,
                    StatusId = st.Id,
                    KnittingMachine = b.KnittingMachine,
                    LinkingEndAt = b.LinkingEndAt,
                    OperatorId = b.OperatorId,
                    Operator = o.Name,
                    LinkingBy = l.Name,
                    LinkingById = l.Id
                }));
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public IEnumerable <ResponseJson> NewMove(int idGame, int idMove, int idPlayer, int idRound)
        {
            ResponseJson     response = null;
            InitializeClient client   = new InitializeClient(new InitializeClient.EndpointConfiguration());

            try
            {
                var task = client.NewMoveAsync(idGame, idMove, idPlayer, idRound);
                task.Wait();
                if (task.IsCompletedSuccessfully)
                {
                    response = task.Result;
                }
                else
                {
                    response = new ResponseJson {
                        Code = -1, Message = "Cannot insert move"
                    }
                };
            }
            catch (Exception e)
            {
                client.LogErrorAsync(e.StackTrace);
                response = new ResponseJson {
                    Code = -10, Message = "An error has ocurred, please try it later"
                };
            }
            finally
            {
                client.LogsAsync("NewMove", "{'idGame':'" + idGame + "','idMove':'" + idMove + "','idPlayer':'" + idPlayer + "','idRound','" + idRound + "'}", ParseObjectToJson(response));
            }
            return(ToEnumerable <ResponseJson>(response));
        }
Пример #4
0
        public ActionResult Put(int id, [FromBody] CmArticlecategories model)
        {
            ResponseJson <CmArticlecategories> rdata = new ResponseJson <CmArticlecategories>();

            try
            {
                if (!bll.Exists(model))
                {
                    rdata.Code = 500;
                    rdata.Msg  = "数据不存在";
                }
                else
                {
                    if (!bll.Update(model))
                    {
                        rdata.Code = 500;
                        rdata.Msg  = "保存失败";
                    }
                }
            }
            catch (Exception ex)
            {
                rdata.Code = 500;
                rdata.Msg  = ex.Message;
            }
            return(Json(rdata));
        }
Пример #5
0
        //GET: api/xs/5
        //[HttpGet("{id}")]
        public ActionResult <ResponseJson> Get(long id)
        {
            Service <jw_xs_bj> xbService = new Service <jw_xs_bj>();
            Service <jw_bj>    bService  = new Service <jw_bj>();
            ResponseJson       json      = new ResponseJson();
            var            ids           = xbService.GetList(o => o.xsid == id).Select(o => o.bjid).Distinct().ToList();
            List <dynamic> bjs           = new List <dynamic>();

            foreach (var m in bService.GetList())
            {
                bjs.Add(new
                {
                    m.id,
                    m.bjname,
                    selected = ids.Contains(m.id) ? 1 : 0
                });
            }
            json.Data = new
            {
                Xs  = service.GetModel(id),
                Bjs = bjs
            };
            json.Count = 1;
            return(json);
        }
Пример #6
0
        public Message GetUser(String userID)
        {
            ResponseJson <GetUserResponse> json = new ResponseJson <GetUserResponse>();
            WebOperationContext            ctx  = WebOperationContext.Current;

            ctx.OutgoingResponse.StatusCode = HttpStatusCode.OK;

            try
            {
                var user = this.AccountService.GetUser(Convert.ToInt32(userID));
                if (user == null)
                {
                    throw new BusinessException("用户不存在!");//The user is not exist!
                }
                json.Data = new GetUserResponse()
                {
                    LoginName = user.LoginName,
                    UserID    = user.ID
                };
            }
            catch (Exception ex)
            {
                json.Status  = false;
                json.Message = ex.Message;
            }

            return(ctx.CreateJsonResponse <ResponseJson <GetUserResponse> >(json));
        }
Пример #7
0
        public ActionResult <ResponseJson> changeMenuRights([FromBody] Dtos.RoleRights model)
        {
            ResponseJson           json      = new ResponseJson();
            Service <cm_role_menu> rmService = new Service <cm_role_menu>();
            var havedMenus = rmService.GetList(o => o.roleId == model.RoleId);

            rmService.Context.Db.BeginTran();
            try
            {
                List <dynamic> ids = new List <dynamic>();
                foreach (var o in havedMenus.Where(w =>
                                                   model.Rights.Where(t => t.Selected == false).Select(t => t.ResourceId).Contains(w.menuId)))
                {
                    ids.Add(o.id);
                }
                rmService.DeleteList(ids);
                var tids = model.Rights.Where(w => w.Selected).Select(o => o.ResourceId).Except(havedMenus.Select(o => o.menuId)).ToList();
                foreach (var o in tids)
                {
                    rmService.Insert(new cm_role_menu
                    {
                        menuId = o,
                        roleId = model.RoleId
                    });
                }
                rmService.Context.Db.CommitTran();
            }
            catch
            {
                json.Code = "500";
                json.Msg  = "授权失败!";
                rmService.Context.Db.RollbackTran();
            }
            return(json);
        }
Пример #8
0
        public ActionResult <ResponseJson> Post([FromBody] Dtos.UserRoles model)
        {
            Service <cm_user_role> urService = new Service <cm_user_role>();
            ResponseJson           json      = new ResponseJson();

            try
            {
                service.Context.Db.BeginTran();
                model.User.joinTime = DateTime.Now;
                long uid = service.Context.Db.Insertable(model.User).ExecuteReturnIdentity();
                if (uid > 0)
                {
                    foreach (var roleId in model.Roles)
                    {
                        urService.Insert(new cm_user_role
                        {
                            userId = uid,
                            roleId = roleId
                        });
                    }
                }
                service.Context.Db.CommitTran();
            }
            catch
            {
                json.Code = "500";
                json.Msg  = "新建账号失败!";
                service.Context.Db.RollbackTran();
            }
            return(json);
        }
Пример #9
0
        /// <summary>
        /// User's team list page.
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            ResponseJson <IEnumerable <UserTeamDTO> > list = WebUtils.Get <IEnumerable <UserTeamDTO> >(string.Format("{0}/{1}/{2}", ApiServer, "api/UserTeam", Session["userid"]), GetCookieToken());
            IEnumerable <TeamViewModel> teamList           = null;

            if (list.Status)
            {
                teamList = list.Data.Select(t => new TeamViewModel
                {
                    UserId          = t.UserId,
                    TeamId          = t.TeamId,
                    TeamName        = t.TeamName,
                    TeamDescription = t.TeamDescription,
                    RoleId          = t.RoleId,
                    RoleDescription = t.RoleDescription
                });
            }
            var team = teamList == null ? new TeamViewModel()
            {
            } : teamList.First();

            ViewBag.TeamName = team.TeamName;
            ViewBag.TeamId   = team.TeamId;
            ViewBag.FileList = null;
            return(View(teamList));
        }
Пример #10
0
        /// <summary>
        /// 下线接口
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseJson <string> FuelGasOffline([FromBody] FuelGasMsgModel model)
        {
            ResponseJson <string> json = null;

            try
            {
                if (model != null)
                {
                    Utility.WriteLog(JsonConvert.SerializeObject(model), "燃气" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                    Random rd = new Random();
                    model.randomNum  = rd.Next().ToString();
                    model.actionType = "FuelGas_Handle";
                    //写入redis中
                    string key = string.Format("{0}:{1}:{2}", model.deviceNumber, model.deviceType, model.randomNum);
                    bool   sdf = redis.HashSet(RedisKey, key, JsonConvert.SerializeObject(model));
                    Utility.WriteLog("获取token", "燃气" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                    json = new ResponseJson <string>(ResponseCode.Nomal, "成功");
                }
            }
            catch (Exception ex)
            {
                return(json = new ResponseJson <string>(ResponseCode.Err, ex.Message));

                throw;
            }
            return(json);
        }
Пример #11
0
        //[ValidateAntiForgeryToken]
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            ResponseJson response = new ResponseJson();

            try
            {
                if (ModelState.IsValid)
                {
                    using (UserDB db = new UserDB())
                    {
                        var user = db.LogIn(model.UserName, Globals.Encrypt(model.Password)).SingleOrDefault();
                        if (user != null)
                        {
                            await SignInAsync(new ApplicationUser()
                            {
                                UserName = model.UserName
                            }, model.RememberMe);

                            //return RedirectToLocal(returnUrl);
                        }
                        else
                        {
                            response.IsError = true;
                            response.Id      = -3;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                response.IsError = true;
                response.Id      = -6;
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Пример #12
0
    public static void ParseHiddenMoves(ResponseBase _in, ResponseJson rj)
    {
        string[] content = rj.hidden_moves;
        if (_in is HiddenMoveGoSetupResponse)
        {
            ((HiddenMoveGoSetupResponse)_in).hiddens = new List <Move>();
            ((HiddenMoveGoSetupResponse)_in).colors  = new List <int>();
        }
        if (_in is HiddenMoveGoGameResponse)
        {
            ((HiddenMoveGoGameResponse)_in).hiddens = new List <Move>();
            ((HiddenMoveGoGameResponse)_in).colors  = new List <int>();
        }
        for (int i = 0; i < content.Length; i++)
        {
            string[] sss   = content[i].Split('#');
            int      x     = int.Parse(sss[0]);
            int      y     = int.Parse(sss[1]);
            int      color = int.Parse(sss[2]);

            if (_in is HiddenMoveGoSetupResponse)
            {
                ((HiddenMoveGoSetupResponse)_in).hiddens.Add(new Move(x, y));
                ((HiddenMoveGoSetupResponse)_in).colors.Add(color);
            }
            if (_in is HiddenMoveGoGameResponse)
            {
                ((HiddenMoveGoGameResponse)_in).hiddens.Add(new Move(x, y));
                ((HiddenMoveGoGameResponse)_in).colors.Add(color);
            }
        }
    }
Пример #13
0
        public string GetSelectPage(int flag)
        {
            string json = "";

            switch (flag)
            {
            case 1:
                List <Sys_User> list       = this._userService.Entities();
                List <List>     listResult = new List <List>();
                foreach (Sys_User item in list)
                {
                    listResult.Add(new List
                    {
                        id   = item.Id,
                        desc = item.UserName
                    });
                }
                json = ResponseJson.Success(JsonUtil.SerializerObject(listResult), "SUCCESS");
                break;

            default:
                break;
            }
            return(json);
        }
        public ActionResult Get(Page model)
        {
            ResponseJson response = new ResponseJson()
            {
                Data = new List <object>()
            };

            using (AppDB db = new AppDB())
            {
                response = IEnumerableData.GetPageResponse <OrderModel>(model, (from o in db.Orders
                                                                                join b in db.Buyers on o.BuyerId equals b.Id
                                                                                where o.Status != 10
                                                                                select new OrderModel()
                {
                    Id = o.Id,
                    Buyer = b.Name,
                    BuyerId = o.BuyerId,
                    CodeNumber = o.CodeNumber,
                    Color = o.Color,
                    DeliveryDate = o.DeliveryDate,
                    Description = o.Description,
                    Size = o.Size,
                    Style = o.Style,
                    Quantity = o.TotalQuantity,
                    Completed = o.TotalCompleted,
                    ProductionStartAT = o.ProductionStartAT,
                    OrderDate = o.OrderDate,
                    CurrentDate = DateTime.Now
                }).ToList());
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Пример #15
0
 public void AddHostJob(string jobHostSite, int jobId, string jobName, Action success, Action error)
 {
     Task.Factory.StartNew(() =>
     {
         try
         {
             bool isSuccess = false;
             var respResult = HttpHelper.SendPost(jobHostSite + "/ScheduleHostService/AddJob?jobId=" + jobId + "&jobName=" + jobName, "");
             if (!string.IsNullOrEmpty(respResult))
             {
                 ResponseJson respJson = Newtonsoft.Json.JsonConvert.DeserializeObject <ResponseJson>(respResult);
                 if (respJson.Code == 1)
                 {
                     isSuccess = true;
                 }
             }
             if (isSuccess)
             {
                 success?.Invoke();
             }
             else
             {
                 error?.Invoke();
             }
         }
         catch (Exception ex)
         {
             Log4NetHelper.WriteExcepetion(ex);
             error?.Invoke();
         }
     });
 }
Пример #16
0
        public ActionResult <ResponseJson> Get(long id)
        {
            Service <cm_user_role> urService = new Service <cm_user_role>();
            Service <cm_role>      rService  = new Service <cm_role>();
            ResponseJson           json      = new ResponseJson();
            var            ids   = urService.GetList(o => o.userId == id).Select(o => o.roleId).Distinct().ToList();
            List <dynamic> roles = new List <dynamic>();

            foreach (var m in rService.GetList())
            {
                roles.Add(new
                {
                    m.id,
                    m.name,
                    selected = ids.Contains(m.id) ? 1 : 0
                });
            }
            json.Data = new
            {
                User  = service.GetModel(id),
                Roles = roles
            };
            json.Count = 1;
            return(json);
        }
Пример #17
0
        public ActionResult <ResponseJson> changeMenuRights([FromBody] Dtos.BjRights model)
        {
            ResponseJson       json      = new ResponseJson();
            Service <jw_xs_bj> xbService = new Service <jw_xs_bj>();
            var havedMenus = xbService.GetList(o => o.bjid == model.bjid);

            xbService.Context.Db.BeginTran();
            try
            {
                List <dynamic> ids = new List <dynamic>();
                foreach (var o in havedMenus.Where(w =>
                                                   model.Rights.Where(t => t.Selectted == false).Select(t => t.ResourcetId).Contains(w.bjid)))
                {
                    ids.Add(o.id);
                }
                xbService.DeleteList(ids);
                var tids = model.Rights.Where(w => w.Selectted).Select(o => o.ResourcetId).Except(havedMenus.Select(o => o.bjid)).ToList();
                foreach (var o in tids)
                {
                    xbService.Insert(new jw_xs_bj
                    {
                        xsid = o,
                        bjid = model.bjid
                    });
                }
                xbService.Context.Db.CommitTran();
            }
            catch
            {
                json.Code = "500";
                json.Msg  = "授权失败!";
                xbService.Context.Db.RollbackTran();
            }
            return(json);
        }
Пример #18
0
        public string DeleteFile(string fileName)
        {
            try
            {
                //调用文件服务
                ServiceFileClient.ServiceFileClient client = new ServiceFileClient.ServiceFileClient();
                CustomFileInfo customFileInfo = new CustomFileInfo();
                customFileInfo.NewName = fileName;

                customFileInfo = client.DeleteFile(customFileInfo);

                if (customFileInfo.State == 0)
                {
                    return(ResponseJson.Success(customFileInfo, "删除成功"));
                }
                else
                {
                    return(ResponseJson.Error("删除失败"));
                }
            }
            catch (Exception ex)
            {
                return(ResponseJson.Error(ex.Message));
            }
        }
Пример #19
0
        private GameControllerModel InsertPlayer(string player, InitializeClient client, int idGame = 0)
        {
            GameControllerModel response = null;

            try
            {
                var task = client.NewPlayerAsync(player, idGame);
                task.Wait();
                if (task.IsCompletedSuccessfully)
                {
                    ResponseJson responseJson = task.Result;
                    response = ParseJsonToObject <GameControllerModel>(responseJson.Json);
                }
                else
                {
                    response = new GameControllerModel {
                        Code = -1, Message = "Cannot get move´s list"
                    }
                };
            }
            catch (Exception e)
            {
                client.LogErrorAsync(e.StackTrace);
                response = new GameControllerModel {
                    Code = -10, Message = "An error has ocurred, please try it later"
                };
            }
            return(response);
        }
Пример #20
0
        public ActionResult <ResponseJson> Post([FromBody] Dtos.XsBj model)
        {
            Service <jw_xs_bj> xbService = new Service <jw_xs_bj>();
            ResponseJson       json      = new ResponseJson();

            try
            {
                service.Context.Db.BeginTran();
                model.Xs.joinTime = DateTime.Now;
                long xid = service.Context.Db.Insertable(model.Xs).ExecuteReturnIdentity();
                if (xid > 0)
                {
                    foreach (var bjid in model.Bjs)
                    {
                        xbService.Insert(new jw_xs_bj
                        {
                            xsid = xid,
                            bjid = bjid
                        });
                    }
                }
                service.Context.Db.CommitTran();
            }
            catch
            {
                json.Code = "500";
                json.Msg  = "新建账号失败!";
                service.Context.Db.RollbackTran();
            }
            return(json);
        }
Пример #21
0
        public IEnumerable <ResponseJson> GetDetailsScore(int idPlayer)
        {
            ResponseJson     response = null;
            InitializeClient client   = new InitializeClient(new InitializeClient.EndpointConfiguration());

            try
            {
                var task = client.GetGameDetailScoreAsync(idPlayer);
                task.Wait();
                if (task.IsCompletedSuccessfully)
                {
                    response = task.Result;
                }
                else
                {
                    response = new ResponseJson {
                        Code = -1, Message = "Cannot get game´s detail"
                    }
                };
            }
            catch (Exception e)
            {
                client.LogErrorAsync(e.StackTrace);
                response = new ResponseJson {
                    Code = -10, Message = "An error has ocurred, please try it later"
                };
            }
            finally
            {
                client.LogsAsync("GetDetailsScore", "{'idPlayer':'" + idPlayer + "'}", ParseObjectToJson(response));
            }
            return(ToEnumerable <ResponseJson>(response));
        }
Пример #22
0
        public IEnumerable <ResponseJson> GetMoves()
        {
            ResponseJson     response = null;
            InitializeClient client   = new InitializeClient(new InitializeClient.EndpointConfiguration());

            try
            {
                var task = client.GetMovesAsync();
                task.Wait();
                if (task.IsCompletedSuccessfully)
                {
                    response = task.Result;
                }
                else
                {
                    response = new ResponseJson {
                        Code = -1, Message = "Cannot get move´s list"
                    }
                };
            }
            catch (Exception e)
            {
                client.LogErrorAsync(e.StackTrace);
                response = new ResponseJson {
                    Code = -10, Message = "An error has ocurred, please try it later"
                };
            }
            finally
            {
                client.LogsAsync("GetMoves", "", ParseObjectToJson(response));
            }
            return(ToEnumerable <ResponseJson>(response));
        }
Пример #23
0
        public ActionResult Get(Page model)
        {
            ResponseJson response = new ResponseJson()
            {
                Data = new List <object>()
            };

            using (AppDB db = new AppDB())
            {
                var currentRole = db.Roles.Where(r => CurrentUser.Roles.Contains(r.Code)).Min(r => r.Priority);
                response = IEnumerableData.GetPageResponse <EmployeeModel>(model, (from b in db.Employees
                                                                                   join
                                                                                   r in db.Roles on b.Role equals r.Code
                                                                                   where r.Priority > currentRole
                                                                                   select new EmployeeModel()
                {
                    Id = b.Id,
                    BarCode = b.BarCode,
                    Name = b.Name,
                    Phone = b.Phone,
                    Email = b.Email,
                    Address = b.Address,
                    Role = r.Name,
                    CreatedAt = b.CreatedAt,
                    IsActive = b.IsActive
                }));
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Пример #24
0
        public ActionResult Post([FromBody] CmArticlecategories model)
        {
            ResponseJson <CmArticlecategories> rdata = new ResponseJson <CmArticlecategories>();

            try
            {
                if (bll.Exists(model))
                {
                    rdata.Code = 500;
                    rdata.Msg  = "数据已存在,不能重复添加";
                }
                else
                {
                    if (bll.Add(model) <= 0)
                    {
                        rdata.Code = 500;
                        rdata.Msg  = "保存失败";
                    }
                }
            }
            catch (Exception ex)
            {
                rdata.Code  = 500;
                rdata.Msg   = ex.Message;
                rdata.Count = 0;
            }
            return(Json(rdata));
        }
Пример #25
0
        public ActionResult Get(Page model)
        {
            ResponseJson response = new ResponseJson()
            {
                Data = new List <object>()
            };
            var data = new Pagger <dynamic>();

            using (AppDB db = new AppDB())
            {
                response = IEnumerableData.GetPageResponse <StyleModel>(model, (from s in db.Styles
                                                                                join b in db.Buyers on s.BuyerId equals b.Id
                                                                                join st in db.Status on s.Status equals st.Id
                                                                                select new StyleModel()
                {
                    BarCode = s.BarCode,
                    Buyer = b.Name,
                    BuyerId = s.BuyerId,
                    Id = s.Id,
                    Name = s.Name,
                    Quantity = s.Quantity,
                    Status = st.Name,
                    StatusId = st.Id,
                    ShippingDate = s.ShippingDate,
                    Description = s.Description,
                    YarnType = s.YarnType,
                    Size = s.Size,
                }));
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Пример #26
0
        public ActionResult <ResponseJson> Get(long id)//取得单条数据
        {
            ResponseJson json = new ResponseJson();

            json.Data = service.GetModel(o => o.id == id);
            return(json);
        }
Пример #27
0
    /// <summary>
    /// 获得当前班级成绩列表
    /// </summary>
    /// <returns></returns>
    public IEnumerator getScoreList()
    {
        KeyValue[] kvs = new KeyValue[2];
        kvs[0] = new KeyValue("stuId", sin.id);
        kvs[1] = new KeyValue("classId", currentClassId);

        UnityWebRequest uw = wsb.PostWithParams(servelets.queryScore, kvs);

        yield return(uw.Send());

        string jsonData = uw.downloadHandler.text;

        Debug.Log(jsonData);
        if (!uw.isNetworkError && jsonData.Contains("name"))
        {
            ResponseJson rj = JsonConvert.DeserializeObject <ResponseJson>(jsonData);
            Debug.Log(rj.data.ToString());
            ScoreList[] rcs = JsonConvert.DeserializeObject <ScoreList[]>(rj.data.ToString());
            for (int i = 0; i < rcs.Length; i++)
            {
                InstantiateReportList(rcs[i].name, rcs[i].submission_time, rcs[i].testpaper_student_score);
            }
        }
        else
        {
            StartCoroutine(requestFailed("没有查询到成绩!"));
        }
    }
Пример #28
0
        /// <summary>
        /// Index page.
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            string cookie = GetCookieToken();

            if (!string.IsNullOrEmpty(cookie))
            {
                ResponseJson <LoginUserInfo> result = _Login(new LoginDTO {
                }, cookie);
                if (!result.Status)
                {
                    return(View());
                }

                if (!string.IsNullOrEmpty(result.Data.AuthToken))
                {
                    Session["userid"]   = result.Data.ID;
                    Session["UserData"] = result.Data;
                    return(View(new UserViewModel {
                        ID = result.Data.ID, Name = result.Data.Name
                    }));
                }

                return(View());
            }
            return(View());
        }
        public ActionResult Details(Guid id)
        {
            ResponseJson response = new ResponseJson();

            using (AppDB db = new AppDB())
            {
                response.Data = (from o in db.Orders
                                 join b in db.Buyers on o.BuyerId equals b.Id
                                 where o.Status != 10
                                 select new OrderModel()
                {
                    Id = b.Id,
                    Buyer = b.Name,
                    BuyerId = o.BuyerId,
                    CodeNumber = o.CodeNumber,
                    Color = o.Color,
                    DeliveryDate = o.DeliveryDate,
                    Description = o.Description,
                    Size = o.Size,
                    Style = o.Style,
                    Quantity = o.TotalQuantity,
                    Completed = o.TotalCompleted,
                    ProductionStartAT = o.ProductionStartAT,
                    CurrentDate = DateTime.Now
                }).ToList();
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Пример #30
0
        public JsonResult AjaxCall()
        {
            ResponseJson response = new ResponseJson();

            response.IsError = true;
            response.Id      = -10;
            return(Json(response, JsonRequestBehavior.AllowGet));
        }