Example #1
0
        public static MyResult IsApprovalSettlement(string PKID)
        {
            MyResult result = new MyResult();

            result.result = true;
            try
            {
                IParkSettlement     factory    = ParkSettlementFactory.GetFactory();
                ParkSettlementModel settlelist = factory.GetMaxPriodSettlement(PKID);
                if (settlelist != null)
                {
                    if (settlelist.SettleStatus != 2 && settlelist.SettleStatus != -1)
                    {
                        //结算单还在审批中 不能建立新的结算单
                        result.msg    = "帐期:" + settlelist.Priod + " 的结算单正在审批中 不能创建新的结算单";
                        result.result = false;
                        return(result);
                    }
                }
            }
            catch
            {
                result.msg    = "其它错误";
                result.result = false;
                return(result);
            }
            return(result);
        }
Example #2
0
        public JsonResult SavePassRemark()
        {
            try
            {
                BasePassRemark model = new BasePassRemark();
                model.PKID     = Request.Params["ParkingID"];
                model.Remark   = Request.Params["Remark"];
                model.PassType = (PassRemarkType)int.Parse(Request.Params["PassType"].ToString());

                bool result = PassRemarkServices.Add(model);
                if (!result)
                {
                    throw new MyException("保存放行备注失败");
                }
                return(Json(MyResult.Success()));
            }
            catch (MyException ex) {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "保存放行备注失败");
                return(Json(MyResult.Error("保存放行备注失败")));
            }
        }
Example #3
0
        //[CheckPurview(Roles = "PK01020103")]
        public JsonResult SaveCarTypeSingle(ParkCarTypeSingle model)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(model.CarTypeID))
                {
                    throw new MyException("获取车类编号失败");
                }
                if (string.IsNullOrWhiteSpace(model.SingleID))
                {
                    throw new MyException("获取编号失败");
                }

                bool result = ParkCarTypeSingleServices.Update(model);
                if (!result)
                {
                    throw new MyException("保存失败");
                }
                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "保存单双车牌配置失败");
                return(Json(MyResult.Error("保存单双车牌配置失败")));
            }
        }
Example #4
0
        //[CheckPurview(Roles = "PK01020103")]
        public JsonResult GetCarTypeSingle(string carTypeId)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(carTypeId))
                {
                    throw new MyException("获取车类编号失败");
                }
                List <ParkCarTypeSingle> models = ParkCarTypeSingleServices.QueryParkCarTypeByCarTypeID(carTypeId);
                if (models.Count == 0)
                {
                    ParkCarTypeSingleServices.AddDefault(carTypeId);
                }
                models = ParkCarTypeSingleServices.QueryParkCarTypeByCarTypeID(carTypeId);
                if (models.Count == 0)
                {
                    throw new MyException("获取单双车牌配置失败");
                }

                return(Json(MyResult.Success("获取成功", models)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取单双车牌配置失败");
                return(Json(MyResult.Error("获取单双车牌配置失败")));
            }
        }
        private MyResult <object> CheckToken(string token, string sign)
        {
            MyResult <object> result = new MyResult <object>();

            try
            {
                //sign==
                if (!SecurityUtil.ValidSign(sign, token, Constants.Key))
                {
                    return(result.SetStatus(ErrorCode.ReLogin, "sign error 请联系管理员"));
                }
                //token==
                string json = DataProtectionUtil.UnProtect(token);
                if (string.IsNullOrEmpty(json))
                {
                    return(result.SetStatus(ErrorCode.ReLogin, "token error 请重新登录"));
                }
                TokenModel = json.GetModel <TokenModel>();
                if (TokenModel == null)
                {
                    return(result.SetStatus(ErrorCode.InvalidToken, "非法token"));
                }
                if (TokenModel.Id < 1)
                {
                    return(result.SetStatus(ErrorCode.InvalidToken, "无效token"));
                }
            }
            catch (System.Exception ex)
            {
                return(result.SetStatus(ErrorCode.SystemError, $"请求失败{ex.Message}"));
            }
            return(result);
        }
Example #6
0
 public JsonResult SaveUpdate(ParkCarType model)
 {
     try
     {
         UpdateParkCarTypeDefault(model);
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.CarTypeID))
         {
             result = ParkCarTypeServices.Add(model);
             if (!result)
             {
                 throw new MyException("添加失败");
             }
             return(Json(MyResult.Success()));
         }
         else
         {
             result = ParkCarTypeServices.Update(model);
             if (!result)
             {
                 throw new MyException("修改失败");
             }
             return(Json(MyResult.Success()));
         }
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存车类型信息失败");
         return(Json(MyResult.Error("保存车类型信息失败")));
     }
 }
Example #7
0
 public JsonResult SaveEdit(BWYGateMapping model)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.RecordID))
         {
             model.DataSource = 0;
             result           = BWYGateMappingServices.Add(model);
             if (!result)
             {
                 throw new MyException("添加失败");
             }
             return(Json(MyResult.Success()));
         }
         else
         {
             result = BWYGateMappingServices.Update(model);
             if (!result)
             {
                 throw new MyException("修改失败");
             }
             return(Json(MyResult.Success()));
         }
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存岗亭信息失败");
         return(Json(MyResult.Error("保存岗亭信息失败")));
     }
 }
Example #8
0
        /// <summary>
        /// 店铺列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public MyResult <object> GetShopList(ShopModel model)
        {
            MyResult result = new MyResult();
            var      sql    = $"SELECT s.id,userId,s.`status`,title,s.phoneNum, s.createTime,u.nickName from shop s LEFT JOIN `user`  u on s.userId = u.id where 1=1";

            if (!string.IsNullOrEmpty(model.NickName))
            {
                sql = sql + $" and u.nickName  like '%{model.NickName}%'";
            }
            if (!string.IsNullOrEmpty(model.PhoneNum))
            {
                sql = sql + $" and s.phoneNum like '%{model.PhoneNum}%'";
            }
            if (model.Status >= 0)
            {
                sql = sql + $" and s.`status` = {model.Status} ";
            }
            var query = base.dbConnection.Query <ShopModel>(sql).AsQueryable();

            query              = query.Pages(model.PageIndex, model.PageSize, out int count, out int pageCount);
            result.Data        = query;
            result.RecordCount = count;
            result.PageCount   = pageCount;
            return(result);
        }
Example #9
0
        public async Task <MyResult> DeleteNoteAsync(long id)
        {
            MyResult _MyResult = new MyResult {
                IsSuccess = false, Message = ""
            };

            try
            {
                SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Common.Common.DB_NAME);
                var note = await conn.Table <Note>().Where(x => x.Id == id).FirstOrDefaultAsync();

                if (note != null)
                {
                    await conn.DeleteAsync(note);

                    _MyResult.IsSuccess = true;
                    _MyResult.Message   = "Note deleted successfully";
                }
                else
                {
                    _MyResult.IsSuccess = false;
                    _MyResult.Message   = "Invalid note selected.";
                }
            }
            catch (Exception ex)
            {
                _MyResult.IsSuccess = false;
                _MyResult.Message   = ex.Message;
            }

            return(_MyResult);
        }
Example #10
0
 public JsonResult PublishMenu(string companyId)
 {
     try
     {
         WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(companyId);
         if (config == null || string.IsNullOrWhiteSpace(config.AppId) || string.IsNullOrWhiteSpace(config.AppSecret) ||
             string.IsNullOrWhiteSpace(config.SystemName))
         {
             throw new MyException("获取微信基础信息失败,请确认微信基础信息已配置");
         }
         var accessToken = AccessTokenContainer.TryGetToken(config.AppId, config.AppSecret, false);
         var buttonGroup = ToButtonGroup(WXMenuServices.GetMenus(companyId));
         TxtLogServices.WriteTxtLogEx("PublishMenu", JsonHelper.GetJsonString(buttonGroup));
         var result = WxApi.CreateMenu(companyId, accessToken, buttonGroup);
         if (!result)
         {
             throw new MyException("发布菜单失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "发布菜单失败");
         return(Json(MyResult.Error("发布菜单失败")));
     }
 }
Example #11
0
        //ambil api dari easy go API
        private async Task <MyResult> GetAPI(MyParam param)
        {
            using (HttpClient client = new HttpClient())
            {
                var url = "https://vtsapi.easygo-gps.co.id/api/report/idle";

                try
                {
                    var jsonData = JsonConvert.SerializeObject(param);
                    var content  = new StringContent(jsonData, Encoding.UTF8, "application/json");

                    content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                    content.Headers.Add("Token", "<isi token>");
                    //await DisplayAlert("Ket", $"{await content.ReadAsStringAsync()}", "OK");
                    var response = await client.PostAsync(url, content);

                    if (!response.IsSuccessStatusCode)
                    {
                        throw new Exception("Gagal !");
                    }
                    else
                    {
                        var result = await response.Content.ReadAsStringAsync();

                        MyResult myResult = JsonConvert.DeserializeObject <MyResult>(result);
                        return(myResult);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }
Example #12
0
            /// <summary>
            /// Для выполнения запросов к MySQL с возвращением 1 параметра.
            /// </summary>
            /// <param name="sql">Текст запроса к базе данных</param>
            /// <param name="connection">Строка подключения к базе данных</param>
            /// <returns>Возвращает значение при успешном выполнении запроса, текст ошибки - при ошибке.</returns>
            public static MyResult SqlScalar(string sql, string connection)
            {
                MyResult result = new MyResult();
                try
                {
                    MySql.Data.MySqlClient.MySqlConnection connRC = new MySql.Data.MySqlClient.MySqlConnection(connection);
                    MySql.Data.MySqlClient.MySqlCommand commRC = new MySql.Data.MySqlClient.MySqlCommand(sql, connRC);
                    connRC.Open();
                    try
                    {
                        result.ResultText = commRC.ExecuteScalar().ToString();
                        result.HasError = false;
                    }
                    catch (Exception ex)
                    {
                        result.ErrorText = ex.Message;
                        result.HasError = true;

                    }
                    connRC.Close();
                }
                catch (Exception ex)//Этот эксепшн на случай отсутствия соединения с сервером.
                {
                    result.ErrorText = ex.Message;
                    result.HasError = true;
                }
                return result;
            }
Example #13
0
 public JsonResult SaveParkDerate(ParkDerate model)
 {
     try
     {
         model = CheckParkDerate(model);
         List <ParkDerateIntervar> derateintervars = CheckParkDerateIntervar(model.DerateType, model.DerateID);
         model.DerateIntervar = derateintervars;
         if (string.IsNullOrWhiteSpace(model.DerateID))
         {
             bool result = ParkDerateServices.Add(model);
             if (!result)
             {
                 throw new MyException("添加失败");
             }
         }
         else
         {
             bool result = ParkDerateServices.Update(model);
             if (!result)
             {
                 throw new MyException("修改失败");
             }
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存商家优免信息失败");
         return(Json(MyResult.Error("保存失败")));
     }
 }
Example #14
0
 public JsonResult SaveRole(SysRoles role)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(role.RecordID))
         {
             role.CPID = GetCurrentUserCompanyId;
             result    = SysRolesServies.AddSysRole(role);
         }
         else
         {
             result = SysRolesServies.UpdateRole(role);
         }
         return(Json(new MyResult
         {
             result = result,
             msg = result ? "保存成功" : "保存失败"
         }));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存角色失败");
         return(Json(MyResult.Error("保存失败")));
     }
 }
Example #15
0
        public ActionResult GetParkingSuggestion(string query, string city, string lat, string lng)
        {
            try
            {
                string location = !string.IsNullOrWhiteSpace(lat) && !string.IsNullOrWhiteSpace(lng) ? string.Format("{0},{1}", lat, lng) : string.Empty;
                query = HttpUtility.UrlEncode(query);
                city  = HttpUtility.UrlEncode(city);
                PlaceSuggestion model = BaiDuLocationService.GetPlaceSuggestion(query, city, location);
                List <PlaceSuggestionResult> result = model.result.Where(p => p.location != null).Take(8).ToList();
                if (!model.IsSuccess)
                {
                    throw new MyException("查询周边车场失败");
                }

                return(Json(MyResult.Success(model.message, result)));
            }
            catch (MyException ex) {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "根据关键字查询地理名称", ex, LogFrom.WeiXin);
                return(Json(MyResult.Error("查询周边车场失败")));
            }
        }
Example #16
0
 public JsonResult OpenGate(string parkingId, string gateId, string remark)
 {
     try
     {
         int result = AdminOperateServices.RemoteGate(AdminLoginUser.RecordID, parkingId, gateId, remark);
         if (result == 0)
         {
             return(Json(MyResult.Success()));
         }
         if (result == 1)
         {
             throw new MyException("车场网络异常");
         }
         if (result == 2)
         {
             throw new MyException("通道不支持远程开门");
         }
         throw new MyException("开闸失败");
     }
     catch (MyException ex) {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "远程开闸失败");
         return(Json(MyResult.Error("远程开闸失败")));
     }
 }
Example #17
0
        public JsonResult DeleteRole(string recordId)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(recordId))
                {
                    throw new MyException("获取编号失败");
                }

                bool result = SysRolesServies.DeleteRoleByRecordId(recordId);
                return(Json(new MyResult
                {
                    result = result,
                    msg = result ? "删除成功" : "删除失败"
                }));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "删除角色失败");
                return(Json(MyResult.Error("删除失败")));
            }
        }
Example #18
0
        public ActionResult QueryWaitPayRecord(string parkingId, string plateNumber, int pageIndex)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(parkingId))
                {
                    throw new MyException("请选择车场");
                }

                int pageSize = 16;
                int recordTotalCount;
                List <ParkIORecord> records = ParkIORecordServices.QueryPageNotExit(parkingId, plateNumber, pageSize, pageIndex, out recordTotalCount);
                var result = from p in records
                             select new
                {
                    RecordID     = p.RecordID,
                    ImageUrl     = GetImagePath(p.EntranceImage),
                    PlateNumber  = p.PlateNumber,
                    EntranceTime = p.EntranceTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    ParkingId    = p.ParkingID
                };
                int    totalPage = (recordTotalCount + pageSize - 1) / pageSize;
                string msg       = string.Format("{0},{1}", recordTotalCount, totalPage);
                return(Json(MyResult.Success(msg, result)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "中央缴费获取待支付记录失败");
                return(Json(MyResult.Error("取待支付记录失败")));
            }
        }
Example #19
0
        public JsonResult QueryRemotelyOpenGateData()
        {
            try
            {
                List <string> parkingIds = new List <string>();
                if (!string.IsNullOrWhiteSpace(Request.Params["parkingId"]))
                {
                    parkingIds.Add(Request.Params["parkingId"]);
                }
                else
                {
                    List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                    if (parkings.Count > 0)
                    {
                        parkingIds.AddRange(parkings.Select(p => p.PKID));
                    }
                }
                string areaId = Request.Params["areaId"];
                string boxId  = Request.Params["boxId"];

                int page             = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int rows             = 15;
                int recordTotalCount = 0;
                List <RemotelyOpenGateView> models = ParkGateServices.QueryRemotelyOpenGate(parkingIds, areaId, boxId, page, rows, out recordTotalCount);
                return(Json(MyResult.Success("", models)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "微信获取远程开闸数据失败");
                return(Json(MyResult.Error("获取失败")));
            }
        }
Example #20
0
 /// <summary>
 /// 充值记录
 /// </summary>
 /// <returns></returns>
 public ActionResult GetRechargeRecordData(int orderSource, DateTime?start, DateTime?end, int page)
 {
     try
     {
         int pageSize            = 10;
         int total               = 0;
         List <ParkOrder> orders = ParkOrderServices.GetSellerRechargeOrder(SellerLoginUser.SellerID, orderSource, start, end, page, pageSize, out total);
         var models              = from p in orders
                                   select new
         {
             OrderNo     = p.OrderNo,
             OrderType   = p.OrderType.GetDescription(),
             PayWay      = p.PayWay.GetDescription(),
             Amount      = p.Amount,
             OrderSource = p.OrderSource.GetDescription(),
             OrderTime   = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"),
             Balance     = p.NewMoney
         };
         return(Json(MyResult.Success("", models)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "获取商家充值记录失败", ex, LogFrom.WeiXin);
         return(Json(MyResult.Error("获取商家充值记录失败")));
     }
 }
Example #21
0
 public JsonResult SellerCharge(decimal chargeBalance, string SellerID)
 {
     try
     {
         if (chargeBalance <= 0)
         {
             throw new MyException("充值金额不正确");
         }
         bool result = ParkSellerServices.SellerCharge(SellerID, chargeBalance, GetLoginUser.RecordID);
         if (!result)
         {
             throw new MyException("充值失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "商家充值失败");
         return(Json(MyResult.Error("充值失败")));
     }
 }
Example #22
0
        public ActionResult SaveBindMobile(string phone, string code)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(phone) || !new Regex("^1[0-9]{10}$").Match(phone).Success)
                {
                    throw new MyException("手机号码格式错误");
                }
                CheckBindTradePasswordCode(code, phone);


                bool result = WeiXinAccountService.WXBindingMobilePhone(WeiXinUser.AccountID, phone);
                if (!result)
                {
                    throw new MyException("绑定失败");
                }

                RemoveTradePasswordCooike();
                WeiXinUser.MobilePhone         = phone;
                Session["SmartSystem_WX_Info"] = WeiXinUser;

                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "绑定手机号失败", ex, LogFrom.WeiXin);
                return(Json(MyResult.Error("绑定失败")));
            }
        }
Example #23
0
        public ActionResult GetNextSurplusTime(int seconds)
        {
            if (seconds != -1)
            {
                int surSeconds = --seconds;
                if (surSeconds < 1)
                {
                    return(Json(MyResult.Success("能再次获取")));
                }
                return(Json(MyResult.Error("不能获取", surSeconds)));
            }
            var      code_time_cookie = Request.Cookies["SmartSystem_BindTradePassword_Code_GetTime"];
            DateTime nowTime          = DateTime.Now;

            if (code_time_cookie == null || DateTime.Parse(code_time_cookie.Value).AddMinutes(1) <= nowTime)
            {
                return(Json(MyResult.Success("能再次获取")));
            }


            TimeSpan countdownSpan  = DateTime.Parse(code_time_cookie.Value).AddMinutes(1) - nowTime;
            int      surplusSeconds = (int)Math.Round(countdownSpan.TotalSeconds, 0);

            if (surplusSeconds > 0)
            {
                return(Json(MyResult.Error("不能获取", surplusSeconds)));
            }
            return(Json(MyResult.Success("能再次获取")));
        }
Example #24
0
        //文章列表
        public ActionResult List(string keyword1 = "", string keyword2 = "", int page = 1)
        {
            string menuKey = "";

            if (keyword2 == "")
            {
                menuKey = keyword1;
            }
            else
            {
                menuKey = keyword1 + "/" + keyword2;
            }
            MyResult   result = new MyResult();
            int        count  = Convert.ToInt32(ConfigurationManager.AppSettings["articleListCount"]);
            ArticleDAL dal    = new ArticleDAL();

            result = dal.getArticleList(menuKey, count, page);
            ArticleList <Article> model = new ArticleList <Article>();

            model.head = ConvertHelper.FillModel <Head>(((DataTable)result.obj).Rows[0]);
            Paging <Article> paging = new Paging <Article>();

            paging.list       = ConvertHelper.FillModelList <Article>((DataTable)result.obj2);
            paging.totalPages = Convert.ToInt32(result.obj3);
            model.paging      = paging;
            ViewBag.page      = page;
            ViewBag.menuKey   = menuKey;
            return(View(model));
        }
Example #25
0
        //文章内容
        public ActionResult Content(string keyword1 = "", string keyword2 = "", int articleId = 1)
        {
            string menuKey = "";

            if (keyword2 == "")
            {
                menuKey = keyword1;
            }
            else
            {
                menuKey = keyword1 + "/" + keyword2;
            }
            MyResult   result = new MyResult();
            ArticleDAL dal    = new ArticleDAL();

            result = dal.getArticleContent(menuKey, articleId);
            ArticleContent model = new ArticleContent();

            //Article article = new Article();
            //ArticleTag articleTag = new ArticleTag();
            //PrevNext prevNext = new PrevNext();
            model.article    = ConvertHelper.FillModel <Article>(((DataTable)result.obj).Rows[0]);
            model.articleTag = ConvertHelper.FillModelList <ArticleTag>(((DataTable)result.obj2));
            model.prevNext   = ConvertHelper.FillModelList <PrevNext>(((DataTable)result.obj3));
            ViewBag.menuKey  = menuKey;
            return(View(model));
        }
Example #26
0
 public ActionResult AddMyCar(string licenseplate)
 {
     try
     {
         WX_CarInfo model = new WX_CarInfo();
         model.AccountID = UserAccount.AccountID;
         model.PlateNo   = licenseplate.ToPlateNo();
         model.Status    = 2;
         int result = CarService.AddWX_CarInfo(model);
         if (result == 1)
         {
             return(Json(MyResult.Success("添加成功")));
         }
         if (result == 0)
         {
             return(Json(MyResult.Error("车牌号重复")));
         }
         return(Json(MyResult.Error("添加失败")));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("H5CarManageError", "添加车牌信息失败", ex, LogFrom.WeiXin);
         return(Json(MyResult.Error("添加失败")));
     }
 }
Example #27
0
        static void button_Click(object sender, RoutedEventArgs e)
        {
            switch ((sender as Button).Content.ToString())
            {
            case "OK":
                result = MyResult.OK;
                break;

            case "POPRAW":
                result = MyResult.POPRAW;
                break;

            case "ANULUJ":
                result = MyResult.ANULUJ;
                break;

            case "USUŃ":
                result = MyResult.USUN;
                break;

            case "POMIŃ":
                result = MyResult.POMIN;
                break;
            }

            StackPanel   tempStackPanel    = (StackPanel)(sender as Button).Parent;
            Grid         tempGrid          = ( Grid )tempStackPanel.Parent;
            MyMessageBox tempWindowHandler = (MyMessageBox)tempGrid.Parent;

            tempWindowHandler.Close();
        }
Example #28
0
        public ActionResult CheckPayTimeOut(string eTime, decimal orderId)
        {
            DateTime endtime;

            if (!DateTime.TryParse(eTime, out endtime))
            {
                return(Json(MyResult.Error("支付异常")));
            }


            DateTime nowTime = DateTime.Now;

            if (endtime < nowTime)
            {
                return(Json(MyResult.Error(string.Format("{0}分{1}秒", "00", "00"))));
            }
            TimeSpan countdownSpan = endtime - nowTime;

            if (countdownSpan.TotalSeconds > 0)
            {
                string mm     = countdownSpan.Minutes >= 10 ? countdownSpan.Minutes.ToString() : "0" + countdownSpan.Minutes.ToString();
                string ss     = countdownSpan.Seconds >= 10 ? countdownSpan.Seconds.ToString() : "0" + countdownSpan.Seconds.ToString();
                string syTime = string.Format("{0}分{1}秒", mm, ss);
                return(Json(MyResult.Success(syTime)));
            }
            return(Json(MyResult.Error("支付超过时限")));
        }
Example #29
0
            /// <summary>
            /// Для выполнения запросов к MySQL без возвращения параметров.
            /// </summary>
            /// <param name="sql">Текст запроса к базе данных</param>
            /// <param name="connection">Строка подключения к базе данных</param>
            /// <returns>Возвращает True - ошибка или False - выполнено успешно.</returns>
            public static MyResult SqlNoneQuery(string sql)
            {
                MyResult result = new MyResult();

                try
                {
                    string connection = "Database=u0354899_diplom;Data Source=31.31.196.162;User Id=u0354899_vlad;Password=vlad19957;charset=cp1251";
                    MySql.Data.MySqlClient.MySqlConnection connRC = new MySql.Data.MySqlClient.MySqlConnection(connection);
                    MySql.Data.MySqlClient.MySqlCommand    commRC = new MySql.Data.MySqlClient.MySqlCommand(sql, connRC);
                    connRC.Open();
                    try
                    {
                        commRC.ExecuteNonQuery();
                        result.HasError = false;
                    }
                    catch (Exception ex)
                    {
                        result.ErrorText = ex.Message;
                        result.HasError  = true;
                    }
                    connRC.Close();
                }
                catch (Exception ex)//Этот эксепшн на случай отсутствия соединения с сервером.
                {
                    result.ErrorText = ex.Message;
                    result.HasError  = true;
                }
                return(result);
            }
Example #30
0
 public JsonResult Edit(ParkArea model)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.AreaID))
         {
             result = ParkAreaServices.Add(model);
         }
         else
         {
             result = ParkAreaServices.Update(model);
         }
         if (!result)
         {
             throw new MyException("保存区域失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存区域信息失败");
         return(Json(MyResult.Error("保存失败")));
     }
 }
Example #31
0
 public ResultItem(string name, MyResult result, int index, float cost)
 {
     Name   = name;
     Result = result;
     Index  = index;
     Cost   = cost;
 }
Example #32
0
        public void ProcessRequest(HttpContext context)
        {
            //Deserialize parameters
            var prm = context.Request["prm"];

            //Create a Json for result
            var res = new MyResult { OriginalValue = prm };
            res.NewValue = prm.ToUpper();

            //Serialize the result
            var s = new JavaScriptSerializer().Serialize(res);
            context.Response.ContentType = "application/json";
            context.Response.Write(s);
        }