コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 protected override void OnDraw(MapDrawArgs e)
 {
     if (_isDragging)
     {
         Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint);
         r.Width  -= 1;
         r.Height -= 1;
         e.Graphics.DrawRectangle(Pens.White, r);
         e.Graphics.DrawRectangle(_selectionPen, r);
     }
     if (_doSelect)
     {
         foreach (IMapLayer lyr in Map.MapFrame.Layers)
         {
             IMapFeatureLayer fl = lyr as IMapFeatureLayer;
             if (fl == null)
             {
                 continue;
             }
             IMapLabelLayer gll = fl.LabelLayer;
             //gll.Select(_selectionEnvelope, e); // using this form of selection can test the actual pixel rectangles
             if (gll != null)
             {
                 gll.Invalidate();
             }
         }
         _doSelect = false;
         _selectTimer.Start();
     }
     base.OnDraw(e);
 }
コード例 #2
0
        /// <summary>
        /// Draws the label.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected override void OnDraw(MapDrawArgs e)
        {
            if (_isDragging)
            {
                Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint);
                r.Width  -= 1;
                r.Height -= 1;
                e.Graphics.DrawRectangle(Pens.White, r);
                e.Graphics.DrawRectangle(_selectionPen, r);
            }

            if (_doSelect)
            {
                foreach (IMapLayer lyr in Map.MapFrame.Layers)
                {
                    IMapFeatureLayer fl = lyr as IMapFeatureLayer;
                    fl?.LabelLayer?.Invalidate();
                }

                _doSelect = false;
                _selectTimer.Start();
            }

            base.OnDraw(e);
        }
コード例 #3
0
        public opportunity_update(Opp o)
        {
            op = o;
            InitializeComponent();
            FillData();
            textBox1.Text = op.ID;
            textBox2.Text = op.name;
            textBox3.Text = op.lastN;
            textBox4.Text = op.phone;

            if (op.hID != null)
            {
                dataGridView1.Columns[1].Visible = dataGridView1.Columns[2].Visible = true;
                foreach (Control c in this.Controls)
                {
                    if (!(c is DataGridView))
                    {
                        c.Enabled = false;
                    }
                }
            }
            else
            {
                button3.Enabled = dataGridView1.Rows.Count > 1;
            }
        }
コード例 #4
0
        public void OnDraw_Dragging_DrawRectangle()
        {
            // Setup
            var       random = new Random(21);
            int       startX = random.Next(1, 100);
            int       startY = random.Next(1, 100);
            Rectangle rectangleFromPoints = Opp.RectangleFromPoints(new Point(startX, startY), new Point(startX, startY));

            rectangleFromPoints.Width  -= 1;
            rectangleFromPoints.Height -= 1;

            var map        = mockingRepository.Stub <IMap>();
            var mapFrame   = mockingRepository.Stub <IMapFrame>();
            var inGraphics = mockingRepository.Stub <Graphics>();

            inGraphics.Expect(e => e.DrawRectangle(Pens.White, rectangleFromPoints));
            inGraphics.Expect(e => e.DrawRectangle(Arg <Pen> .Matches(p => p.Color.Equals(Color.Black) && p.DashStyle.Equals(DashStyle.Dash)), Arg.Is(rectangleFromPoints)));

            mockingRepository.ReplayAll();

            var mapFunction = new MapFunctionSelectionZoom(map);

            var clipRectangle = new Rectangle(0, 0, 0, 0);

            mapFunction.DoMouseDown(new GeoMouseArgs(new MouseEventArgs(MouseButtons.Left, 1, startX, startY, 0), map));

            // Call
            mapFunction.Draw(new MapDrawArgs(inGraphics, clipRectangle, mapFrame));

            // Assert
            mockingRepository.VerifyAll();
        }
コード例 #5
0
        // GET: api/OnlineContracts/5
        public HttpResponseMessage Get(string id)
        {
            Online_log.Info($"Get Opportunity {id.ToString()}");

            HttpResponseMessage response;

            Opp c = new Opp();

            String ln = "";
            BusinessEntityCollection fcontact = c.searchOpportunity(id);

            foreach (DynamicEntity cont1 in fcontact.BusinessEntities)
            {
                ln = cont1["name"].ToString();
            }

            if ((ln != ""))
            {
                response = Request.CreateResponse(HttpStatusCode.OK, ln);
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.NoContent, ln);
            }

            return(response);
        }
        private void button3_Click(object sender, EventArgs e)
        {
            opportunity_update ou = new opportunity_update(opp);

            ou.ShowDialog();
            opp = ou.op;
            updatedTextBoxes();
        }
コード例 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 protected override void OnDraw(MapDrawArgs e)
 {
     if (_isDragging)
     {
         Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint);
         r.Width  -= 1;
         r.Height -= 1;
         e.Graphics.DrawRectangle(Pens.White, r);
         e.Graphics.DrawRectangle(_selectionPen, r);
     }
     base.OnDraw(e);
 }
コード例 #8
0
        // GET: Opps/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Opp opp = db.Opp.Find(id);

            if (opp == null)
            {
                return(HttpNotFound());
            }
            return(View(opp));
        }
コード例 #9
0
        //public bool PolygonCanIn
        //{
        //    get;
        //    set;
        //}

        #endregion

        #region Properties

        //public IGeometry Geometry
        //{
        //    get
        //    {
        //        LinearRing linearRing = new LinearRing(_coordinatePoints.ToArray());
        //        Polygon polygon = new Polygon(linearRing);
        //        return polygon as IGeometry;
        //    }
        //}

        #endregion

        #region Method

        protected override void OnDraw(MapDrawArgs e)
        {
            if (_isEnabled)
            {
                Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint);
                r.Width  -= 1;
                r.Height -= 1;

                HatchBrush brush = new HatchBrush(HatchStyle.Percent25, Color.Tomato, Color.SeaGreen);
                Pen        pen   = new Pen(brush, 2);
                pen.DashStyle = DashStyle.Dot;
                e.Graphics.DrawRectangle(pen, r);
                e.Graphics.FillRectangle(brush, r);
            }
            base.OnDraw(e);
        }
コード例 #10
0
        // PUT: api/OnlineContracts/5
        public HttpResponseMessage Put(Guid id, [FromBody] Opp value)
        {
            HttpResponseMessage response;
            GlobalStore         Proverka = new GlobalStore();

            string json = JsonConvert.SerializeObject(value);

            Online_log.Info($"Try Put. Count= {GlobalStore.CurrentCount}. Contract: {id.ToString()} {json}");

            if (Proverka.Check())
            {
                Opp  o             = new Opp();
                Guid g             = new Guid();
                var  opportunityid = o.CreateOpp(id, value);

                if ((opportunityid == null))// || (opportunityid == new Guid("{00000000-0000-0000-0000-000000000000}")))
                {
                    response = new HttpResponseMessage(HttpStatusCode.NotModified);
                }
                else
                {
                    if (Guid.TryParse(opportunityid, out g))
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, id);
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.Conflict, id);
                    }

                    //response = Request.CreateResponse(HttpStatusCode.OK, id);
                    response.Content.Headers.Expires = new DateTimeOffset(DateTime.Now.AddSeconds(300));
                    Online_log.Info($"Ok Put {response.StatusCode.ToString()}. Count: {GlobalStore.CurrentCount}. Contract : {id.ToString()}");
                }
            }
            else
            {
                string err = $"Много обращений! Count= {GlobalStore.CurrentCount}. Не более {Properties.Settings.Default.Count} в {Properties.Settings.Default.Interval} секунд";
                response = Request.CreateResponse(HttpStatusCode.Forbidden, err);
                Online_log.Error(err);
            }

            return(response);
        }
コード例 #11
0
        public ActionResult Edit(OppViewModel ovm)
        {
            if (!ModelState.IsValid)
            {
                LoadLists(ref ovm);
                return(View(ovm));
            }
            {
                Opp oldOpp = db.Opp
                             .Include(i => i.Contact)
                             .Include(i => i.Event)
                             .First(c => c.Id == ovm.Opp.Id);

                if (TryUpdateModel(oldOpp, "Opp"))
                {
                    foreach (Event ev in db.Event)
                    {
                        if (ovm.SelectedEvents.Contains(ev.Id))
                        {
                            oldOpp.Event.Add(ev);
                        }
                        else
                        {
                            oldOpp.Event.Remove(ev);
                        }
                    }
                    foreach (Contact c in db.Contact.Where(e => e.IsActive))
                    {
                        if (ovm.SelectedContacts.Contains(c.Id))
                        {
                            oldOpp.Contact.Add(c);
                        }
                        else
                        {
                            oldOpp.Contact.Remove(c);
                        }
                    }
                    db.Entry(oldOpp).State = EntityState.Modified;
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
        }
コード例 #12
0
 public opportunity_page(Opp op)
 {
     InitializeComponent();
     opp = op;
     updatedTextBoxes();
     if (opp.hID != null)
     {
         foreach (Control c in this.Controls)
         {
             if (c.Name != "button4")
             {
                 c.Enabled = false;
             }
             else
             {
                 (c as Button).Text = "Package details";
             }
         }
     }
 }
コード例 #13
0
        private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            DataGridViewRow sent = (sender as DataGridView).Rows[e.RowIndex];

            if (sent.Cells[0].Value == null)
            {
                return;
            }
            Opp o = Program.GetOpByID(sent.Cells[0].Value.ToString());

            this.Hide();
            new opportunity_page(o).ShowDialog();
            FillData();
            FillReminders();
            this.Show();
        }
コード例 #14
0
    public static void Main()
    {
        Console.WriteLine("Enter the X coordinate for the Queen");
        int queenX = int.Parse(Console.ReadLine());

        Console.WriteLine("Enter the Y coordinate for the Queen");
        int queenY = int.Parse(Console.ReadLine());

        Console.WriteLine("Enter the X coordinate for the Opponent Piece");
        int oppX = int.Parse(Console.ReadLine());

        Console.WriteLine("Enter the Y coordinate for the Opponent Piece");
        int   oppY     = int.Parse(Console.ReadLine());
        Queen newQueen = new Queen(queenX, queenY);
        Opp   newOpp   = new Opp(oppX, oppY);

        Console.WriteLine(newQueen.XCoor + ", " + newQueen.YCoor);
        Console.WriteLine(newOpp.XCoor + ", " + newOpp.YCoor);
        bool attack = newQueen.TheQueensGambit(queenX, queenY, oppX, oppY);

        Console.WriteLine(attack);
    }
コード例 #15
0
        public HttpResponseMessage Get(string id)
        {
            string XML = "";

            Integration1C_log.Info($"Integration1C. Get id='{id}'");
            //595CC35C-30D2-E911-80CC-005056BAC107
            BusinessEntityCollection opportunity;
            Opp        o                     = new Opp();
            string     nameopp               = "";               //номер договора
            Lookup     new_contact2id        = new Lookup();     //Законный представитель ФЛ/ Подписант ЮЛ
            CrmBoolean new_pay_installments  = new CrmBoolean(); //рассрочка в банке
            CrmFloat   new_discountpercent   = new CrmFloat();   //% комиссии банка
            CrmMoney   new_commission_amount = new CrmMoney();   //Сумма комиссии банка
            CrmMoney   new_totalsumcost      = new CrmMoney();   //Общая стоимость обучения с учетом пособий

            try
            {
                opportunity = o.searchOpportunity(id);
                foreach (DynamicEntity opp in opportunity.BusinessEntities)
                {
                    nameopp = opp["name"].ToString();

                    if (opp.Properties.Contains("new_contact2id"))
                    {
                        new_contact2id = (Lookup)opp["new_contact2id"];
                    }

                    if (opp.Properties.Contains("new_pay_installments"))
                    {
                        new_pay_installments = (CrmBoolean)opp["new_pay_installments"];
                    }

                    if (opp.Properties.Contains("new_discountpercent"))
                    {
                        new_discountpercent = (CrmFloat)opp["new_discountpercent"];
                    }

                    if (opp.Properties.Contains("new_commission_amount"))
                    {
                        new_commission_amount = (CrmMoney)opp["new_commission_amount"];
                    }

                    if (opp.Properties.Contains("new_totalsumcost"))
                    {
                        new_totalsumcost = (CrmMoney)opp["new_totalsumcost"];
                    }
                }


                XML = String.Format("<report><opportunityid>{0}</opportunityid><name>{1}</name><new_contact2id>{2}</new_contact2id><new_pay_installments>{3}</new_pay_installments><new_discountpercent>{4}</new_discountpercent><new_commission_amount>{5}</new_commission_amount><new_totalsumcost>{6}</new_totalsumcost></report>", id, nameopp, new_contact2id.Value.ToString(), new_pay_installments.Value, new_discountpercent.Value, new_commission_amount.Value, new_totalsumcost.Value);
                Integration1C_log.Info($"Integration1C. Response xml='{XML}'");
                return(new HttpResponseMessage()
                {
                    Content = new StringContent(XML, Encoding.UTF8, "application/xml")
                });
            }
            catch (Exception ex)
            {
                XML = String.Format("<report><error>{0}</error></report>", ex.ToString());

                return(new HttpResponseMessage()
                {
                    Content = new StringContent(XML, Encoding.UTF8, "application/xml")
                });
            }
        }
コード例 #16
0
 // PUT: api/Opp/5
 public void Put(int id, [FromBody] Opp value)
 {
 }
コード例 #17
0
 // POST: api/Opp
 public void Post([FromBody] Opp value)
 {
 }
コード例 #18
0
 public addNewPackage(Opp o)
 {
     InitializeComponent();
     comboBox3.SelectedIndex = 0;
     opp = o;
 }
コード例 #19
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            string err = "";

            if (textBox1.Text == "")
            {
                err += "Please enter a name\n";
            }
            if (textBox2.Text == "")
            {
                err += "Please enter a last name\n";
            }
            if (textBox3.Text.Length != 9)
            {
                err += "ID must be 9 digits long\n";
            }
            if (textBox4.Text.Length != 10)
            {
                err += "Phone must be 10 digits long\n";
            }
            if (Program.PhoneUsed(textBox4.Text) && opp.phone != null && opp.phone != textBox4.Text)
            {
                err += "Phone is already taken\n";
            }
            if (textBox5.Text == "")
            {
                err += "Please enter a email\n";
            }
            if (err != "")
            {
                MessageBox.Show(err, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (opp.ID == null && Program.GetOpByID(textBox3.Text).ID == null)
                {
                    Program.InsertUpdateOpp(textBox3.Text, textBox1.Text, textBox2.Text, textBox4.Text, textBox5.Text, DateTime.Now, comboBox3.SelectedItem.ToString(), Program.currentUser.ID, richTextBox1.Text);
                    button1.Text      = "Update";
                    button4.Visible   = true;
                    comboBox3.Enabled = true;
                }
                else if (opp.ID != null)
                {
                    if (comboBox3.SelectedItem.ToString().ToUpper().Contains("CLOSED"))
                    {
                        if (MessageBox.Show("Are you sure you want to close this opportunity?", "WAIT", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                        {
                            this.Enabled = true;
                            return;
                        }
                    }
                    Program.InsertUpdateOpp(textBox3.Text, textBox1.Text, textBox2.Text, textBox4.Text, textBox5.Text, DateTime.Now, comboBox3.SelectedItem.ToString(), Program.currentUser.ID, richTextBox1.Text);
                    opp = Program.GetOpByID(opp.ID);
                    if (Program.GetStatusPrec(opp.status) == 0 || Program.GetStatusPrec(opp.status) == 100)
                    {
                        if (Program.GetStatusPrec(opp.status) == 0)
                        {
                            foreach (Package p in Program.GetPackagesByID(opp.ID))
                            {
                                Program.RemovePackage(p);
                            }
                        }
                        Program.MovetHistory(opp.ID);
                        this.Close();
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("ID already used.");
                    this.Enabled = true;
                    return;
                }
                opp = Program.GetOpByID(textBox3.Text);
                updatedTextBoxes();
                textBox3.ReadOnly = true;
            }
            this.Enabled = true;
        }