Exemplo n.º 1
0
        public ActionResult SetMetersValues(SetMetersValuesRequest request)
        {
            SetMetersValuesResponse response;

            if (request.meters != null && request.meters.Length > 0)
            {
                var meters = request.meters.Select(m => new MeterDtoDa()
                {
                    meterId = m.meterId, value = Misc.ToDouble(m.value),
                }).ToArray();

                response =
                    NativeSql.Exec("j2me_setMetersValues",
                                   new { session = request.session, rootingId = request.rootingId, meters, })
                    .OneRow <SetMetersValuesResponse>();
            }
            else
            {
                response = new SetMetersValuesResponse()
                {
                    ok = false, message = "Не верные значения счетчиков",
                };
            }

            return(Json(response));
        }
 public void ChangeDetails(int userId, int contractId, string contractName, int areaId, string addressStreet, string addressBuilding, string addressFlat, string phone, string changeRemarks, int archiveId, string budgetType)
 {
     NativeSql.Exec("contracts_changeDetails",
                    new
     {
         userId, contractId, contractName, areaId, addressStreet, addressBuilding, addressFlat, phone, changeRemarks, archiveId, budgetType
     });
 }
Exemplo n.º 3
0
        public ActionResult GetCloseRootingReasons(GetCloseRootingReasonsRequest request)
        {
            var reasons  = NativeSql.Exec("j2me_getCloseRootingReasons", new { session = request.session, rootingId = request.rootingId, }).Rows <CloseReasonDto>();
            var response = new GetCloseRootingResponse()
            {
                reasons = reasons,
            };

            return(Json(response));
        }
Exemplo n.º 4
0
        public void SaveAreasHouses(AreasHousesDa[] houses)
        {
            houses.ToList().ForEach((t) =>
            {
                t.AddressBuilding = t.AddressBuilding ?? "";
                t.AddressStreet   = t.AddressStreet ?? "";
            });

            NativeSql.Exec("areas_saveHouses", new { houses, });
        }
Exemplo n.º 5
0
        public ActionResult Login(LoginRequest loginRequest)
        {
            var loginResponse = NativeSql.Exec(
                "j2me_loginAndReturnSession",
                new
            {
                login = loginRequest.login, password = loginRequest.password,
            }).OneRow <LoginResponse>();

            return(Json(loginResponse));
        }
Exemplo n.º 6
0
        public ActionResult GetRootingsArrayEnclosed(GetRootingsRequest getRootingsRequest)
        {
            var getRootingsResponse = NativeSql.Exec("j2me_getRootings", new { session = getRootingsRequest.session, }).Rows <RootingDto>();

            GetRootingsResponseArrayEmbedded embedded = new GetRootingsResponseArrayEmbedded()
            {
                array = getRootingsResponse,
            };

            return(Json(embedded));
        }
Exemplo n.º 7
0
        public ActionResult CloseRooting(CloseRootingRequest request)
        {
            NativeSql.Exec("j2me_closeRooting", new { session = request.session, rootingId = request.rootingId, reasonId = request.reasonId, });

            CloseRootingResponse response = new CloseRootingResponse()
            {
                ok = true, message = ""
            };

            return(Json(response));
        }
 public bool SetNewValue(string key, string value, int userId)
 {
     try
     {
         NativeSql.Exec("settings_setNewValue", new { key, value, userId, });
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public CreateContractDa CreateWithSubscriber(
            string type,
            int userId,
            string subscriberName, string subscriberPassportNumber, string subscriberPassportWhere, DateTime?subscriberPassportDate,
            string subscriberAddressStreet, string subscriberAddressBuilding, string subscriberAddressFlat, string subscriberPhone,
            string subscriberInn, string subscriberUgkns, string subscriberMfo, bool subscriberInvoice,

            string contractName,
            int contractAreaId, string contractAddressStreet, string contractAddressBuilding, string contractAddressFlat, string contractPhone,
            string tariffId, int peopleRegistered,
            double fixedConsumption,

            CreateContractMeterInfoDa[] meters,
            CPCAM_TariffOptionDa[] options,
            double registrationDebt,

            int archiveId, string budgetType, bool hasSewage, double allowance, string allowanceReason,
            double fixedConsumptionSewage,

            string subscriberUgknsName, string subscriberBankCode, string subscriberBankName, string subscriberBankAccount,
            DateTime registrationDate
            )
        {
            var res = NativeSql.Exec
                      (
                "contracts_createWithSubscriber",
                new
            {
                userId,
                type,
                subscriberName, subscriberPassportNumber, subscriberPassportWhere, subscriberPassportDate,
                subscriberAddressStreet, subscriberAddressBuilding, subscriberAddressFlat, subscriberPhone,
                subscriberInn, subscriberUgkns, subscriberMfo, subscriberInvoice,

                contractName,
                contractAreaId, contractAddressStreet, contractAddressBuilding, contractAddressFlat, contractPhone,
                tariffId, peopleRegistered, fixedConsumption,
                meters,
                options,
                registrationDebt,

                archiveId, budgetType, hasSewage, allowance, allowanceReason,
                fixedConsumptionSewage,

                subscriberUgknsName, subscriberBankCode, subscriberBankName, subscriberBankAccount,

                registrationDate
            }
                      )
                      .OneRow <CreateContractDa>();

            return(res);
        }
Exemplo n.º 10
0
 public bool CreateOrder(int userId)
 {
     try
     {
         NativeSql.Exec("orders_create", new { userId, });
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 11
0
 public bool CloseMonth(int userId)
 {
     try
     {
         NativeSql.Exec("orders_closeMonth", new { userId, });
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public ReconciliationReport GetReconciliationReport(DateTime dateStart, DateTime dateEnd)
        {
            dateStart = dateStart.Date;
            dateEnd   = dateEnd.Date;
            var report = new ReconciliationReport()
            {
                DateStart = dateStart, DateEnd = dateEnd
            };

            report.Report = NativeSql.Exec("accountant_getReconciliationReport", new { dateStart, dateEnd, }).Rows <ReconciliationReportItemDa>();
            return(report);
        }
 public bool RegisterTransaction(int subagentId, double amount, int contractId, int userId)
 {
     try
     {
         NativeSql.Exec("subagents_registerTransaction", new { subagentId, amount, contractId, userId, });
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 14
0
        //private string transactionsPath = "XML/BODY/TRANSACTIONS/";

        public string GetResponse(string request, string ip)
        {
            var billingTerminalsDa = NativeSql.Exec("terminals_getTerminalByIp", new { ip }).OneRow <BillingTerminalsDa>();

            if (billingTerminalsDa == null)
            {
                return(GetResponseWithErrorMessage(string.Format("Your service {0} has no access. Contact customs service to provider more information", ip), 400, GetDate(DateTime.Now), "", "", ""));
            }
            else
            {
                XmlDocument xml = new XmlDocument();
                xml.LoadXml(request);

                string qidString = GetValueFromXml(qidPath, xml);

                var billingRequest = NativeSql.Exec("terminals_getRequest", new { subagentId = billingTerminalsDa.SubagentId, qid = qidString, }).OneRow <BillingRequestDa>();

                if (billingRequest != null)
                {
                    Logger.Write("Duplicate request");
                    return(billingRequest.Response);
                }
                else
                {
                    billingRequest            = new BillingRequestDa();
                    billingRequest.Request    = request;
                    billingRequest.Response   = "";
                    billingRequest.Date       = DateTime.Now;
                    billingRequest.SubagentId = billingTerminalsDa.SubagentId;

                    ProcessRequest(xml, billingRequest, billingTerminalsDa);

                    if (billingRequest.ProcessStatus != 400 && billingRequest.ProcessStatus != 250)
                    {
                        NativeSql.Exec("terminals_saveRequest", new
                        {
                            date          = billingRequest.Date,
                            operation     = billingRequest.Operation,
                            processStatus = billingRequest.ProcessStatus,
                            qid           = billingRequest.Qid,
                            request       = billingRequest.Request,
                            response      = billingRequest.Response,
                            subagentId    = billingRequest.SubagentId,
                            amount        = billingRequest.Amount,
                            contractId    = billingRequest.ContractId,
                        });
                    }

                    return(billingRequest.Response);
                }
            }
        }
Exemplo n.º 15
0
        public ActionResult RegisterPayment(RegisterPaymentRequest request)
        {
            if (request.amount > 0)
            {
                NativeSql.Exec("j2me_registePayment", new { session = request.session, rootingId = request.rootingId, amount = request.amount, });
            }

            RegisterPaymentResponse response = new RegisterPaymentResponse()
            {
                ok = true, message = "",
            };

            return(Json(response));
        }
Exemplo n.º 16
0
 public void ChangeInfo(int userId, int subscriberId, string name, string passportNumber, string passportWhere, DateTime?passportDate, string addressStreet, string addressBuilding, string addressFlat, string phone, string inn, string ugkns, string mfo, bool invoice, string changeRemarks
                        , string ugknsName, string bankCode, string bankName, string bankAccount)
 {
     NativeSql.Exec("subscribers_changeInfo",
                    new
     {
         userId, subscriberId,
         name, passportNumber, passportWhere, passportDate,
         addressStreet, addressBuilding, addressFlat, phone,
         inn, ugkns, mfo, invoice,
         changeRemarks,
         ugknsName, bankCode, bankName, bankAccount
     });
 }
Exemplo n.º 17
0
        private bool ContractExists(int contractId, out string subscriberName)
        {
            subscriberName = "";

            var s =
                NativeSql.Exec("terminals_getSubscriberNameByContractId", new { contractId, }).OneRow
                <SubscriberNameByContractIdDa>();

            if (s != null)
            {
                subscriberName = s.SubscriberName;
            }

            return(s != null);
        }
        public ReconciliationByUserReport GetReconciliationByUserReport(DateTime dateStart, DateTime dateEnd, int userId, int subagentId)
        {
            dateStart = dateStart.Date;
            dateEnd   = dateEnd.Date;

            return(new ReconciliationByUserReport()
            {
                DateStart = dateStart,
                DateEnd = dateEnd,
                UserId = userId,
                SubagentId = subagentId,
                Transactions =
                    NativeSql.Exec("accountant_getReconciliationByUserReport", new { dateStart, dateEnd, userId, subagentId, }).Rows <TransactionDa>(),
            });
        }
Exemplo n.º 19
0
 public CreateUserResultDa CreateUser(int userId, string login, string password, string role, string name, string passport, string address, string phone)
 {
     return
         (NativeSql.Exec("users_create",
                         new
     {
         userId,
         login,
         password,
         role,
         name,
         passport,
         address,
         phone,
     }).OneRow <CreateUserResultDa>());
 }
        public CreateContractDa AddContractToSubscriber(
            int userId, int subscriberId, string contractName,
            int contractAreaId, string contractAddressStreet, string contractAddressBuilding,
            string contractAddressFlat, string contractPhone, string tariffId, int peopleRegistered,
            double fixedConsumption, CreateContractMeterInfoDa[] meters, CPCAM_TariffOptionDa[] options, string registrationDebt,
            int archiveId, string budgetType, bool hasSewage, double allowance, string allowanceReason,
            double fixedConsumptionSewage,
            DateTime registrationDate
            )
        {
            var res = NativeSql.Exec
                      (
                "contracts_addToSubscriber",
                new
            {
                userId,
                subscriberId,
                contractName,
                contractAreaId,
                contractAddressStreet,
                contractAddressBuilding,
                contractAddressFlat,
                contractPhone,
                tariffId,
                peopleRegistered,
                fixedConsumption,
                meters,
                options,
                registrationDebt,

                archiveId, budgetType, hasSewage, allowance, allowanceReason,
                fixedConsumptionSewage,
                registrationDate
            }
                      )
                      .OneRow <CreateContractDa>();

            return(res);
        }
 public TransactionDa[] GetLastTransactions()
 {
     return(NativeSql.Exec("subagents_getLastTransactions").Rows <TransactionDa>());
 }
Exemplo n.º 22
0
 public InvoiceSeriesDa[] GetInvoiceSeriesDictionary()
 {
     return(NativeSql.Exec("invoices_getSeries").Rows <InvoiceSeriesDa>());
 }
Exemplo n.º 23
0
 public BillingPeriodDa[] GetClosingPeriods()
 {
     return(NativeSql.Exec("billing_getClosingPeriodsDictionary").Rows <BillingPeriodDa>());
 }
Exemplo n.º 24
0
 public void ChangeTariffOptionPrice(int userId, string tariffOptionId, double litersPerDay)
 {
     NativeSql.Exec("tariffsOptions_changePrice", new { userId, tariffOptionId, litersPerDay, });
 }
Exemplo n.º 25
0
 public void VisaDecline(int changeId, int userId)
 {
     NativeSql.Exec("settings_visaDecline", new { changeId, userId, });
 }
        public SubagentsDictionaryDa[] GetSubagentsDictionary()
        {
            var subagents = NativeSql.Exec("subagents_getDictionary").Rows <SubagentsDictionaryDa>();

            return(subagents);
        }
Exemplo n.º 27
0
        public Dictionary <string, string> GetAsDictionary()
        {
            var settings = NativeSql.Exec("settings_getAsDictionary").Rows <ShortSettingsItem>();

            return(settings.ToDictionary(key => key.KeyName, value => value.StringValue));
        }
 public void ChangeInfo(int id, string name)
 {
     NativeSql.Exec("subagents_changeInfo", new { id, name, });
 }
 public void RegisterPopup(int userId, int subagentId, double amount, string remarks)
 {
     NativeSql.Exec("subagents_registerPopup", new { userId, subagentId, amount, remarks });
 }
 public void Create(string name, string remarks, bool hasBalance, double currentBalance)
 {
     NativeSql.Exec("subagents_create", new { name, remarks, hasBalance, currentBalance, });
 }