コード例 #1
0
ファイル: OrderView.cs プロジェクト: chauit/ElectronicStore
        private void MouseClick(object sender, MouseEventArgs e)
        {
            var currentCell = (sender as RadGridView).CurrentCell;

            if (e.Button == MouseButtons.Right && currentCell.ColumnIndex == 0 && currentCell.RowIndex != -1)
            {
                bool isDelivered      = false;
                bool isDeliverToOther = false;
                var  order            = radGridView.Rows[currentCell.RowIndex].DataBoundItem as Order;
                if (order != null)
                {
                    selectedId  = order.Id;
                    isDelivered = string.Equals(order.Status, Constants.OrderStatusDelivered, StringComparison.InvariantCultureIgnoreCase);

                    if (!string.IsNullOrEmpty(order.Recipient) &&
                        !string.Equals(Constants.OrderReport2, order.IsSendNotification, StringComparison.InvariantCultureIgnoreCase) &&
                        string.Equals(Constants.OrderSms2, order.SendMessage, StringComparison.InvariantCultureIgnoreCase))
                    {
                        isDeliverToOther = true;
                    }
                }

                selectedRow = currentCell.RowIndex;

                var menu = AddMenu(isDelivered, isDeliverToOther);
                menu.Show(Cursor.Position.X, Cursor.Position.Y);
            }

            if (e.Button == MouseButtons.Left && currentCell.ColumnIndex == 4 && currentCell.RowIndex != -1)
            {
                var order = radGridView.Rows[currentCell.RowIndex].DataBoundItem as Order;

                if (order.DeliveryDetails != null && order.DeliveryDetails.Count > 0)
                {
                    int deliveryId = 0;
                    foreach (var detail in order.DeliveryDetails)
                    {
                        deliveryId = detail.DeliveryId.Value;
                    }

                    var parent = this.Parent as SplitterPanel;
                    parent.Controls.Clear();

                    var newDelivery = new DeliveryForm(deliveryId, currentUser)
                    {
                        Dock = DockStyle.Fill, TopLevel = false
                    };
                    parent.Controls.Add(newDelivery);
                    newDelivery.Show();

                    this.Close();
                }
            }
        }
コード例 #2
0
        private void NewItem(object sender, EventArgs e)
        {
            var parent = this.Parent as SplitterPanel;

            parent.Controls.Clear();

            var newDelivery = new DeliveryForm(currentUser)
            {
                Dock = DockStyle.Fill, TopLevel = false
            };

            parent.Controls.Add(newDelivery);
            newDelivery.Show();

            this.Close();
        }
コード例 #3
0
        public void UpdateSingleItem(object sender, EventArgs e)
        {
            if (selectedId > 0)
            {
                var parent = this.Parent as SplitterPanel;
                parent.Controls.Clear();

                var newDelivery = new DeliveryForm(selectedId, currentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                parent.Controls.Add(newDelivery);
                newDelivery.Show();

                this.Close();
            }
        }
コード例 #4
0
ファイル: MainView.cs プロジェクト: chauit/ElectronicStore
        private void NewItem(object sender, EventArgs e)
        {
            var parent = this.Parent as SplitterPanel;

            parent.Controls.Clear();

            var newDelivery = new DeliveryForm(currentUser) { Dock = DockStyle.Fill, TopLevel = false };
            parent.Controls.Add(newDelivery);
            newDelivery.Show();

            this.Close();
        }
コード例 #5
0
ファイル: MainView.cs プロジェクト: chauit/ElectronicStore
        // Delivery functions
        public void UpdateSingleItem(object sender, EventArgs e)
        {
            if (selectedId > 0)
            {
                var parent = this.Parent as SplitterPanel;
                parent.Controls.Clear();

                var newDelivery = new DeliveryForm(selectedId, currentUser) { Dock = DockStyle.Fill, TopLevel = false };
                parent.Controls.Add(newDelivery);
                newDelivery.Show();

                this.Close();
            }
        }
コード例 #6
0
ファイル: OrderView.cs プロジェクト: chauit/ElectronicStore
        private void MouseClick(object sender, MouseEventArgs e)
        {
            var currentCell = (sender as RadGridView).CurrentCell;

            if (e.Button == MouseButtons.Right && currentCell.ColumnIndex == 0 && currentCell.RowIndex != -1)
            {
                bool isDelivered = false;
                bool isDeliverToOther = false;
                var order = radGridView.Rows[currentCell.RowIndex].DataBoundItem as Order;
                if (order != null)
                {
                    selectedId = order.Id;
                    isDelivered = string.Equals(order.Status, Constants.OrderStatusDelivered, StringComparison.InvariantCultureIgnoreCase);

                    if (!string.IsNullOrEmpty(order.Recipient) &&
                        !string.Equals(Constants.OrderReport2, order.IsSendNotification, StringComparison.InvariantCultureIgnoreCase) &&
                        string.Equals(Constants.OrderSms2, order.SendMessage, StringComparison.InvariantCultureIgnoreCase))
                    {
                        isDeliverToOther = true;
                    }
                }

                selectedRow = currentCell.RowIndex;

                var menu = AddMenu(isDelivered, isDeliverToOther);
                menu.Show(Cursor.Position.X, Cursor.Position.Y);
            }

            if (e.Button == MouseButtons.Left && currentCell.ColumnIndex == 4 && currentCell.RowIndex != -1)
            {
                var order = radGridView.Rows[currentCell.RowIndex].DataBoundItem as Order;

                if (order.DeliveryDetails != null && order.DeliveryDetails.Count > 0)
                {
                    int deliveryId = 0;
                    foreach (var detail in order.DeliveryDetails)
                    {
                        deliveryId = detail.DeliveryId.Value;
                    }

                    var parent = this.Parent as SplitterPanel;
                    parent.Controls.Clear();

                    var newDelivery = new DeliveryForm(deliveryId, currentUser) { Dock = DockStyle.Fill, TopLevel = false };
                    parent.Controls.Add(newDelivery);
                    newDelivery.Show();

                    this.Close();
                }
            }
        }