コード例 #1
0
        private Gp SelectGpReader(IDataReader reader)
        {
            var gp = new Gp();

            if (!reader.Read())
            {
                return(gp);
            }

            var i = -1;

            gp.Id      = reader.GetInt32(++i);
            gp.Name    = reader.GetString(++i);
            gp.Circuit = reader.GetString(++i);
            if (!reader.IsDBNull(++i))
            {
                gp.Date = reader.GetDateTime(i);
            }
            if (!reader.IsDBNull(++i))
            {
                gp.Lenght = reader.GetDouble(i);
            }
            if (!reader.IsDBNull(++i))
            {
                gp.Laps = reader.GetInt32(i);
            }
            i++;
            if (!reader.IsDBNull(++i))
            {
                gp.UserId = reader.GetInt32(i);
            }
            return(gp);
        }
コード例 #2
0
        private void Arredondar()
        {
            Gp gp = new Gp();

            btndark.Region  = new Region(gp.graphicsPath(btndark));
            btnlight.Region = new Region(gp.graphicsPath(btnlight));
        }
コード例 #3
0
        public ActionResult Edit(Gp gp)
        {
            if (!(User.IsInRole("Admin") || ButtonEnable.TeamsEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name))))
            {
                return(RedirectToAction("Detail", "Drivers", new { id = gp.Id }));
            }

            GpMapper gpMapper = new GpMapper();

            if (ModelState.IsValid)
            {
                //gpMapper.Edit(team);
                TempData["message-success"] = "Gp byla zmeněna";
                return(RedirectToAction("Detail", "Teams", new { id = gp.Id }));
            }

            gp.State = States.FindForGp(gp);

            ViewBag.Name = gp.Name;

            ViewBag.States = new StatesMapper().SelectAll();
            ((Collection <States>)ViewBag.States).Insert(0, new States().EmptyState());

            return(View(gp));
        }
コード例 #4
0
        private void Arredondar()
        {
            Gp gp = new Gp();


            btnAluno.Region     = new Region(gp.graphicsPath(btnAluno));
            btnProfessor.Region = new Region(gp.graphicsPath(btnProfessor));
        }
コード例 #5
0
        private void Arredondar()
        {
            Gp gp = new Gp();

            btnLogar.Region = new Region(gp.graphicsPath(btnLogar));
            pnLogin.Region  = new Region(gp.graphicsPath(pnLogin));
            pnSenha.Region  = new Region(gp.graphicsPath(pnSenha));
        }
コード例 #6
0
        public void Visit(Gp gp)
        {
            throw new NotImplementedException();

            /*foreach(Term t in sum.Terms) {
             *      t.Accept(this);
             * }*/
        }
コード例 #7
0
        //Create
        public void CreateGP(string email, string password, string firstName, string lastName)
        {
            using var db = new PatientRecordsContext();
            var newGP = new Gp
            {
                Gpemail    = email,
                Gppassword = password,
                FirstName  = firstName,
                LastName   = lastName
            };

            db.Gps.Add(newGP);
            db.SaveChanges();
        }
コード例 #8
0
        public ActionResult Detail(int id)
        {
            var gpMapper = new GpMapper();
            Gp  gp       = gpMapper.SelectGp(id);

            gp.State     = States.FindForGp(gp);
            ViewBag.Name = gp.Name;

            gpMapper.GetPrevNextDriver(id, out int?prev, out int?next);
            ViewBag.Prev = prev;
            ViewBag.Next = next;

            ViewBag.IfGp = User.Identity.IsAuthenticated && ButtonEnable.GpEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name));

            return(View(gp));
        }
コード例 #9
0
        public void UpdatePatient(int patientid, Gp gp, string firstName, string lastName, DateTime dob, string address1,
                                  string address2, string address3, string city, string region, string postcode, string contactnumber)
        {
            using var db = new PatientRecordsContext();
            var selectedPatient = db.Patients.Where(x => x.PatientId == patientid).FirstOrDefault();

            selectedPatient.Gp            = gp;
            selectedPatient.FirstName     = firstName;
            selectedPatient.LastName      = lastName;
            selectedPatient.DateOfBirth   = dob;
            selectedPatient.Address1      = address1;
            selectedPatient.Address2      = address2;
            selectedPatient.Address3      = address3;
            selectedPatient.City          = city;
            selectedPatient.Region        = region;
            selectedPatient.PostalCode    = postcode;
            selectedPatient.ContactNumber = contactnumber;
            db.SaveChanges();
        }
コード例 #10
0
        public ActionResult Edit(int id)
        {
            GpMapper gpMapper = new GpMapper();
            Gp       gp       = gpMapper.SelectGp(id);

            if (!(User.IsInRole("Admin") || ButtonEnable.TeamsEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name))))
            {
                return(RedirectToAction("Detail", "Drivers", new { id = id }));
            }

            gp.State = States.FindForGp(gp);

            ViewBag.tName = gp.Name;

            ViewBag.States = new StatesMapper().SelectAll();
            ((Collection <States>)ViewBag.States).Insert(0, new States().EmptyState());

            return(View(gp));
        }
コード例 #11
0
 /// <summary>
 /// Dùng để vẽ lại screen bằng cách vẽ chồng từng lớp graphics lên nhau
 /// </summary>
 private void RePaint()
 {
     using (Brush brush = new SolidBrush(Color.White))
     {
         Gp.Graphics.FillRectangle(brush, 0, 0, pnlPaint.Width, pnlPaint.Height);
         DrawObj.ForEach(shape => shape.Draw(Gp.Graphics));
         if (IsDrawRegion)
         {
             using (Pen pen = new Pen(Color.Black)
             {
                 DashStyle = DashStyle.Dash
             })
             {
                 Gp.Graphics.DrawRectangle(pen, SelectedRegion);
             }
         }
         pnlPaint.Focus();
         Gp.Render();
     }
 }
コード例 #12
0
        public ActionResult ClassificationsEdit(int id)
        {
            GpMapper gpMapper = new GpMapper();
            Gp       gp       = gpMapper.SelectGp(id);

            if (!(User.IsInRole("Admin") || ButtonEnable.GpEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name))))
            {
                return(RedirectToAction("Classifications", "Gp", new { id = id }));
            }

            gp.State = States.FindForGp(gp);

            ViewBag.Name = gp.Name;
            ViewBag.Id   = id;

            ViewBag.Points = new PointsMapper().SelectAll();

            ViewBag.Classifications = new ClassificationMapper().SelectAll(id);

            return(View(new DriversMapper().SelectAll()));
        }
コード例 #13
0
        private Collection <Gp> SelectAllReader(IDataReader reader)
        {
            var gps = new Collection <Gp>();

            while (reader.Read())
            {
                var i  = -1;
                var gp = new Gp
                {
                    Id      = reader.GetInt32(++i),
                    Name    = reader.GetString(++i),
                    Circuit = reader.GetString(++i)
                };
                if (!reader.IsDBNull(++i))
                {
                    gp.Date = reader.GetDateTime(i);
                }

                gps.Add(gp);
            }
            return(gps);
        }
コード例 #14
0
        public void CreatePatient(Gp gp, string firstName, string lastName, DateTime dob, string address1,
                                  string address2, string address3, string city, string region, string postcode, string contactnumber)
        {
            using var db = new PatientRecordsContext();
            var newPatient = new Patient
            {
                Gpid          = gp.Gpid,
                FirstName     = firstName,
                LastName      = lastName,
                DateOfBirth   = dob,
                Address1      = address1,
                Address2      = address2,
                Address3      = address3,
                City          = city,
                Region        = region,
                PostalCode    = postcode,
                ContactNumber = contactnumber
            };

            db.Patients.Add(newPatient);
            db.SaveChanges();
        }
コード例 #15
0
        public bool addGps(string mobile, int productId, bool isOrder)
        {
            bool flag = false;

            lock (obj)
            {
                using (var ctx = new ShtxSms2008Entities())
                {
                    try
                    {
                        CustomerBase cb = ctx.CustomerBases.FirstOrDefault(o => o.Tel.Contains(mobile) && o.SendInterFace == 102);
                        if (cb != null)
                        {
                            string tel = cb.Tel;
                            if (isOrder)
                            {
                                //订阅
                                var count = ctx.Gps.Count(o => o.Tel == tel && o.ProductID == productId);
                                if (count > 0)
                                {
                                    return(true);
                                }
                                else
                                {
                                    var product = ctx.SmsProducts.FirstOrDefault(o => o.ProductId == productId);
                                    if (product != null)
                                    {
                                        Gp gps = new Gp();
                                        gps.MarketID    = product.MarketId;
                                        gps.Tel         = tel;
                                        gps.ProductID   = productId;
                                        gps.RoleID      = 15;
                                        gps.ProductNum  = product.ProductNum;
                                        gps.ProductSum  = product.ProductSum;
                                        gps.ProductKind = product.ProductKind;
                                        ctx.Gps.Add(gps);
                                        ctx.SaveChanges();
                                        flag = true;
                                    }
                                }
                            }
                            else
                            {
                                //取消
                                Gp gps = ctx.Gps.FirstOrDefault(o => o.Tel == tel && o.ProductID == productId);
                                if (gps != null)
                                {
                                    ctx.Gps.Remove(gps);
                                    ctx.SaveChanges();
                                    flag = true;
                                }
                                else
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return(flag);
        }
コード例 #16
0
 public void Visit(Gp gp)
 {
     throw new NotImplementedException();
     //return true;
 }
コード例 #17
0
 public bool Visit(Gp gp)
 {
     throw new NotImplementedException("Propagation for TemPower not implemented");
 }
コード例 #18
0
 private void FrmMain_Leave(object sender, EventArgs e)
 {
     Gp.Dispose();
 }
コード例 #19
0
        private void Calc()
        {
            double Pk, L, Ti, Tm, Gp, Tp, Var_A, Var_B, D1, k, k_Qnpp, Tmin, Tmax;
            int    n, Qz, Qnpp;

            ClearResult();

            if (kToolStripMenuItem.Checked == true)
            {
                k_Qnpp = 0.7;
            }
            else
            {
                k_Qnpp = 1;
            }

            try
            {
                Pk   = Convert.ToDouble(txtPk.Text);
                L    = Convert.ToDouble(txtL.Text);
                n    = Convert.ToInt16(txtn.Text);
                Qz   = Convert.ToInt16(txtQz.Text);
                Ti   = Convert.ToDouble(txtT1.Text);
                Qnpp = Convert.ToInt16(txtQnpp.Text);

                Qz   = Qz * 1000;
                Qnpp = Qnpp * 1000;

                Tm = Ti / 60;

                Gp = 4 * Pk * L * n;

                Tp = 3600 * Gp / Qz;

                Var_A = Qz * Tm - 60 * Gp;

                //Var_B = 0.7 * Qnpp;
                Var_B = k_Qnpp * Qnpp;

                D1 = Var_A / (Var_B * Tm) * 100;

                k = Tp / Ti;

                Tmin = (6 * 60 * Gp) / (100 * Qz / 1000 - k_Qnpp * Qnpp / 1000);
                Tmax = (6 * 60 * Gp) / (k_Qnpp * Qnpp / 1000 + 100 * Qz / 1000);


                label1.Text = label1.Text + " " + Gp.ToString("0.###") + " кг";
                label4.Text = label4.Text + " " + Tp.ToString("0.###") + " c";

                label5.Text = label5.Text + " " + Tmax.ToString("0.###") + " c";
                label7.Text = label7.Text + " " + Tmin.ToString("0.###") + " c";

                label6.Text = label6.Text + " " + k.ToString("0.###");
                label3.Text = label3.Text + " " + D1.ToString("0.##") + " %";



                if (D1 > 1 || D1 < -1)
                {
                    lblError.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Проверьте введенные данные!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            // MessageBox.Show(Pk.ToString("0.##"));
        }
コード例 #20
0
 public void SetSelectedGP(object selectedItem)
 {
     selectedGP = (Gp)selectedItem;
 }
コード例 #21
0
 public bool Visit(Gp gp)
 {
     throw new NotImplementedException();
     return(false);
 }