Exemplo n.º 1
0
        protected string GoPage(int Page)
        {
            string Rv;

            Rv = "/e/space/?uid=" + UID + "&tid=" + Tid.ToString() + "&page=" + Page.ToString();
            return(Rv);
        }
Exemplo n.º 2
0
        protected string GoPage(int Page)
        {
            string Rv;

            Rv = "/e/space/?s=" + SiteId + "&username="******"&tid=" + Tid.ToString() + "&page=" + Page.ToString();
            return(Rv);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Инициализация переменных
        /// </summary>
        public override void InitializeComponents()
        {
            // m_log = Settings.Cyber.LogFile;

            try
            {
                CodePage    = "1251";
                ContentType = "application/x-www-form-urlencoded";

                SD = ProvidersSettings.Cyber.SD;
                AP = ProvidersSettings.Cyber.AP;
                OP = ProvidersSettings.Cyber.OP;

                // Пути к файлам ключей
                secret_key_path = Settings.CyberPath + ProvidersSettings.Cyber.SecretKey;
                passwd          = ProvidersSettings.Cyber.Passwd;
                public_key_path = Settings.CyberPath + ProvidersSettings.Cyber.PublicKeys;
                serial          = ProvidersSettings.Cyber.BankKeySerial;

                checkHost  = GetCheckHost();
                payHost    = GetPayHost();
                statusHost = GetStatusHost();

                session = "OLDIGW" + Tid.ToString();
            }
            catch (Exception ex)
            {
                RootLog($"{tid} {Number}{Card} {Account} {Provider}/{Service}/{Gateway}\r\n{ex.ToString()}");
            }

            // base.InitializeComponents();
        }
Exemplo n.º 4
0
    public override string ToString()
    {
        StringBuilder __sb = new StringBuilder("TimRoster(");

        __sb.Append(", Subscription: ");
        __sb.Append(Subscription);
        __sb.Append(", Tid: ");
        __sb.Append(Tid == null ? "<null>" : Tid.ToString());
        if (Name != null && __isset.name)
        {
            __sb.Append(", Name: ");
            __sb.Append(Name);
        }
        if (ExtraMap != null && __isset.extraMap)
        {
            __sb.Append(", ExtraMap: ");
            __sb.Append(ExtraMap);
        }
        __sb.Append(")");
        return(__sb.ToString());
    }
Exemplo n.º 5
0
        /// <summary>
        /// Создаёт запрос check/pay/status
        /// </summary>
        /// <param name="old_state"></param>
        /// <returns></returns>
        public override int MakeRequest(int old_state)
        {
            try
            {
                if (old_state == 0)
                {
                    // jreq.reqTime = Pcdate.AsCF();
                    // checkParam
                    // freq.reqType = "queryPayeeInfo";
                    // Log($"MakeRequest for {freq.ToString()}");
                }
                // Создать запрос Pay
                else if (old_state == 1)
                {
                    if (Service.ToLower() == "rt-acc")
                    {
                        preq.svcTypeId = FindFilial();
                        preq.svcNum    = Account;
                    }
                    else
                    {
                        preq.svcNum = '7' + Phone;
                    }
                    // preq.svcSubNum = jreq.svcSubNum;
                    preq.payTime      = XConvert.AsDateTZ(DateTime.Now, Settings.Tz);
                    preq.reqTime      = XConvert.AsDateTZ(Pcdate, Settings.Tz);
                    preq.payAmount    = (int?)(Amount * 100m);
                    preq.payComment   = $"Оплата {preq.payAmount} {preq.srcPayId} {preq.svcNum}";
                    preq.srcPayId     = Tid.ToString();
                    preq.payerContact = Contact;
                    stRequest         = JsonConvert.SerializeObject(preq);
                    Log($"Создан запрос\r\n{stRequest}");

                    return(0);
                }
                // Создать запрос Status
                else if (old_state == 3)
                {
                    sreq.srcPayId = Tid.ToString();
                    stRequest     = JsonConvert.SerializeObject(sreq);
                    Log($"Создан запрос\r\n{stRequest}");
                }
                // Запрос на отмену платежа
                else if (old_state == 8)
                {
                    stRequest = JsonConvert.SerializeObject(ureq);
                    Log($"Создан запрос\r\n{stRequest}");
                }
                else
                {
                    errCode = 2;
                    errDesc = string.Format("Неизвестное состояние ({0}) платежа", old_state);
                    state   = 11;
                    Log(ErrDesc);
                    RootLog(ErrDesc);
                    return(1);
                }
            }
            catch (Exception ex)
            {
                RootLog(ex.ToString());
                return(1);
            }

            // stRequest = JsonConvert.SerializeObject(jreq);
            // Log($"Создан запрос\r\n{stRequest}");

            return(0);
        }
Exemplo n.º 6
0
        public override int Undo()
        {
            byte   old_state = state;
            int    OK        = 1;
            string x         = !string.IsNullOrEmpty(Phone) ? Phone :
                               !string.IsNullOrEmpty(Account) ? Account :
                               !string.IsNullOrEmpty(Number) ? Number : "";

            // Log("{0} Попытка отмены платежа", Tid);
            RootLog($"{Tid} [UNDO - начало] Num = {x} State = {State}");

            ureq.srcPayId = Tid.ToString();
            ureq.reqTime  = XConvert.AsDateTZ(Pcdate, Settings.Tz);
            stRequest     = JsonConvert.SerializeObject(ureq);

            if (MakeRequest(8) == 0 && PostJson(Host, stRequest) == 0 && ParseAnswer(stResponse) == 0)
            {
                Log($"{Tid} [UNDO - конец] reqStatus = {resp.reqStatus} payStatus = {resp.payStatus}");
                if (resp.payStatus == 3)
                {
                    errCode = 6;
                    errDesc = "Платёж отменён оператором";
                    state   = 10;
                }
                else if (resp.payStatus == 103)
                {
                    errCode = 1;
                    state   = 3;
                    errDesc = String.Format($"Платёж {Tid} отменяется: {ReqNote}");
                }
                else
                {
                    if (old_state == 6)
                    {
                        errCode = 3;
                    }
                    else if (old_state == 12)
                    {
                        errCode = 6;
                    }
                    else
                    {
                        errCode = 1;
                    }
                    errDesc = String.Format($"Ошибка отмены платежа: {ReqNote}");
                }

                // Log("{0} err={1} desc={2} st={3}", Tid, ErrCode, ErrDesc, State);

                OK = 0;
            }
            else
            {
                errCode = 2;
                state   = 11;
            }

            UpdateState(Tid, errCode: ErrCode, errDesc: ErrDesc, locked: 0, state: state);
            MakeAnswer();
            return(OK);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Инициализация значений класса
        /// </summary>
        public override void InitializeComponents()
        {
            base.InitializeComponents();
            CodePage = "utf-8";

            commonName = Settings.Rt.CN;
            host       = Settings.Rt.Host;


            if (string.IsNullOrEmpty(Phone))
            {
                jreq.svcTypeId = FindFilial();
                jreq.svcNum    = Account;
                if (!string.IsNullOrEmpty(AccountParam))
                {
                    jreq.svcSubNum = AccountParam;
                }
            }
            else
            {
                jreq.svcNum = "7" + Phone;
                if (!string.IsNullOrEmpty(PhoneParam))
                {
                    jreq.svcSubNum = PhoneParam;
                }
            }
            if (!string.IsNullOrEmpty(Comment))
            {
                jreq.payComment = Comment;
            }

            if (pcdate == DateTime.MinValue)
            {
                pcdate = DateTime.Now;
            }

            switch (RequestType.ToLower())
            {
            case "status":
                sreq.srcPayId = Tid.ToString();
                break;

            case "payment":
                DoPay();
                break;

            case "undo":
                ureq.reqType = "abandonPayment";
                break;

            case "check":
                jreq.reqType = "checkPaymentParams";
                break;

            case "find":
                DoCheck();
                return;

            default:
                jreq.reqType = RequestType;
                break;
            }

            if (!string.IsNullOrEmpty(Number))
            {
                jreq.queryFlags = Number.ToInt();
            }

            if (Tid != long.MinValue)
            {
                jreq.srcPayId = Tid.ToString();
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Создаёт аттач-файл для отправки по e-mail
        /// </summary>
        public void MakeRequest()
        {
            string template = "";

            using (StreamReader structure = new StreamReader(Settings.Templates + Service + "-ord-structure.tpl"))
            {
                template = structure.ReadToEnd();
            }
            if (string.IsNullOrEmpty(template))
            {
                throw new ApplicationException(string.Format("Шаблон структуры таблицы {0} пуст", Settings.Templates + Service + "-ord-structure.tpl"));
            }

            // Шаблон содержит структуру таблицы

            string tableName = Tid.ToString() + ".dbf";

            // Создадим объект Таблица
            DbfFile odbf = new DbfFile();

            // Откроем таблицу для записи в папку attachemts
            odbf.Open(Settings.Attachments + tableName, FileMode.Create);

            XElement root = XElement.Parse(stResponse);
            IEnumerable <XElement> fields =
                from el in root.Elements("fields")
                select el;

            string name;
            string type;
            string len;
            string p;

            foreach (XElement el in fields)
            {
                switch (el.Name.LocalName.ToString().ToLower())
                {
                case "field":                         // Поле
                    len  = "0";
                    p    = "0";
                    name = "";
                    type = "";
                    foreach (XAttribute attr in el.Attributes())
                    {
                        if (attr.Name.LocalName.ToLower() == "name")
                        {
                            name = attr.Value;
                        }
                        else if (attr.Name.LocalName.ToLower() == "type")
                        {
                            type = attr.Value;
                        }
                        else if (attr.Name.LocalName.ToLower() == "len")
                        {
                            len = attr.Value;
                        }
                        else if (attr.Name.LocalName.ToLower() == "p")
                        {
                            p = attr.Value;
                        }
                    }
                    if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(type))
                    {
                        throw new ApplicationException("Пропущены обязательные значения name или type в определении столбца");
                    }

                    odbf.Header.AddColumn(new DbfColumn(name, GetDbfType(type), int.Parse(len), int.Parse(p)));

                    break;

                default:
                    // Error = ErrTemplatelInvalid;
                    throw new ApplicationException("Ошибка структуры таблицы");
                }
            }

            // Создаём таблицу .DBF с заданной структурой
            odbf.WriteHeader();
            odbf.Close();

            // Формируем запрос Insert Into () Values()

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Insert Into {0} (", tableName);
            int n = 0;

            foreach (KeyValuePair <string, string> kvp in Attributes)
            {
                sb.AppendFormat("{0}{1}", n++ != 0?", ": "", kvp.Key);
            }
            sb.Append(")\r\n Values( ");
            n = 0;
            foreach (KeyValuePair <string, string> kvp in Attributes)
            {
                sb.AppendFormat("{0}{1}", n++ != 0 ? ", " : "", kvp.Value);
            }
            sb.Append(");");

            Log("Выполняется запрос:\r\n{0}", sb.ToString());

            // Записываем атрибуты в файл .dbf
            using (OleDbConnection Connection =
                       new OleDbConnection(string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Extended Properties=dbase 5.0;Data Source={0};",
                                                         Settings.Attachments)))
            {
                Connection.Open();
                using (OleDbCommand Command = new OleDbCommand(sb.ToString(), Connection))
                {
                    Command.ExecuteNonQuery();
                    Connection.Close();
                }
            }

            sb.Clear();
            sb = null;
        }
Exemplo n.º 9
0
    public override string ToString()
    {
        StringBuilder __sb    = new StringBuilder("TimRoom(");
        bool          __first = true;

        if (Tid != null && __isset.tid)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Tid: ");
            __sb.Append(Tid == null ? "<null>" : Tid.ToString());
        }
        if (FounderTid != null && __isset.founderTid)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("FounderTid: ");
            __sb.Append(FounderTid == null ? "<null>" : FounderTid.ToString());
        }
        if (HostsTid != null && __isset.HostsTid)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("HostsTid: ");
            __sb.Append(HostsTid);
        }
        if (MembersTid != null && __isset.membersTid)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("MembersTid: ");
            __sb.Append(MembersTid);
        }
        if (Headurl != null && __isset.headurl)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Headurl: ");
            __sb.Append(Headurl);
        }
        if (RoomName != null && __isset.roomName)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("RoomName: ");
            __sb.Append(RoomName);
        }
        if (Desc != null && __isset.desc)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Desc: ");
            __sb.Append(Desc);
        }
        if (CreateTime != null && __isset.createTime)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("CreateTime: ");
            __sb.Append(CreateTime == null ? "<null>" : CreateTime.ToString());
        }
        if (ExtraList != null && __isset.extraList)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("ExtraList: ");
            __sb.Append(ExtraList);
        }
        if (ExtraMap != null && __isset.extraMap)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("ExtraMap: ");
            __sb.Append(ExtraMap);
        }
        __sb.Append(")");
        return(__sb.ToString());
    }
Exemplo n.º 10
0
        /// <summary>
        /// Получить состояние платежа в системе ГОРОД
        /// </summary>
        /// <returns></returns>
        public byte GetGorodState()
        {
            string GorodCommandText = "select [state] from [gorod].[dbo].payment where tid = " + Tid.ToString();
            byte   GorodState       = 12;

            using (SqlConnection GorodConnection = new SqlConnection(Settings.GorodConnectionString))
                using (SqlCommand GorodCommand = new SqlCommand(GorodCommandText, GorodConnection))
                {
                    GorodConnection.Open();
                    using (SqlDataReader DataReader = GorodCommand.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        if (DataReader.HasRows)
                        {
                            if (DataReader.Read())
                            {
                                GorodState = (byte)DataReader.GetInt32(0);                         // Т.к. параметр 1
                            }
                        }
                    }
                }

            return(GorodState);
        }
Exemplo n.º 11
0
        //Turn into a string
        public string makeMeAString()
        {
            string res = "";

            res += sequenceno.ToString();
            res += ",";
            //res += ts.ToString();
            //res += ",";
            //res += mode.ToString();
            //res += ',';
            res += tagID.ToString();
            res += ',';
            //res += Epc.ToString();
            //res += ',';
            //res += readerID.ToString();
            //res += ',';

            res += AntennaPortNumber.ToString();
            res += ',';
            res += ChannelInMhz.ToString();
            res += ',';
            //res += rawX.ToString();
            //res += ',';
            //res += rawY.ToString();
            //res += ',';
            //res += rawZ.ToString();
            //res += ',';
            //res += CorrectedPercentX.ToString();
            //res += ',';
            //res += CorrectedPercentY.ToString();
            //res += ',';
            //res += CorrectedPercentZ.ToString();
            //res += ',';
            //res += XinG.ToString();
            //res += ',';
            //res += YinG.ToString();
            //res += ',';
            //res += ZinG.ToString();
            //res += ',';
            res += trfid;
            res += ',';
            //res += FirstSeenTime.ToString();
            //res += ',';
            //res += LastSeenTime.ToString();
            //res += ',';
            res += PeakRSSIInDbm.ToString();
            res += ',';
            //res += TagSeenCount.ToString();
            //res += ',';
            res += Tid.ToString();
            res += ',';
            res += RfDopplerFrequency.ToString("F");
            res += ',';
            res += PhaseAngleInRadians.ToString("F");
            res += ',';
            res += tref;
            //res += ',';
            //res += Crc.ToString();
            //res += ',';
            //res += PcBits.ToString();
            //res += ',';
            //res += GpsCoordinates.ToString();
            //res += ',';
            //res += ModelDetails.ModelName;
            return(res);
        }
Exemplo n.º 12
0
    public override string ToString()
    {
        StringBuilder __sb    = new StringBuilder("TimUserBean(");
        bool          __first = true;

        if (Tid != null && __isset.tid)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Tid: ");
            __sb.Append(Tid == null ? "<null>" : Tid.ToString());
        }
        if (Nickname != null && __isset.nickname)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Nickname: ");
            __sb.Append(Nickname);
        }
        if (Remarkname != null && __isset.remarkname)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Remarkname: ");
            __sb.Append(Remarkname);
        }
        if (Brithday != null && __isset.brithday)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Brithday: ");
            __sb.Append(Brithday);
        }
        if (__isset.gender)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Gender: ");
            __sb.Append(Gender);
        }
        if (Headurl != null && __isset.headurl)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Headurl: ");
            __sb.Append(Headurl);
        }
        if (Area != null && __isset.area)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Area: ");
            __sb.Append(Area == null ? "<null>" : Area.ToString());
        }
        if (Headbyte != null && __isset.headbyte)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("Headbyte: ");
            __sb.Append(Headbyte);
        }
        if (PhotoBytes != null && __isset.photoBytes)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("PhotoBytes: ");
            __sb.Append(PhotoBytes);
        }
        if (ExtraList != null && __isset.extraList)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("ExtraList: ");
            __sb.Append(ExtraList);
        }
        if (ExtraMap != null && __isset.extraMap)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("ExtraMap: ");
            __sb.Append(ExtraMap);
        }
        __sb.Append(")");
        return(__sb.ToString());
    }