main()
	{
	    publisher p = new publisher();
	    subscriber s1 = new subscriber(p);
	    subscriber s2 = new subscriber(p);
	    p.process();

	}
Beispiel #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Model1 moddel             = new Model1();
            DbSet <list_station> temp = moddel.list_station;

            list_station s = temp.FirstOrDefault();

            Random r  = new Random(1000000);
            int    id = r.Next(800000, 1000000);

            subscriber sub = new subscriber();

            sub.GENIDXTSISSI   = id.ToString();
            sub.GENTYPE        = "1";
            sub.TYPEGROUP      = "1";
            sub.SUBSCRIBERNAME = id.ToString();

            moddel.subscriber.Add(sub);
            moddel.SaveChanges();
            Console.WriteLine("insert ok:GENIDXTSISSI = " + id.ToString());
            //update
            subscriber sub1 = new subscriber();

            sub1.GENIDXTSISSI   = "500001";
            sub1.GENTYPE        = "1";
            sub1.TYPEGROUP      = "1";
            sub1.SUBSCRIBERNAME = "ef updated:" + DateTime.Now.ToString();
            moddel.Entry <subscriber>(sub1).State = EntityState.Modified;
            int count = moddel.SaveChanges();

            Console.WriteLine("update ok:GENIDXTSISSI = 500001 ,SUBSCRIBERNAME = " + sub1.SUBSCRIBERNAME);


            string idv = id.ToString();
            //delete
            subscriber sub2 = (from t in moddel.subscriber where SqlFunctions.Equals(t.GENIDXTSISSI, idv) select t).First();

            moddel.Entry <subscriber>(sub2).State = EntityState.Deleted;
            count = moddel.SaveChanges();
            Console.WriteLine("delete ok:GENIDXTSISSI = " + id.ToString());



            Application.Run(new Form1());
        }
        private LoginStatus CheckCredentials(string email, string password)
        {
            lastcallEntities db = new lastcallEntities();

            subscriber s = db.subscribers.Where((x) => x.email == email).FirstOrDefault();

            if (s == null)
            {
                return(LoginStatus.UnknownUser);
            }
            if (s.password != password)
            {
                return(LoginStatus.InvalidPassword);
            }

            return(LoginStatus.Okay);
        }
Beispiel #4
0
        public ResultModel Register(subscriberModel obj)
        {
            ResultModel oOutput = new ResultModel();

            try {
                Utitilty oUtility = new Utitilty();
                obj.VerificationCode = oUtility.GetVerificationCode(3);
                var oSubscriber = dbSet.Where(m => m.EmailAddress == obj.EmailAddress && m.GurudwaraCode == obj.GurudwaraCode).FirstOrDefault();

                subscriber osubscriber = Mapper.Map <subscriber> (obj);
                if (oSubscriber == null)
                {
                    dbSet.Add(osubscriber);
                    oDB.SaveChanges();
                }

                #region Send Email Communication

                CommunicationModel oModel = new CommunicationModel();
                oModel.AlertTypeID = 1;
                oModel.Contents    = "Your Verification Code is " + obj.VerificationCode;
                oModel.Subject     = "Verication Code";
                oModel.SentTo      = obj.EmailAddress;
                oModel.WhenToSend  = DateTime.Now;
                oModel.CreatedDate = DateTime.Now;
                _svr.SendCommunication(oModel);
                #endregion

                oOutput.Data = Mapper.Map <subscriberModel> (osubscriber);
            } catch (Exception ex) {
                oOutput.Status = 0;
                oOutput.Msg    = "Data access error";
                Services.Utitilty.Error(ex);
            }
            return(oOutput);
        }
        public IHttpActionResult RegisterSubscriber()
        {
            try
            {
                NameValueCollection f = HttpContext.Current.Request.Form;
                string username       = f["username"];
                string password       = f["password"];
                string address        = f["address"];
                string phone          = f["phone"];
                string friendlyname   = f["friendlyname"];
                string foodprefs      = f["preferences"];
                string passwordq      = f["passwordq"];
                string passworda      = f["passworda"];

                byte emailoffers = Convert.ToByte(f["emailoffers"]);
                byte mailinglist = Convert.ToByte(f["mailinglist"]);
                byte textoffers  = Convert.ToByte(f["textoffers"]);

                lastcallEntities db = new lastcallEntities();
                subscriber       s  = (from x in db.subscribers where x.email == username select x).FirstOrDefault();

                if (s != null)
                {
                    return(Json(new ServerError(ServerErrorNumber.UsernameInUse)));
                }

                // The new subscriber record
                s = new subscriber()
                {
                    deliveryaddress = address,
                    email           = username,
                    emailoffers     = emailoffers,
                    friendlyname    = friendlyname,
                    onmailinglist   = mailinglist,
                    password        = password,                             //TODO: Need to encrypt
                    phone           = phone,
                    textoffers      = textoffers,
                };

                // The chosen preferences are returned as a semi-colon separated string of preference IDs
                if (!String.IsNullOrEmpty(foodprefs))
                {
                    string[] userprefs = foodprefs.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);

                    // The subscriber's food preferences
                    foodpreference[] preferences = new foodpreference[userprefs.Length];

                    for (int i = 0; i < userprefs.Length; i++)
                    {
                        preferences[i] = new foodpreference()
                        {
                            subscriberid = s.id,
                            preferenceid = Int32.Parse(userprefs[i])
                        };
                    }

                    // Entity Framework goodness. The associated foodpreferences records will be created as the subscriber record is saved.
                    s.foodpreferences = preferences;
                }
                // Save the new subscriber record and associated food preferences
                db.subscribers.Add(s);
                db.SaveChanges();
                db.Dispose();
            }
            catch (Exception X)
            {
                ServerError err = new ServerError(ServerErrorNumber.ThrewException);
                err.ErrorDetails = X.Message;
                return(Json(err, Global.JSONSettings()));
            }

            return(Json(new ServerError(), Global.JSONSettings()));
        }
Beispiel #6
0
 internal Subscriber(subscriber ros_subscriber, subscriber_callback1 <T> callback)
 {
     this.callback       = callback;
     this.ros_subscriber = ros_subscriber;
 }
Beispiel #7
0
            static void Main(string[] args)
            {
                buyer newBuyer = new buyer();

                newBuyer.lastname   = "Агафонов";
                newBuyer.firstname  = "Данил";
                newBuyer.middlename = "Алексеевич";
                newBuyer.cardnum    = "4875 4712 4545 6875";
                newBuyer.bunknum    = "6546545645212187898";
                Console.WriteLine(newBuyer.lastname);
                Console.WriteLine(newBuyer.firstname);
                Console.WriteLine(newBuyer.middlename);
                Console.WriteLine(newBuyer.cardnum);
                Console.WriteLine(newBuyer.bunknum);
                Console.WriteLine("");


                subscriber newSubscriber = new subscriber();

                Console.WriteLine("Введите id");
                newSubscriber.id = Console.ReadLine();
                Console.WriteLine("Введите фамилию");
                newSubscriber.lastname = Console.ReadLine();
                Console.WriteLine("Введите имя");
                newSubscriber.firstname = Console.ReadLine();
                Console.WriteLine("Введите отчество");
                newSubscriber.middlename = Console.ReadLine();
                Console.WriteLine("Введите адрес");
                newSubscriber.address = Console.ReadLine();
                Console.WriteLine("Введите номер кредитной карточки");
                newSubscriber.cardnum = Console.ReadLine();
                Console.WriteLine("Введите время междугородных перговоров");
                newSubscriber.ldnegotiations = Console.ReadLine();
                Console.WriteLine("Введите время городских переговоров");
                newSubscriber.fcnegotiations = Console.ReadLine();

                Console.WriteLine(newSubscriber.lastname);
                Console.WriteLine(newSubscriber.firstname);
                Console.WriteLine(newSubscriber.middlename);
                Console.WriteLine(newSubscriber.address);
                Console.WriteLine(newSubscriber.cardnum);
                Console.WriteLine(newSubscriber.ldnegotiations);
                Console.WriteLine(newSubscriber.fcnegotiations);
                Console.WriteLine("");



                petshop newZoo = new petshop();

                Console.WriteLine("Введите животное");
                newZoo.pet = Console.ReadLine();
                Console.WriteLine("Введите пол животного");
                newZoo.sex = Console.ReadLine();
                Console.WriteLine("Введите имя животного");
                newZoo.name = Console.ReadLine();
                Console.WriteLine("Введите цену животного");
                newZoo.price = Console.ReadLine();
                Console.WriteLine("Введите количествово животных");
                newZoo.quntity = Console.ReadLine();

                Console.WriteLine(newZoo.pet);
                Console.WriteLine(newZoo.sex);
                Console.WriteLine(newZoo.name);
                Console.WriteLine(newZoo.price);
                Console.WriteLine(newZoo.quntity);
                Console.ReadKey();
            }
 .Apply((subscriber, id) => new InterestedSeries(subscriber, id));
Beispiel #9
0
        static void Main(string[] args)
        {
            buyer buyer1 = new buyer();

            buyer1.lastname   = "Яренчких";
            buyer1.firstname  = "Антон";
            buyer1.middlename = "Викторович";
            buyer1.cardnum    = "4276 1616 8706 6746";
            buyer1.bunknum    = "40817810570000123455";
            Console.WriteLine(buyer1.lastname);
            Console.WriteLine(buyer1.firstname);
            Console.WriteLine(buyer1.middlename);
            Console.WriteLine(buyer1.cardnum);
            Console.WriteLine(buyer1.bunknum);
            Console.WriteLine("");
            // Задание 1.

            subscriber sub1 = new subscriber();

            Console.WriteLine("Введите id абонента");
            sub1.id = Console.ReadLine();
            Console.WriteLine("Введите фамилию абонента");
            sub1.lastname = Console.ReadLine();
            Console.WriteLine("Введите имя абонента");
            sub1.firstname = Console.ReadLine();
            Console.WriteLine("Введите отчество абонента");
            sub1.middlename = Console.ReadLine();
            Console.WriteLine("Введите адрес абонента");
            sub1.address = Console.ReadLine();
            Console.WriteLine("Введите номер кредитной карточки абонента");
            sub1.cardnum = Console.ReadLine();
            Console.WriteLine("Введите время междугородных перговоров абонента");
            sub1.ldnegotiations = Console.ReadLine();
            Console.WriteLine("Введите время городских переговоров абонента");
            sub1.fcnegotiations = Console.ReadLine();

            Console.WriteLine(sub1.lastname);
            Console.WriteLine(sub1.firstname);
            Console.WriteLine(sub1.middlename);
            Console.WriteLine(sub1.address);
            Console.WriteLine(sub1.cardnum);
            Console.WriteLine(sub1.ldnegotiations);
            Console.WriteLine(sub1.fcnegotiations);
            Console.WriteLine("");
            //Задание 2

            petshop zoo1 = new petshop();

            Console.WriteLine("Введите животное");
            zoo1.pet = Console.ReadLine();
            Console.WriteLine("Введите пол животного");
            zoo1.sex = Console.ReadLine();
            Console.WriteLine("Введите имя животного");
            zoo1.name = Console.ReadLine();
            Console.WriteLine("Введите цену животного");
            zoo1.price = Console.ReadLine();
            Console.WriteLine("Введите кол-во животных");
            zoo1.quntity = Console.ReadLine();

            Console.WriteLine(zoo1.pet);
            Console.WriteLine(zoo1.sex);
            Console.WriteLine(zoo1.name);
            Console.WriteLine(zoo1.price);
            Console.WriteLine(zoo1.quntity);
            Console.ReadKey();
            //Задание 3.
        }
 .Apply((subscriber, id) => new Subscription(subscriber, id));