Beispiel #1
0
        /// <summary>
        /// 缓存登录信息
        /// </summary>
        public static void CacheUserLoginData(SysUser user)
        {
            HttpContext.Current.Session["SmartSystem_SystemLoginUser"] = user;

            List <BaseVillage> villages = VillageServices.QueryVillageByUserId(user.RecordID);

            HttpContext.Current.Session["SmartSystem_LoginUser_ValidVillage"] = villages;

            HttpContext.Current.Session["SmartSystem_LoginUser_ValidCompany"] = CompanyServices.GetCurrLoginUserRoleCompany(user.CPID, user.RecordID);

            List <SysRoles> sysRoles = SysRolesServies.QuerySysRolesByUserId(user.RecordID);

            if (sysRoles != null)
            {
                HttpContext.Current.Session["SmartSystem_SystemLoginUser_Role"] = sysRoles;
                if (sysRoles.Count > 0)
                {
                    List <SysRoleAuthorize> roleAuthorizes = SysRoleAuthorizeServices.QuerySysRoleAuthorizeByRoleIds(sysRoles.Select(p => p.RecordID).ToList());
                    if (roleAuthorizes != null)
                    {
                        HttpContext.Current.Session["SmartSystem_LoginUser_SysRoleAuthorize"] = roleAuthorizes;
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取小区信息
        /// </summary>
        /// <param name="Companyid"></param>
        /// <returns></returns>
        public string GetVillageData()
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                int    pageIndex = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int    pageSize  = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);
                string sort      = Request.Params["sort"];
                if (string.IsNullOrWhiteSpace(Request.Params["companyId"]))
                {
                    return(string.Empty);
                }

                if (GetLoginUserVillages.Count == 0)
                {
                    return(string.Empty);
                }

                string             companyId   = Request.Params["companyId"];
                int                totalRecord = 0;
                List <BaseVillage> list        = VillageServices.QueryPage(GetLoginUserVillages.Select(p => p.VID).ToList(), companyId, pageIndex, pageSize, out totalRecord);

                sb.Append("{");
                sb.Append("\"total\":" + totalRecord + ",");
                sb.Append("\"rows\":" + JsonHelper.GetJsonString(list) + ",");
                sb.Append("\"index\":" + pageIndex);
                sb.Append("}");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取小区信息失败");
            }
            return(sb.ToString());
        }
Beispiel #3
0
        //根据人员和车场信息 下载二维码
        public JsonResult DownloadQRCode(string parkingId, string personId, int size)
        {
            try
            {
                List <int> dics = new List <int>();
                dics.Add(258);
                dics.Add(344);
                dics.Add(430);
                dics.Add(860);
                dics.Add(1280);

                List <string> imgs = new List <string>();
                //if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SystemDomain))
                //{
                //    throw new MyException("获取系统域名失败");
                //}
                BaseParkinfo parking = ParkingServices.QueryParkingByParkingID(parkingId);
                if (parking == null)
                {
                    throw new MyException("获取车场信息失败");
                }

                BaseVillage village = VillageServices.QueryVillageByRecordId(parking.VID);
                if (village == null)
                {
                    throw new MyException("获取小区信息失败");
                }
                //string url = SystemDefaultConfig.SystemDomain;
                string url     = "http://spscs.spsing.cn";
                string content = string.Format("{0}/qrl/qrp_ix_pid={1}^personId={2}", url, parkingId.Trim(), personId);
                foreach (var item in dics)
                {
                    try
                    {
                        string parkingName = string.Format("{0}_{1}", parking.PKName, item);
                        string result      = QRCodeServices.GenerateQRCode(village.CPID, content, item, parkingName);
                        imgs.Add(item.ToString() + "|" + result);
                        TxtLogServices.WriteTxtLogEx("DownloadQRCode", item.ToString() + "|" + result);
                    }
                    catch (Exception ex)
                    {
                        ExceptionsServices.AddExceptions(ex, "生存车场二维码失败");
                        imgs.Add(item.ToString() + "|");
                    }
                }

                return(Json(MyResult.Success("", imgs)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "下载二维码失败");
                return(Json(MyResult.Error("下载二维码失败")));
            }
        }
        public async Task CreateVillageParameterNullShouldReturnNull()
        {
            var newVillageName = "";

            var villageServices = new VillageServices(context);
            var actualResult    = await villageServices.CreateVillageAsync(newVillageName);

            Assert.That(actualResult == null, ResultShouldBNullMessage);
        }
Beispiel #5
0
        public JsonResult AddIdenticalQRCode(string recordId, string vid, bool isAdd)
        {
            try
            {
                ParkDerateQRcode derate = ParkDerateQRcodeServices.QueryByRecordId(recordId);
                if (derate == null)
                {
                    throw new MyException("获取优免二维码失败");
                }

                if (isAdd)
                {
                    derate.AlreadyUseTimes = 0;
                    derate.CreateTime      = DateTime.Now;
                    derate.OperatorId      = GetLoginUser.RecordID;
                    bool result = ParkDerateQRcodeServices.Add(derate);
                    if (!result)
                    {
                        throw new MyException("添加优免二维码失败");
                    }
                }
                if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SystemDomain))
                {
                    throw new MyException("获取系统域名失败");
                }
                BaseVillage village = VillageServices.QueryVillageByRecordId(vid);
                if (village == null)
                {
                    throw new MyException("获取小区信息失败");
                }

                string content = string.Format("{0}/QRCodeDerate/Index?vid={1}&qid={2}&sign={3}", SystemDefaultConfig.SystemDomain, vid, recordId, GetSignature(vid, recordId));
                using (System.Drawing.Image image = QRCodeServices.GenerateQRCode(content, 430))
                {
                    ImageFormat format = image.RawFormat;
                    byte[]      buffer;
                    using (MemoryStream ms = new MemoryStream())
                    {
                        image.Save(ms, ImageFormat.Jpeg);
                        buffer = new byte[ms.Length];
                        ms.Seek(0, SeekOrigin.Begin);
                        ms.Read(buffer, 0, buffer.Length);
                    }
                    return(Json(MyResult.Success("添加二维码成功", System.Convert.ToBase64String(buffer))));
                }
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "复制优免二维码失败");
                return(Json(MyResult.Error("复制优免二维码失败")));
            }
        }
Beispiel #6
0
        /// <summary>
        /// 扫码优免进入
        /// </summary>
        /// <param name="vid">小区编号</param>
        /// <param name="qid">二维码编号</param>
        /// <param name="type">0-长久二维码 1-临时二维码</param>
        /// <param name="sign">签名</param>
        /// <returns></returns>
        public ActionResult Index(string vid, string qid, string sign)
        {
            TxtLogServices.WriteTxtLogEx("QRCodeDerate", "进入扫码打折:vid={0},qid={1},sign={2}", vid, qid, sign);
            try
            {
                if (SourceClient != RequestSourceClient.WeiXin)
                {
                    throw new MyException("请在微信中打开");
                }
                if (!CheckSignature(vid, qid, sign))
                {
                    throw new MyException("验证签名失败");
                }

                if (SourceClient == RequestSourceClient.WeiXin)
                {
                    if (string.IsNullOrWhiteSpace(WeiXinOpenId))
                    {
                        ParkDerate derate = ParkDerateServices.Query(qid);
                        if (derate == null)
                        {
                            throw new MyException("获取优免券信息失败");
                        }

                        ParkSeller seller = ParkSellerServices.QueryBySellerId(derate.SellerID);
                        if (seller == null)
                        {
                            throw new MyException("获取商家信息失败");
                        }

                        BaseVillage village = VillageServices.QueryVillageByRecordId(seller.VID);
                        if (village == null)
                        {
                            throw new MyException("获取小区信息失败");
                        }

                        string id = string.Format("QRCodeDerate_Index_vid={0}^qid={1}^sign={2}^companyId={3}", vid, qid, sign, village.CPID);
                        return(RedirectToAction("Index", "WeiXinAuthorize", new { id = id }));
                    }
                }
                ViewBag.PlateNumber = OnlineOrderServices.QueryLastPaymentPlateNumber(PaymentChannel.WeiXinPay, WeiXinOpenId);
                ViewBag.VillageId   = vid;
                ViewBag.QId         = qid;
                return(View());
            }
            catch (MyException ex) {
                TxtLogServices.WriteTxtLogEx("QRCodeDerate", "扫码打折异常:描述:{0}", ex.Message);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message }));
            }
            catch (Exception ex)
            {
                TxtLogServices.WriteTxtLogEx("QRCodeDerate", "扫码打折异常:描述:{0},明细:{1}", ex.Message, ex.StackTrace);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "扫码失败,未知异常" }));
            }
        }
        public async Task CreateVillageWithExistingNameShouldReturnTheVillage()
        {
            var existingVillageName         = "Пасарел";
            var expectedVillageToBeReturned = TestData.FirstOrDefault(x => x.Name == existingVillageName);

            var villageServices = new VillageServices(context);
            var actualResult    = await villageServices.CreateVillageAsync(existingVillageName);

            ;
            Assert.That(expectedVillageToBeReturned.Name.Equals(actualResult.Name), ResultShuoldBeTrueMessage);
            Assert.That(expectedVillageToBeReturned.Id.Equals(actualResult.Id), ResultShuoldBeTrueMessage);
        }
Beispiel #8
0
        public JsonResult DownloadQRCode(string vid, string qid, string sellerName, string derateName)
        {
            try
            {
                List <int> dics = new List <int>();
                dics.Add(258);
                dics.Add(344);
                dics.Add(430);
                dics.Add(860);
                dics.Add(1280);

                List <string> imgs = new List <string>();
                if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SystemDomain))
                {
                    throw new MyException("获取系统域名失败");
                }
                BaseVillage village = VillageServices.QueryVillageByRecordId(vid);
                if (village == null)
                {
                    throw new MyException("获取小区信息失败");
                }

                string content = string.Format("{0}/QRCodeDerate/Index?vid={1}&qid={2}&sign={3}", SystemDefaultConfig.SystemDomain, vid, qid, GetSignature(vid, qid));
                foreach (var item in dics)
                {
                    try
                    {
                        string fileName = string.Format("{0}_{1}_{2}_{3}", sellerName, derateName, item, qid);
                        string result   = QRCodeServices.GenerateQRCode(village.CPID, content, item, fileName);
                        imgs.Add(item.ToString() + "|" + result);
                        TxtLogServices.WriteTxtLogEx("DownloadQRCode", item.ToString() + "|" + result);
                    }
                    catch (Exception ex)
                    {
                        ExceptionsServices.AddExceptions(ex, "生存优免二维码失败");
                        imgs.Add(item.ToString() + "|");
                    }
                }

                return(Json(MyResult.Success("", imgs)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "下载优免二维码失败");
                return(Json(MyResult.Error("下载优免二维码失败")));
            }
        }
Beispiel #9
0
        private void btnSave2HHUDB_Click(object sender, EventArgs e)
        {
            if (qList.Count == 0)
            {
                MessageBox.Show("There is no Villages(Quarter) data to save HHU db file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (cbofileName.SelectedItem.Equals("Select One"))
            {
                MessageBox.Show("Select HHU db file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DialogResult ok = MessageBox.Show("are you sure to save data?", "information", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (ok == DialogResult.Yes)
            {
                BuildSQLiteConnection();
                VillageServices sqlitevillage = new VillageServices();
                List <MPS.SQLiteHelper.Villages> sqlvillageList = new List <MPS.SQLiteHelper.Villages>();
                string sqlCommand = string.Format("SELECT * FROM Villages");
                var    data       = sqlitevillage.GetAll(sqlCommand);
                foreach (var v in data)
                {
                    foreach (Quarter q in qList)
                    {
                        if (q.QuarterCode == v.vlg_code)
                        {
                            MessageBox.Show("(" + q.QuarterCode + ") Villages(Quarter) code already exists in HHU db file.", "information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                }
                foreach (Quarter q in qList)
                {
                    MPS.SQLiteHelper.Villages v = new MPS.SQLiteHelper.Villages();
                    v.vlg_code    = q.QuarterCode;
                    v.vlg_address = q.Address;
                    v.vlg_name    = q.QuarterNameInEng;
                    v.vlg_value   = q.QuarterNameInMM;
                    sqlvillageList.Add(v);
                }
                try {
                    sqlitevillage.AddRange(sqlvillageList);
                    MessageBox.Show("Villages(Quarter) data to HHU db file is successfully saved.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex) {
                    MessageBox.Show("Error occur when saving Villages to HHU db file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public async Task CreateVillageShouldReturnTrue()
        {
            var expectedResult = new Village {
                Id = 1, Name = "Бацова маала"
            };
            var newVillageName = "Бацова маала";

            var context = this.GetDbContext();

            var villageServices = new VillageServices(context);
            var actualResult    = await villageServices.CreateVillageAsync(newVillageName);

            Assert.That(expectedResult.Name.Equals(actualResult.Name), ResultShuoldBeTrueMessage);
            Assert.That(expectedResult.Id.Equals(actualResult.Id), ResultShuoldBeTrueMessage);
        }
Beispiel #11
0
        public ActionResult Index()
        {
            try
            {
                ViewBag.StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
                ViewBag.EndTime   = DateTime.Now.Date.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
                ViewBag.Villages  = VillageServices.QueryVillageByEmployeeMobilePhone(WeiXinUser.MobilePhone);

                return(View());
            }
            catch (Exception ex) {
                ExceptionsServices.AddExceptionToDbAndTxt("CarVisitor", "获取访客车场失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取访客车场失败" }));
            }
        }
Beispiel #12
0
        public JsonResult Delete(string villageId)
        {
            try
            {
                bool result = VillageServices.Delete(villageId);
                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("删除小区失败")));
            }
        }
Beispiel #13
0
        public JsonResult EditVillage(BaseVillage model)
        {
            try
            {
                bool result = false;
                if (string.IsNullOrWhiteSpace(model.VID))
                {
                    model.ProxyNo = GuidGenerator.GetGuidString();
                    model.VID     = GuidGenerator.GetGuidString();
                    result        = VillageServices.Add(model);
                    if (!result)
                    {
                        throw new MyException("添加小区信息失败");
                    }
                    UpdateLoginUserVillageCache(model);
                    return(Json(MyResult.Success("添加小区信息成功【如需查看或修改该小区信息,请对当前登录账号所在的作用域中勾选该小区】")));
                }
                else
                {
                    result = VillageServices.Update(model);
                    if (!result)
                    {
                        throw new MyException("修改小区信息失败");
                    }
                    UpdateLoginUserVillageCache(model);

                    return(Json(MyResult.Success("修改小区信息成功")));
                }
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "保存小区失败");
                return(Json(MyResult.Error("保存小区失败")));
            }
        }
Beispiel #14
0
        public string CreateLoginUserSubVillageTreeData()
        {
            try
            {
                StringBuilder str = new StringBuilder();

                List <BaseCompany> companys = CompanyServices.QueryCompanyAndSubordinateCompany(GetCurrentUserCompanyId);
                if (companys.Count == 0)
                {
                    return(str.ToString());
                }


                BaseCompany        topCompany = companys.FirstOrDefault(p => p.CPID == GetCurrentUserCompanyId);
                List <BaseVillage> villages   = VillageServices.QueryVillageByCompanyIds(companys.Select(p => p.CPID).ToList());
                villages = villages.Where(p => p.CPID != topCompany.CPID).ToList();

                if (topCompany == null)
                {
                    return(str.ToString());
                }

                str.Append("[");
                str.Append("{\"id\":\"" + topCompany.CPID + "\",");
                str.Append("\"iconCls\":\"my-company-icon\",");
                str.Append("\"attributes\":{\"type\":0},");
                str.Append("\"text\":\"" + topCompany.CPName + "\"");
                CreateSubordinateVillageTreeData(companys, villages, topCompany.CPID, str);
                str.Append("}");
                str.Append("]");
                return(str.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建小区树结构失败");
                return(string.Empty);
            }
        }
Beispiel #15
0
        public JsonResult GrantCarDerate(string vid, string qid, string sellerName, string derateName, int number)
        {
            try
            {
                if (number <= 0)
                {
                    throw new MyException("发放优免券数量不正确");
                }

                if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SystemDomain))
                {
                    throw new MyException("获取系统域名失败");
                }
                ParkDerateQRcode qrCode = ParkDerateQRcodeServices.QueryByRecordId(qid);
                if (qrCode == null)
                {
                    throw new MyException("优免券规则不存在");
                }

                ParkDerate derate = ParkDerateServices.Query(qrCode.DerateID);
                if (derate == null)
                {
                    throw new MyException("获取优免规则失败");
                }

                if (derate.DerateType == DerateType.SpecialTimePeriodPayment)
                {
                    string     errorMsg = string.Empty;
                    ParkSeller seller   = ParkSellerServices.GetSeller(derate.SellerID, out errorMsg);
                    if (derate == null)
                    {
                        throw new MyException("获取优免规则失败");
                    }

                    decimal totalAmount = qrCode.DerateValue * number;
                    if ((seller.Creditline + seller.Balance) < totalAmount)
                    {
                        throw new MyException("商家余额不足");
                    }
                }

                BaseVillage village = VillageServices.QueryVillageByRecordId(vid);
                if (village == null)
                {
                    throw new MyException("获取小区信息失败");
                }

                string        folderName   = string.Format("{0}_{1}_{2}", sellerName, derateName, IdGenerator.Instance.GetId().ToString());
                List <string> carDerateIds = new List <string>();
                for (int i = 0; i < number; i++)
                {
                    string carDerateId = GuidGenerator.GetGuidString();
                    string content     = string.Format("{0}/QRCodeDerate/Index?vid={1}&qid={2}&did={3}&sign={4}", SystemDefaultConfig.SystemDomain, vid, qid, carDerateId, GetSignature(vid, qid, carDerateId));
                    string result      = QRCodeServices.GenerateQRCode(village.CPID, content, 430, carDerateId, folderName);
                    if (string.IsNullOrWhiteSpace(result))
                    {
                        throw new MyException("创建二维码失败");
                    }
                    carDerateIds.Add(carDerateId);
                }
                string filePath    = string.Format("/Uploads/{0}", folderName);
                string zipFilePath = string.Format("{0}/{1}_{2}.zip", filePath, sellerName, derateName);
                string mapPath     = Server.MapPath("~/");

                ZipHelper.ZipFiles(string.Format("{0}/{1}", mapPath, filePath), string.Format("{0}/{1}", mapPath, zipFilePath));
                if (carDerateIds.Count != number)
                {
                    throw new MyException("二维码数量与待创建的数量不匹配");
                }

                bool grantResult = ParkDerateQRcodeServices.GrantCarDerate(carDerateIds, zipFilePath, qid);
                if (!grantResult)
                {
                    throw new MyException("发放券失败");
                }

                return(Json(MyResult.Success("", zipFilePath)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "发放优免券失败");
                return(Json(MyResult.Error("发放优免券失败")));
            }
        }
Beispiel #16
0
        public ActionResult DerateQRCode(string recordId)
        {
            try
            {
                ParkDerateQRcode derateQRcode = ParkDerateQRcodeServices.QueryByRecordId(recordId);
                if (derateQRcode == null)
                {
                    throw new MyException("该二维码不存在");
                }

                ParkDerate derate = ParkDerateServices.Query(derateQRcode.DerateID);
                if (derate == null)
                {
                    throw new MyException("优免规则不存在");
                }
                derateQRcode.DerateName = derate.Name;

                ParkSeller seller = ParkSellerServices.QueryBySellerId(derate.SellerID);
                if (seller == null)
                {
                    throw new MyException("商家不存在");
                }
                derateQRcode.SellerName = seller.SellerName;

                if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SystemDomain))
                {
                    throw new MyException("获取系统域名失败");
                }
                BaseVillage village = VillageServices.QueryVillageByRecordId(seller.VID);
                if (village == null)
                {
                    throw new MyException("获取小区信息失败");
                }

                string content = string.Format("{0}/QRCodeDerate/Index?vid={1}&qid={2}&sign={3}", SystemDefaultConfig.SystemDomain, seller.VID, recordId, GetSignature(seller.VID, recordId));
                using (System.Drawing.Image image = QRCodeServices.GenerateQRCode(content, 430))
                {
                    ImageFormat format = image.RawFormat;
                    byte[]      buffer;
                    using (MemoryStream ms = new MemoryStream())
                    {
                        image.Save(ms, ImageFormat.Jpeg);
                        buffer = new byte[ms.Length];
                        ms.Seek(0, SeekOrigin.Begin);
                        ms.Read(buffer, 0, buffer.Length);
                    }
                    derateQRcode.ImageData = System.Convert.ToBase64String(buffer);
                }
                ViewBag.CompanyID   = village.CPID;
                ViewBag.ShareAction = "XFJMDerateQRCode/DerateQRCode?recordId=" + recordId;
                return(View(derateQRcode));
            }
            catch (MyException ex)
            {
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "微信获取二维码失败", LogFrom.WeiXin);
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = "获取二维码失败" }));
            }
        }
Beispiel #17
0
        public ActionResult SaveRecharge(decimal Amount)
        {
            try
            {
                BaseVillage village = VillageServices.QueryVillageByRecordId(SellerLoginUser.VID);
                if (village == null)
                {
                    throw new MyException("获取小区信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(village.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "获取微信配置信息失败", "单位编号:" + village.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "该车场暂停使用微信支付", "单位编号:" + village.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID)
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }

                OnlineOrder order = new OnlineOrder();
                order.OrderID        = IdGenerator.Instance.GetId();
                order.InOutID        = SellerLoginUser.SellerID;
                order.PKID           = SellerLoginUser.SellerID;
                order.Status         = OnlineOrderStatus.WaitPay;
                order.PayAccount     = WeiXinUser.OpenID;
                order.Payer          = WeiXinUser.OpenID;
                order.PKName         = SellerLoginUser.SellerName;
                order.Amount         = Amount;
                order.PayeeUser      = config.SystemName;
                order.PayeeAccount   = config.PartnerId;
                order.OrderType      = OnlineOrderType.SellerRecharge;
                order.PaymentChannel = PaymentChannel.WeiXinPay;
                order.PayeeChannel   = PaymentChannel.WeiXinPay;
                order.AccountID      = WeiXinUser.AccountID;
                order.Amount         = Amount;
                order.CardId         = WeiXinUser.AccountID;
                order.CompanyID      = config.CompanyID;
                order.OrderTime      = DateTime.Now;
                order.Remark         = "商家充值";
                bool result = OnlineOrderServices.Create(order);
                if (!result)
                {
                    throw new MyException("充值失败[保存订单失败]");
                }

                return(RedirectToAction("SellerRechargePayment", "WeiXinPayment", new { orderId = order.OrderID }));
            }
            catch (MyException ex)
            {
                return(PageAlert("Index", "SellerRecharge", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex) {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "提交商家充值信息失败", ex, LogFrom.WeiXin);
                return(PageAlert("Index", "SellerRecharge", new { RemindUserContent = "提交商家充值信息失败" }));
            }
        }
Beispiel #18
0
        public ActionResult Passed(string recordId)
        {
            try
            {
                List <BaseVillage> villages     = VillageServices.QueryVillageByEmployeeMobilePhone(WeiXinUser.MobilePhone);
                List <EnumContext> parkContexts = new List <EnumContext>();
                if (villages.Count > 0)
                {
                    List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(villages.Select(p => p.VID).ToList());
                    foreach (var item in parkings)
                    {
                        EnumContext model = new EnumContext();
                        model.Description = item.PKName;
                        model.EnumString  = item.PKID;
                        parkContexts.Add(model);
                    }
                }
                ViewBag.ParkContexts = parkContexts;

                ParkMonthlyCarApply monthlyCarApply = ParkMonthlyCarApplyServices.QueryByRecordID(recordId);
                if (monthlyCarApply == null)
                {
                    throw new MyException("申请信息不存在");
                }

                List <ParkArea>    areas        = ParkAreaServices.GetParkAreaByParkingId(monthlyCarApply.PKID);
                List <EnumContext> areaContexts = new List <EnumContext>();
                foreach (var item in areas)
                {
                    EnumContext model = new EnumContext();
                    model.Description = item.AreaName;
                    model.EnumString  = item.AreaID;
                    areaContexts.Add(model);
                }
                ViewBag.AreaContexts = areaContexts;

                List <EnumContext> gateContexts = new List <EnumContext>();
                foreach (var item in areaContexts)
                {
                    List <ParkGate> gates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>()
                    {
                        item.EnumString
                    });

                    foreach (var gate in gates)
                    {
                        EnumContext model = new EnumContext();
                        model.Description = gate.GateName;
                        model.EnumString  = string.Format("{0}|{1}", gate.GateID, item.EnumString);
                        gateContexts.Add(model);
                    }
                }

                ViewBag.GateContexts = gateContexts;

                return(View(monthlyCarApply));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AdminAduitCarApply", "查看月租车申请详情失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "AdminAduitCarApply", new { RemindUserContent = "审核失败" }));
            }
        }
Beispiel #19
0
        public string GetSysScopeAuthorize()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(Request.Params["scopeId"]))
                {
                    return(string.Empty);
                }

                string scopeId = Request.Params["scopeId"];

                SysScope scope = SysScopeServices.QuerySysScopeByRecordId(scopeId);
                if (scope == null)
                {
                    return(string.Empty);
                }

                StringBuilder strTree = new StringBuilder();
                strTree.Append("[{\"id\":\"" + scope.ASID + "\",");
                strTree.Append("\"attributes\":{\"type\":0},");
                strTree.Append("\"text\":\"" + scope.ASName + "[作用域]\"");

                List <SysScopeAuthorize> scopeAuthorizes = SysScopeAuthorizeServices.QuerySysScopeAuthorizeByScopeId(scope.ASID)
                                                           .Where(p => p.ASType == ASType.Village).ToList();

                List <BaseCompany> compamys = CompanyServices.QueryCompanyAndSubordinateCompany(GetCurrentUserCompanyId);
                if (compamys.Count == 0)
                {
                    return(string.Empty);
                }

                var list = VillageServices.QueryVillageByCompanyIds(compamys.Select(p => p.CPID).ToList());
                if (list.Count > 0)
                {
                    strTree.Append(",\"children\":[");
                }

                int i = 1;
                foreach (var item in list)
                {
                    string      villageName = item.VName;
                    BaseCompany company     = compamys.FirstOrDefault(p => p.CPID == item.CPID);
                    if (company != null)
                    {
                        villageName = string.Format("{0}【{1}】", item.VName, company.CPName);
                    }
                    strTree.Append("{\"id\":\"" + scope.ASID + "_" + item.VID + "\",");
                    strTree.Append("\"attributes\":{\"type\":1},");
                    strTree.Append("\"text\":\"" + villageName + "\"");
                    if (scopeAuthorizes != null && scopeAuthorizes.Exists(p => p.TagID == item.VID))
                    {
                        strTree.Append(",\"checked\":true");
                    }

                    strTree.Append("}");
                    if (i != list.Count())
                    {
                        strTree.Append(",");
                    }
                    i++;
                }
                if (list.Count > 0)
                {
                    strTree.Append("]");
                }

                strTree.Append("}]");
                return(strTree.ToString());
            }
            catch (MyException ex)
            {
                return(string.Empty);
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "作用域授权时获取小区信息失败");
                return(string.Empty);
            }
        }