예제 #1
0
        public JsonResult Dowload(Abonent abonent)
        {
            new GeneratorDocs(
                new RenderViewString(
                    "Contracts",
                    new DocsName(
                        abonent.Customer.Type.ToString(),
                        ""
                        ).ReturnDocumentType(),
                    new DocumentSubscriptionModel(
                        new AbonentGenaratorDate(
                            new SqlConnection(
                                ConfigurationManager.ConnectionStrings["DataConnect"].ConnectionString),
                            abonent
                            ).Result(),
                        new ConvertImageBase(
                            abonent.Customer.signature
                            )
                        ).ResultImage()
                    ),
                (abonent.Customer.Name + " " + abonent.Customer.LastName)

                ).Result();
            return(null);
        }
예제 #2
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            var firstAbonent = new Abonent {
                FullName = "Сидоров Петр Иванович", IIN = "891521456632", Address = @"ул. Улы-Дала 18\1"
            };
            var secondAbonent = new Abonent {
                FullName = "Пупкина Снежана Евгеньевна", IIN = "651258630002", Address = @"ул. Ташенова 7\57"
            };
            var thirdAbonent = new Abonent {
                FullName = "Батыров Серик Батырович", IIN = "785563221011", Address = @"пр-т Тауельсыздык 20\1"
            };

            modelBuilder.Entity <Abonent>().HasData(firstAbonent, secondAbonent, thirdAbonent);

            var firstReceipt = new Receipt {
                AbonentId = firstAbonent.Id, BillingMonth = "Ноябрь 2019", ElectricityDebt = 9985, WaterDebt = 6328, InternetDebt = 13615, GasDebt = 2358
            };
            var secondReceipt = new Receipt {
                AbonentId = secondAbonent.Id, BillingMonth = "Ноябрь 2019", ElectricityDebt = 8898, WaterDebt = 9922, InternetDebt = 18000, GasDebt = 5018
            };
            var thirdReceipt = new Receipt {
                AbonentId = thirdAbonent.Id, BillingMonth = "Ноябрь 2019", ElectricityDebt = 11625, WaterDebt = 8839, InternetDebt = 15420, GasDebt = 4568
            };

            modelBuilder.Entity <Receipt>().HasData(firstReceipt, secondReceipt, thirdReceipt);
        }
예제 #3
0
        private void Connection(object sender, EventArgsCall e)
        {
            Abonent outAbonent = sender as Abonent;

            if (outAbonent != null)
            {
                outAbonent.Port.State = PortState.Call;

                Abonent inAbonent = PublicAbonents().First(x => x.Port.PhoneNumber == e.InPhoneNumber);

                if (inAbonent != null)
                {
                    if (inAbonent.Port.State == PortState.Connected &&
                        inAbonent.Terminal.State == TerminalState.InitialState)
                    {
                        inAbonent.Port.State = PortState.Call;
                    }
                    else
                    {
                        throw new Exception("The subscriber is temporarily unavailable.");
                    }
                }
                Console.WriteLine("АТС:  Звонок начался.......");
            }
        }
예제 #4
0
            static void Main(string[] args)
            {
                Abonent abonent1 = new Abonent(3476678863, "Федоров", "Александр", "Иванович", "Осенняя 10", 4546567666685786, 1000, 5000,
                                               10, 10, 55, 1, 55, 32);
                Abonent abonent2 = new Abonent(3476674463, "Сур", "Алексей", "Иванович", "Украинская 10", 6546567607685786, 100, 500,
                                               16, 13, 48, 1, 20, 32);
                Abonent abonent3 = new Abonent(3455678863, "Чернова", "Анна", "Петровна", "Мамона 167", 4544567606685786, 300, 7,
                                               0, 0, 0, 4, 25, 32);
                Abonent abonent4 = new Abonent(2476678860, "Алексеева", "Анастасия", "Викторовна", "Тихая 89", 6546567699685786, 10, 700,
                                               0, 0, 0, 6, 15, 32);

                Abonents abonents = new Abonents();

                abonents.inputAbontData(abonent1);
                abonents.inputAbontData(abonent2);
                abonents.inputAbontData(abonent3);
                abonents.inputAbontData(abonent4);
                abonents.Print();

                Console.Write("Введите время городских разговоров абонента :\nЧасы-");
                int hours = Convert.ToInt32(Console.ReadLine());

                Console.Write("Минуты-");
                int min = Convert.ToInt32(Console.ReadLine());

                Console.Write("Секунды-");
                int sec = Convert.ToInt32(Console.ReadLine());

                abonents.PrintCityTalk(hours, min, sec);
                Console.WriteLine();
                Console.WriteLine("Абоненты использовавшие междугороднюю связь:");
                Console.ForegroundColor = ConsoleColor.Red;
                abonents.PrintIntercityTalk();
                Console.ReadLine();
            }
예제 #5
0
 public void TearDown()
 {
     book1 = null;
     book2 = null;
     lib   = null;
     ab1   = null;
 }
예제 #6
0
 public Chat()
 {
     InitializeComponent();
     this.ActiveControl    = InputName;
     abonentCurrent        = new Abonent();
     abonentCurrent.status = Status.Offline;
 }
예제 #7
0
        public async Task <IHttpActionResult> AddPersonalAccount(PersonalAccountRequest personalAccountRequest)
        {
            //ФИО
            var apartmentOwnerFullName = personalAccountRequest.ApartmentOwnerFullName;
            //номер квартиры
            var apartmentNumber = personalAccountRequest.ApartmentNumber;

            var personalAccountResult = await OhConfigurator.Container.Resolve <IAbonentService>()
                                        .GetPersonalAccount(personalAccountRequest.PaymentCode, apartmentOwnerFullName, apartmentNumber);

            if (!personalAccountResult.Success)
            {
                return(NotFound());
            }

            var userIdentityid = User.Identity.GetUserId <int>();

            using (var context = new ApplicationDbContext())
            {
                var abonent = new Abonent
                {
                    OrganizationId       = personalAccountResult.Content.OrganizationId,
                    ApartmentFullAddress = personalAccountResult.Content.ApartmentFullAddress,
                    ApplicationUserId    = userIdentityid,
                    PaymentCode          = personalAccountResult.Content.PaymentCode,
                    PersonalAccountId    = personalAccountResult.Content.Id
                };
                context.Abonent.Add(abonent);
                await context.SaveChangesAsync();

                return(Ok(abonent.Id));
            }
        }
예제 #8
0
        public int Add(Abonent abonent)
        {
            using (_cmd = _connection.CreateCommand())
            {
                _cmd.CommandText = "INSERT INTO Abonent(ClientAdress, SecondName, FirstName, Patronymic, BirthDay, AbonentCode)" +
                                   "VALUES (@addressCode, @lastname, @firstname, @midname, @birthdate, @code);";
                _cmd.Parameters.Add(new SqlParameter("@addressCode", SqlDbType.Int));
                _cmd.Parameters.Add(new SqlParameter("@lastname", SqlDbType.NVarChar, 100));
                _cmd.Parameters.Add(new SqlParameter("@firstname", SqlDbType.NVarChar, 100));
                _cmd.Parameters.Add(new SqlParameter("@midname", SqlDbType.NVarChar, 100));
                _cmd.Parameters.Add(new SqlParameter("@birthdate", SqlDbType.DateTime));
                _cmd.Parameters.Add(new SqlParameter("@code", SqlDbType.Int));

                _cmd.Prepare();

                _cmd.Parameters[0].Value = abonent.AddressCode;
                _cmd.Parameters[1].Value = abonent.LastName;
                _cmd.Parameters[2].Value = abonent.FirstName;
                _cmd.Parameters[3].Value = abonent.MidName;
                _cmd.Parameters[4].Value = abonent.BirthDate;
                _cmd.Parameters[5].Value = abonent.Code;

                _cmd.ExecuteNonQuery();
            }
            return(abonent.Code);
        }
예제 #9
0
        /// <summary>
        /// Сопоставление пользователей системы, абонентам телефонии, с формированием словаря соответствий
        /// </summary>
        /// <param name="users">Список пользователей системы, с ролью работы с телефонией</param>
        private void CreateDictionary(List <IUser> users)
        {
            List <Abonent> abonents = _apiConnect.GetAllAbonents().Result;

            //TelephonyManager.TelephonyLog.Debug(String.Format("Count Abonents = {0}", abonents.Count.ToString()));
            //lock (AbonentsConnector)
            //{
            //AbonentsConnector = null;
            AbonentsConnector = new Dictionary <User, Abonent>();
            //}
            //TelephonyManager.TelephonyLog.Debug(String.Format("AbonentsConnector = {0}", AbonentsConnector.GetType().ToString()));
            foreach (User user in users)
            {
                //DEBUG: сравнение пользователей ELMA  и абонентов Билайн проходит по полю Рабочий телефон(ELMA) и Добавочный номер (Билайн)
                Abonent ab = abonents.Find(x => x.extension == user.WorkPhone);
                if (ab != default(Abonent))
                {
                    lock (AbonentsConnector)
                    {
                        AbonentsConnector.Add(user, ab);
                    }
                }
            }
            //TelephonyManager.TelephonyLog.Debug(String.Format("Count Abonents = {0}", AbonentsConnector.Count.ToString()));
        }
예제 #10
0
        public ActionResult AddAbonent(Abonent abonent, HttpPostedFileBase file)
        {
            if (abonent.Name != null && abonent.SurName != null && abonent.Number != null)
            {
                using (DatabaseContext ctx = new DatabaseContext())
                {
                    Abonent addedAbonent = new Abonent
                    {
                        Name    = abonent.Name,
                        SurName = abonent.SurName,
                        Number  = abonent.Number
                    };
                    if (file != null)
                    {
                        //формирование пути для сохранения нового файла
                        string path = Server.MapPath($"~/Images/{file.FileName}");
                        file.SaveAs(path);
                        addedAbonent.Image = file.FileName;
                    }
                    else
                    {
                        addedAbonent.Image = "standart.png";
                    }

                    ctx.Abonents.Add(addedAbonent);
                    ctx.SaveChanges();
                    abonents = ctx.Abonents.ToList();
                }
            }

            return(View("Index", abonents));
        }
예제 #11
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                string param_name        = collection.Get("Name");
                IRepository <Group> repo = new GroupRepository();
                Group group = new Group();
                group      = repo.GetById(id);
                group.Name = param_name;
                group.ClearAbonents();
                if (collection.Get("Abonents") != null)
                {
                    string   param_abonents = collection.Get("Abonents");;
                    string[] arrayAbonents  = param_abonents.Split(',');

                    foreach (string str in arrayAbonents)
                    {
                        int     AbonentID = Convert.ToInt32(str);
                        Abonent abonent   = new Abonent();
                        IRepository <Abonent> repo_abonent = new AbonentRepository();
                        abonent = repo_abonent.GetById(AbonentID);

                        group.Abonents.Add(abonent);
                    }
                }

                repo.Update(group);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #12
0
파일: Billing.cs 프로젝트: JillyMan/DOT_NET
 public void RegisterUser(Abonent a, int startBallance)
 {
     if (a == null && startBallance < 0)
     {
         throw new ArgumentException("Abonent null, startBallnce < 0");
     }
     Abonents.Add(new AbonentInfo(a, startBallance));
 }
예제 #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            Abonent abonent = db.Abonents.Find(id);

            db.Abonents.Remove(abonent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #14
0
        public ActionResult Add(Abonent abonent)
        {
            var lastAbonent = abonents.LastOrDefault();

            abonent.Id = lastAbonent is null ? 1 : lastAbonent.Id + 1;
            abonents.Add(abonent);
            return(RedirectToAction("Index"));
        }
예제 #15
0
 public void Show(Abonent ab)
 {
     Console.WriteLine($"{ab.LastName} {ab.FirstName} {ab.MidleName}");
     Console.WriteLine($"ИНН->{ ab.IdNumber}--Карта->{ ab.CardNumber}--Дебет->{ ab.CardDebet}--Кредит->{ ab.CardCredit}");
     Console.WriteLine($"Время междугородных разговоров->{ab.IntercityTalkTimeHours}:{ab.IntercityTalkTimeMin}:{ab.IntercityTalkTimeSec}");
     Console.WriteLine($"Время городских разговоров->{ab.CityTalkTimeHours}:{ab.CityTalkTimeMin}:{ab.CityTalkTimeSec}");
     Console.WriteLine();
 }
예제 #16
0
 public AbonentForm(ref Abonent abonent) : this()
 {
     if (abonent == null)
     {
         abonent = new Abonent();
     }
     _abonent = abonent;
 }
예제 #17
0
 public void AddAbonent(Abonent item)
 {
     if (!_abonents.Contains(item))
     {
         _abonents.Add(item);
     }
     SubscriberEvents(item);
 }
예제 #18
0
 public AbstractCall(Abonent sender, Abonent receiver, int duration,
                     DateTime date, TypeCall type)
 {
     Sender   = sender;
     Receiver = receiver;
     Duration = duration;
     Date     = date;
     Type     = type;
 }
예제 #19
0
        private void AddAbonent()
        {
            Abonent newAbonent = null;

            if (new AbonentForm(ref newAbonent).ShowDialog() == DialogResult.OK)
            {
                _abonents.Add(newAbonent);
            }
        }
예제 #20
0
 private void SubscriberEvents(Abonent item)
 {
     item.BeginningCall         += Connection;
     item.Called                += Call;
     item.FinishingCall         += RegistrationCall;
     item.BrowsingCallsInfo     += ProvideReportToSubscriber;
     item.FiltringCallByAbonent += Abonent_FiltringCallByAbonent;
     item.FiltringCallByDate    += Abonent_FiltringCallByDate;
 }
예제 #21
0
 public ActionResult Edit([Bind(Include = "ID,INN,TelDot,schet")] Abonent abonent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(abonent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(abonent));
 }
예제 #22
0
        static void Main(string[] args)
        {
            ITariff   tariff       = new Tariff();
            IOperator teleOperator = new Operator();
            IStation  station      = new Station();

            ILogger logger = new ConsoleLogger();

            teleOperator.AddStation(station);

            IAbonent abonent1 = new Abonent(tariff, "+375446465765", new Terminal());
            IAbonent abonent2 = new Abonent(tariff, "+375296465765", new Terminal());
            IAbonent abonent3 = new Abonent(tariff, "+375336465765", new Terminal());

            teleOperator.AddAbonent(abonent1, station);
            teleOperator.AddAbonent(abonent2, station);
            teleOperator.AddAbonent(abonent3, station);

            abonent1.TopUpBalance(40);
            abonent2.TopUpBalance(10);

            abonent1.Terminal.Connect();
            abonent2.Terminal.Connect();

            foreach (var port in station.GetPortStatusList())
            {
                logger.Log(port);
            }

            abonent1.Terminal.Call("+375296465765");

            logger.Log("");

            abonent2.Terminal.Call("+375336465765");
            logger.Log("");
            abonent1.Terminal.Call("+375296465765");
            logger.Log("");
            abonent1.Terminal.Call("+375296465765");
            logger.Log("");
            foreach (var port in station.GetPortStatusList())
            {
                logger.Log(port);
            }

            ICollection <Call> calls = abonent1.GetCallReport().Filter(FilterParameters.ABONENT, "+375296465765");

            foreach (var call in calls)
            {
                call.Write(logger);
            }

            teleOperator.DeleteAbonent(abonent3);

            Console.ReadKey();
        }
예제 #23
0
        public static int GetBallance(this Billing billing, Abonent abonent)
        {
            var info = billing.Abonents.FirstOrDefault(x => x.Abonent.Equals(abonent));

            if (info == null)
            {
                throw new Exception(abonent + " no register in billing system");
            }

            return(info.Ballance);
        }
예제 #24
0
        public async Task <Result <bool> > DeleteAbonentGroupAsync(User user, Abonent abonent, Group abonentGroup)
        {
            if (!user.Abonents.Any(a => a.Groups == abonentGroup))
            {
                abonent.RemoveAbonentGroup(abonentGroup);
                await db.SaveChangesAsync();

                return(Result <bool> .Success(true));
            }
            return(Result <bool> .Fail(new string[] { "AbbonentGroup not found" }));
        }
예제 #25
0
        public ActionResult Create([Bind(Include = "ID,INN,TelDot,schet")] Abonent abonent)
        {
            if (ModelState.IsValid)
            {
                db.Abonents.Add(abonent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(abonent));
        }
예제 #26
0
파일: Billing.cs 프로젝트: JillyMan/DOT_NET
        private void WriteOffMoney(Abonent abonent, int cost)
        {
            if (abonent == null || cost < 0)
            {
                throw new ArgumentNullException("Abonent is null, cost < 0");
            }

            var a = Abonents.FirstOrDefault(x => x.Abonent.Equals(abonent));

            a.Ballance -= cost;
        }
예제 #27
0
        public static IEnumerable <ReportByCall> GetReports(this Billing billing, Abonent abonent)
        {
            if (abonent == null)
            {
                throw new ArgumentNullException();
            }

            return(billing.outgoingСalls
                   .Where(x => x.Sender.Equals(abonent))
                   .Select(x => new ReportByCall(x.Receiver, x.Duration, x.Price)));
        }
        public void Post([FromBody] Abonent ab)
        {
            if (ab == null)
            {
                return;
            }
            var abonents = AbonentModels.GetData(); // Получить данные

            abonents.Add(ab);                       // Добавить абонента
            AbonentModels.PostData(abonents);       // Сохранить данные в файл
        }
예제 #29
0
파일: Billing.cs 프로젝트: JillyMan/DOT_NET
        public void EndOfCall(Abonent a1, Abonent a2, int duration)
        {
            if (a1 == null || a2 == null || duration < 0)
            {
                throw new ArgumentException();
            }

            int priceCall = TariffPlan.GetPrice(duration);

            WriteOffMoney(a1, priceCall);
            outgoingСalls.Add(new OutgoingСall(a1, a2, duration, DateTime.Now, TariffPlan.GetPrice(duration)));
        }
        [HttpPut("{accountCD}")] // изменить запись
        public void Put(string accountCD, [FromBody] Abonent ab)
        {
            if (ab is null || string.IsNullOrWhiteSpace(accountCD))
            {
                return;
            }
            var abonents = AbonentModels.GetData();
            int ind      = abonents.FindIndex(a => a.ACCOUNTCD == accountCD);

            abonents[ind] = ab;               // изменить абонента
            AbonentModels.PostData(abonents); // Сохранить данные в файл
        }