Example #1
0
        public void UpdateSingleItem(object sender, EventArgs e)
        {
            if (selectedId > 0)
            {
                var parent = this.Parent as SplitterPanel;
                parent.Controls.Clear();

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

                this.Close();
            }
        }
Example #2
0
        private void CellClick(object sender, GridViewCellEventArgs e)
        {
            if (e.RowIndex == -1) return;

            var template = e.Column.OwnerTemplate;
            if(template is MasterGridViewTemplate)
            {
                if (isLeftClick == 1 && e.ColumnIndex == 2)
                {
                    var order = e.Row.DataBoundItem as DeliveryTemplate;
                    if (order != null)
                    {
                        selectedId = order.Id;
                    }

                    UpdateSingleItem(sender, e);
                }
                else
                {
                    if (e.ColumnIndex == 2)
                    {
                        bool isDelivered = false;
                        var delivery = e.Row.DataBoundItem as DeliveryTemplate;
                        if (delivery != null)
                        {
                            selectedId = delivery.Id;
                            isDelivered = string.Equals(delivery.Status, ECommon.Constants.DeliveryStatusDelivered, StringComparison.InvariantCultureIgnoreCase);
                        }

                        selectedRow = e.RowIndex;

                        var menu = AddMenuDelivery(isDelivered, false, false);
                        menu.Show(Cursor.Position.X, Cursor.Position.Y);
                    }
                }
            }
            else
            {
                if (isLeftClick == 1 && e.ColumnIndex == 1)
                {
                    var order = e.Row.DataBoundItem as OrderTemplate;
                    if (order != null)
                    {
                        selectedId = order.Id;
                    }

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

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

                    this.Close();
                }
                else
                {
                    if (e.ColumnIndex == 1)
                    {
                        bool isDelivered = false;
                        bool isSentEmail = false;
                        bool isSentSms = false;
                        bool isDeliverToOther = false;

                        var order = e.Row.DataBoundItem as OrderTemplate;
                        if (order != null)
                        {
                            selectedId = order.Id;
                            isDelivered = string.Equals(order.Status, ECommon.Constants.DeliveryStatusDelivered, StringComparison.InvariantCultureIgnoreCase);
                            isSentEmail = string.Equals(order.SendEmail, ECommon.Constants.OrderEmail2, StringComparison.InvariantCultureIgnoreCase);
                            isSentSms = string.Equals(order.SendMessage, ECommon.Constants.OrderSms2, StringComparison.InvariantCultureIgnoreCase);

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

                        selectedRow = e.RowIndex;

                        var menu = AddMenuOrder(isDelivered, isSentEmail, isSentSms, isDeliverToOther);
                        menu.Show(Cursor.Position.X, Cursor.Position.Y);
                    }
                }
            }
        }
Example #3
0
        private void NewItem(object sender, EventArgs e)
        {
            var parent = this.Parent as SplitterPanel;
            parent.Controls.Clear();

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

            this.Close();
        }