Ejemplo n.º 1
0
 public ServiceOrderingWinController(OrderingCancelled rec, OrderingWindowPurpose windMode, ServiceOrdering serviceOrd, Form parentWinOrd)
 {
     this.parentOrdWin     = parentWinOrd;
     this.servOrdering     = serviceOrd;
     this.windoProcessMode = windMode;
     catchTheControls();
     adjutTheFieldsWithProperDatas(rec);
 }
 public FormServiceOrderingWindow(OrderingCancelled rec, OrderingWindowPurpose mode, Form parentMain, ServiceOrdering servOrd)
 {
     InitializeComponent();
     controllerOrd   = new ServiceOrderingWinController(rec, mode, servOrd, this);
     this.parentMain = parentMain;
     this.Show();
     parentMain.Hide();
 }
 /// <summary>
 /// adjust the field with cancelled datas and prepare the processes
 /// </summary>
 /// <param name="rec">the Cancelled container of record</param>
 private void adjutTheFieldsWithProperDatas(OrderingCancelled rec)
 {
     fillUpTheFieldsAsCancelled(rec);
     ajdustFieldsAsCancelledNeeds();
     if (windoProcessMode == OrderingWindowPurpose.DETAILS)
     {
         adjustFieldsReadOnlyStrict();
         buttonOk.Visible = false;
     }
     else if (windoProcessMode == OrderingWindowPurpose.RENEW)  //make it noted
     {
         adjustFieldsReadOnlyStrict();
         buttonOk.Visible = true;
         buttonOk.Text    = "Visszaállítás";
     }
 }
        /// <summary>
        /// fills up the fields as Cancelled record needs
        /// </summary>
        /// <param name="rec">datacontainer</param>
        private void fillUpTheFieldsAsCancelled(OrderingCancelled rec)
        {
            labelInfoBar.Text     = "Visszavont tétel";
            textBoxStartDate.Text = rec.beszerzDatum;
            labelFinalDate.Text  += " lemondása:";
            textBoxFinalDate.Text = rec.beszerzLemond;
            textBoxUserOrder.Text = rec.redeloNev;
            textBoxUserModif.Text = rec.modositNev;

            comboBoxOrdProd.Items.Add(rec.modositNev);
            comboBoxOrdProd.SelectedIndex = 0;
            comboBoxOrdStrip.Items.Add(rec.termekKiszer);
            comboBoxOrdStrip.SelectedIndex = 0;

            textBoxOrdAmount.Text = rec.beszerzMennyis.ToString();
            textBoxSubcontr.Text  = rec.termekBeszall;
            textBoxOrdPlace.Text  = rec.termekKod;
            textBoxProdcode.Text  = rec.termekKod;

            orderingId = rec.beszerId;
        }
        private void setTheNewBtn1OrderEvents()
        {
            btn1.Click += (q, x) =>
            {
                try
                {
                    if (actServiceForSubEvents == FormMainServiceMode.ORDERINGNoted)    //order
                    {
                        //collect all the record and start create PDF and overwrite validity field
                        List <OrderingNoted> listOrdNoted = new List <OrderingNoted>();
                        foreach (DataGridViewRow rec in mgrid.Rows)
                        {
                            if ((bool)rec.Cells["Rendelés"].Value)
                            {
                                listOrdNoted.Add(orderingService.getChosenNotedOrdering((int)rec.Cells[0].Value));
                            }
                        }
                        if (listOrdNoted.Count > 0)
                        {
                            orderingBookArriveWin = new FormServiceOrdBookArriveWin(listOrdNoted, mainWindow,
                                                                                    orderingService, setOfUserDetails);
                        }
                    }
                    else if (actServiceForSubEvents == FormMainServiceMode.ORDERINGBooked)  //arrived
                    {
                        //collect all the record and rewrite validity field

                        List <OrderingBooked> listOrdBooked = new List <OrderingBooked>();
                        foreach (DataGridViewRow rec in mgrid.Rows)
                        {
                            if ((bool)rec.Cells["Beérkezés"].Value)
                            {
                                listOrdBooked.Add(orderingService.getChosenBookedOrdering((int)rec.Cells[0].Value));
                            }
                        }
                        if (listOrdBooked.Count > 0)
                        {
                            orderingBookArriveWin = new FormServiceOrdBookArriveWin(listOrdBooked, mainWindow,
                                                                                    orderingService);
                        }
                    }
                    else if (actServiceForSubEvents == FormMainServiceMode.ORDERINGMissing) //arrived
                    {
                        if (mgrid.SelectedRows[0].Index != -1)
                        {
                            int             indexFromGrid = mgrid.SelectedRows[0].Index;
                            int             recId         = (int)mgrid.Rows[indexFromGrid].Cells[0].Value;
                            OrderingMissing rec           = orderingService.getChosenMissingOrdering(recId);
                            orderingWindow = new FormServiceOrderingWindow(rec, OrderingWindowPurpose.MakeItPARTLYARRIVED,
                                                                           mainWindow, orderingService);
                        }
                    }
                    else if (actServiceForSubEvents == FormMainServiceMode.ORDERINGCancelled)   //renew cancelled
                    {
                        int indexFromGrid     = mgrid.SelectedRows[0].Index;
                        int recId             = (int)mgrid.Rows[indexFromGrid].Cells[0].Value;
                        OrderingCancelled rec = orderingService.getChosenCancelledOrdering(recId);
                        orderingWindow = new FormServiceOrderingWindow(rec, OrderingWindowPurpose.RENEW,
                                                                       mainWindow, orderingService);
                    }
                }
                catch (ErrorServiceOrdering w)
                {
                    errorHandle(w.Message);
                }
                catch (Exception w)
                {
                    errorHandle("Ismeretlen hiba történt (MainContrOrdBtn1) " + w.Message);
                }
            };
        }