Esempio n. 1
0
        public Tuple <IEnumerable <BPiaoBaoTPos.Domain.Models.BusinessmanInfo>, int> GetPosBusinessman(string code, string key, string businessmanName, string posNo, int startIndex, int count)
        {
            CashbagHelper ch = new CashbagHelper(WebUrlTPos + "GetTPOSCompanyList", "GET");
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add("code", code);
            dictionary.Add("key", key);
            dictionary.Add("POSNumber", posNo);
            dictionary.Add("CompanyName", businessmanName);
            var page = Math.Ceiling((double)startIndex / count) + 1;

            dictionary.Add("CurrentPage", page.ToString());
            dictionary.Add("PageSize", count.ToString());
            dictionary.Add("currentTime", DateTime.Now.ToString("yyyyMMddHHmmss"));
            string data   = ch.ParamsURLEncode(dictionary);
            var    result = ch.GetBackJsonData(data);

            if (result.status == false)
            {
                throw new CustomException(500, result.message.ToString());
            }
            List <BusinessmanInfo> list = new List <BusinessmanInfo>();
            var rows       = JArray.FromObject(result.result.rows);
            int totalcount = result.result.total;

            foreach (var item in rows)
            {
                BusinessmanInfo businessinfo = new BusinessmanInfo()
                {
                    Id = item.CompanyID,
                    BusinessmanName = item.CompanyName,
                    TotalPosCount   = item.Count,
                    PosRate         = item.POSRate,
                    Bank            = new BusinessmanInfo.BankInfo()
                    {
                        BankName = item.BankName,
                        CardNo   = item.BankCardNumber
                    },
                    CreateTime = item.SignDate
                };
                list.Add(businessinfo);
            }
            Tuple <IEnumerable <BusinessmanInfo>, int> tuple = new Tuple <IEnumerable <BusinessmanInfo>, int>(list, totalcount);

            return(tuple);
        }
Esempio n. 2
0
        public BusinessmanInfo GetBusinessmanInfo(string code, string key, string Id)
        {
            CashbagHelper ch = new CashbagHelper(WebUrlTPos + "QueryMerchant", "GET");
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add("code", code);
            dictionary.Add("key", key);
            dictionary.Add("MerchantID", Id);
            dictionary.Add("currentTime", DateTime.Now.ToString("yyyyMMddHHmmss"));
            string data   = ch.ParamsURLEncode(dictionary);
            var    result = ch.GetBackJsonData(data);

            if (result.status == false)
            {
                throw new CustomException(500, result.message.ToString());
            }
            var businessinfo = new BusinessmanInfo()
            {
                Id              = result.result.CompanyID,
                Address         = result.result.Address,
                LinkMan         = result.result.ContactUser,
                LinkPhone       = result.result.Moblie,
                LinkTel         = result.result.Phone,
                PosRate         = result.result.POSRate,
                BusinessmanName = result.result.CompanyName,
                CreateTime      = result.result.CreateDate,
                Bank            = new BusinessmanInfo.BankInfo()
                {
                    Address = new BusinessmanInfo.BankAddress()
                    {
                        Province  = result.result.BankProvince,
                        City      = result.result.BankCity,
                        Subbranch = result.result.BankAddress
                    },
                    BankName   = result.result.BankName,
                    Cardholder = result.result.AccountName,
                    CardNo     = result.result.BankCardNumber,
                    BankId     = result.result.AccountID
                },
                TotalPosCount = result.result.POSCount
            };

            return(businessinfo);
        }