Example #1
0
        private void AddToOrderEntry_click(object e)
        {
            if (SelectedItem != null)
            {
                if (UtilityOrderDetails.GETInstance.CurrentOrderEntry?.ToLower() == Enumerations.OrderEntryWindow.Normal.ToString().ToLower())
                {
                    NormalOrderEntry objnormal = Application.Current.Windows.OfType <NormalOrderEntry>().FirstOrDefault();

                    if (objnormal != null)
                    {
                        if (objnormal.WindowState == WindowState.Minimized)
                        {
                            objnormal.WindowState = WindowState.Normal;
                        }

                        ((NormalOrderEntryVM)objnormal.DataContext).SetScripCodeandID();
                        objnormal.Focus();
                        objnormal.Show();
                        ((NormalOrderEntryVM)objnormal?.DataContext)?.AssignDefaultFocusStart(null);
                        //MemoryManager.InvokeWindowOnScripCodeSelection(Convert.ToString(UtilityLoginDetails.GETInstance.SelectedTouchLineScripCode), "Normal");
                    }
                    else
                    {
                        objnormal       = new NormalOrderEntry();
                        objnormal.Owner = System.Windows.Application.Current.MainWindow;
                        //objswift.CmbExcangeType.Focus();
                        ((NormalOrderEntryVM)objnormal.DataContext).SetScripCodeandID();
                        objnormal.Activate();
                        objnormal.Show();
                    }
                }
                else if (UtilityOrderDetails.GETInstance.CurrentOrderEntry?.ToLower() == Enumerations.OrderEntryWindow.Swift.ToString().ToLower())
                {
                    SwiftOrderEntry objswift = Application.Current.Windows.OfType <SwiftOrderEntry>().FirstOrDefault();

                    if (objswift != null)
                    {
                        if (objswift.WindowState == WindowState.Minimized)
                        {
                            objswift.WindowState = WindowState.Normal;
                        }

                        //((OrderEntryVM)objswift.DataContext).BuySellWindow(e);
                        ((OrderEntryVM)objswift.DataContext).SetScripCodeandID();

                        objswift.Focus();
                        objswift.Show();
                    }
                    else
                    {
                        objswift       = new SwiftOrderEntry();
                        objswift.Owner = System.Windows.Application.Current.MainWindow;
                        //objswift.CmbExcangeType.Focus();

                        //((OrderEntryVM)objswift.DataContext).BuySellWindow(e);

                        objswift.Activate();
                        objswift.Show();
                    }
                }

                MemoryManager.InvokeWindowOnScripCodeSelection?.Invoke(SelectedItem.ScripCode.ToString(), UtilityOrderDetails.GETInstance.CurrentOrderEntry.ToString());
                obj?.Close();
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Select value", "!Warning!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
            }
        }
        private void SquareOffData(object e)
        {
            if (selectEntireRowList != null && selectEntireRowList.Count > 1)
            {
                System.Windows.Forms.MessageBox.Show("Select Single Row to Square Off", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                // txtReply = "Select Single Row to Square Off";
                return;
            }
            if (UtilityOrderDetails.GETInstance.CurrentOrderEntry.ToLower() == Enumerations.OrderEntryWindow.Normal.ToString().ToLower())
            {
                #region for Normal Order Entry
                if (selectEntireRow != null)
                {
                    txtReply = string.Empty;
                    NormalOrderEntry objNormal = System.Windows.Application.Current.Windows.OfType <NormalOrderEntry>().FirstOrDefault();
                    // var key = string.Format("{0}_{1}", selectEntireRow.ScripCode);

                    if (objNormal != null)
                    {
                        if (selectEntireRow.NetQty > 0)
                        {
                            //((OrderEntryVM)objNormal.DataContext).BuySellWindow("SELL");
                            if (objNormal.WindowState == WindowState.Minimized)
                            {
                                objNormal.WindowState = WindowState.Normal;
                            }

                            if (((NormalOrderEntryVM)objNormal.DataContext).WindowColour != "#FFB3A7")
                            {
                                ((NormalOrderEntryVM)objNormal.DataContext).BuySellWindow("SELL");
                            }
                        }
                        else if (selectEntireRow.NetQty < 0)
                        {
                            if (objNormal.WindowState == WindowState.Minimized)
                            {
                                objNormal.WindowState = WindowState.Normal;
                            }

                            if (((NormalOrderEntryVM)objNormal.DataContext).WindowColour != "#89C4F4")
                            {
                                ((NormalOrderEntryVM)objNormal.DataContext).BuySellWindow("BUY");
                            }
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Invalid Net Qty.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                        ((NormalOrderEntryVM)objNormal.DataContext).PassByNetPositionClientWiseDetails(selectEntireRow.ScripCode, selectEntireRow);
                        objNormal.Focus();
                        objNormal.Show();
                    }
                    else
                    {
                        objNormal       = new NormalOrderEntry();
                        objNormal.Owner = System.Windows.Application.Current.MainWindow;
                        //objswift.CmbExcangeType.Focus();

                        if (selectEntireRow.NetQty > 0)
                        {
                            //((OrderEntryVM)objNormal.DataContext).BuySellWindow("SELL");
                            if (((NormalOrderEntryVM)objNormal.DataContext).WindowColour != "#FFB3A7")
                            {
                                ((NormalOrderEntryVM)objNormal.DataContext).BuySellWindow("SELL");
                            }
                        }
                        else if (selectEntireRow.NetQty < 0)
                        {
                            // ((OrderEntryVM)objNormal.DataContext).BuySellWindow("BUY");
                            if (((NormalOrderEntryVM)objNormal.DataContext).WindowColour != "#89C4F4")
                            {
                                ((NormalOrderEntryVM)objNormal.DataContext).BuySellWindow("BUY");
                            }
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Invalid Net Qty.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        objNormal.Activate();
                        objNormal.Show();
                        ((NormalOrderEntryVM)objNormal.DataContext).PassByNetPositionClientWiseDetails(selectEntireRow.ScripCode, selectEntireRow);
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Please Select order to Resubmit", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //txtReply = "Please Select order to Resubmit";
                }
                #endregion
            }
            else if (UtilityOrderDetails.GETInstance.CurrentOrderEntry.ToLower() == Enumerations.OrderEntryWindow.Swift.ToString().ToLower())
            {
                #region for Swift Order Entry
                if (selectEntireRow != null)
                {
                    //txtReply = string.Empty;
                    SwiftOrderEntry objswift = System.Windows.Application.Current.Windows.OfType <SwiftOrderEntry>().FirstOrDefault();
                    //var key = string.Format("{0}_{1}", selectEntireRow.SCode, selectEntireRow.OnlyOrderID);

                    if (objswift != null)
                    {
                        if (selectEntireRow.NetQty > 0)
                        {
                            ((OrderEntryVM)objswift.DataContext).BuySellWindow("SELL");
                        }
                        else if (selectEntireRow.NetQty < 0)
                        {
                            ((OrderEntryVM)objswift.DataContext).BuySellWindow("BUY");
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Invalid Net Qty.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                        ((OrderEntryVM)objswift.DataContext).PassByNetPositionClientWiseDetails(selectEntireRow.ScripCode, selectEntireRow);
                        objswift.Focus();
                        objswift.Show();
                    }
                    else
                    {
                        objswift       = new SwiftOrderEntry();
                        objswift.Owner = System.Windows.Application.Current.MainWindow;
                        //objswift.CmbExcangeType.Focus();

                        if (selectEntireRow.NetQty > 0)
                        {
                            ((OrderEntryVM)objswift.DataContext).BuySellWindow("SELL");
                        }
                        else if (selectEntireRow.NetQty < 0)
                        {
                            ((OrderEntryVM)objswift.DataContext).BuySellWindow("BUY");
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Invalid Net Qty.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        objswift.Activate();
                        objswift.Show();
                        ((OrderEntryVM)objswift.DataContext).PassByNetPositionClientWiseDetails(selectEntireRow.ScripCode, selectEntireRow);
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Please Select order to Resubmit", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                #endregion
            }
        }