Ejemplo n.º 1
0
        private void SaveKmhCard(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;
            int saveType = Convert.ToInt32(button.Tag as string);

            ShowGlobalMask("Сохранение...");

            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;
            PostRequest<PostResult> post = new PostRequest<PostResult>(this.Dispatcher, "/Technology/Service.aspx/SaveKmhCard");
            post.ProcessResponse += new PostRequest<PostResult>.ProcessResponseEvent(delegate (PostResult result)
                {
                    #region Process Response
                    MessageBox.Show("Сохранение выполнено успешно");
                    HideGlobalMask();

                    // show modal window with list of orders
                    // what use this _standart_ (none order) KMH card
                    Guid order_id = urlparams.Keys.Contains("orderid") ? new Guid(urlparams["orderid"]) : Guid.Empty;
                    if (saveType == 1 || saveType == 3)
                    {
                        KmhOrderApplicability ordersForm = new KmhOrderApplicability();
                        ordersForm._dictNomenID = this._transfer.prod_id;
                        ordersForm.timeStamp = result.TimeStamp;
                        ordersForm.orderID = order_id;
                        ordersForm.Show();
                    }

                    if (_transfer.isprikaz && (saveType == 3 || saveType == 1))
                    {
                        string uri = String.Format("/Technology/EditorKmh.aspx?prodid={0}", new Guid(urlparams["prodid"]));
                        HtmlPage.Window.Navigate(new Uri(uri, UriKind.RelativeOrAbsolute), "_newWindow");
                    }
                    #endregion
                });
            post.ProcessError += this.ProcessSavingError;

            post.Perform(new SaveKmhCard_PROTO()
            {
                card = this._transfer,
                saveType = saveType,
                order_id = urlparams.Keys.Contains("orderid") ? new Guid(urlparams["orderid"]) : Guid.Empty
            });
        }
Ejemplo n.º 2
0
        /*public void ProcessSaving(PostResult result)
        {
        }*/
        private void SaveAddMaterials(object sender, RoutedEventArgs e)
        {
            // проверяем установлено ли для всех дополнительных материалов
            // поле "Кто заполнил"
            DataGrid dataGrid = (AddTabs.SelectedItem as TabItem).Content as DataGrid;
            var add_materials = dataGrid.ItemsSource as ObservableCollection<transfer_add>;

            if (add_materials.Where(it => Guid.Empty.Equals(it.ste_id)).Count() > 0)
            {
                MessageBox.Show("Для сохранения необходимо заполнить все поля [Кто заполнил]!");
                return;
            }

            ShowGlobalMask("Сохранение...");

            Button button = sender as Button;
            int saveType = Convert.ToInt32(button.Tag as string);

            List<transfer_add> savedMaterials = new List<transfer_add>();

            foreach (var material in add_materials)
            {
                savedMaterials.Add(new transfer_add(material));
            }

            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;

            PostRequest<PostResult> post = new PostRequest<PostResult>(this.Dispatcher, "/Technology/Service.aspx/SaveAddMaterials");
            post.ProcessResponse += new PostRequest<PostResult>.ProcessResponseEvent(delegate (PostResult result)
            {
                #region Process Response
                MessageBox.Show("Сохранение выполнено успешно");
                HideGlobalMask();

                // show modal window with list of orders
                // what use this _standart_ (none order) KMH card
                Guid order_id = urlparams.Keys.Contains("orderid") ? new Guid(urlparams["orderid"]) : Guid.Empty;
                if (saveType == 1 || saveType == 3)
                {
                    var speciality = TechnDatesSpeciality.Him;

                    if (add_materials == add_him_materials) speciality = TechnDatesSpeciality.Him;
                    else if (add_materials == add_svar_materials) speciality = TechnDatesSpeciality.Svar;
                    else if (add_materials == add_techn_materials) speciality = TechnDatesSpeciality.Techn;

                    KmhOrderApplicability ordersForm = new KmhOrderApplicability()
                    {
                        _dictNomenID = this._transfer.prod_id,
                        timeStamp = result.TimeStamp,
                        orderID = order_id,
                        speciality = speciality
                    };
                    ordersForm.Show();
                }

                if (_transfer.isprikaz && (saveType == 3 || saveType == 1))
                {
                    string uri = String.Format("/Technology/EditorKmh.aspx?prodid={0}", new Guid(urlparams["prodid"]));
                    HtmlPage.Window.Navigate(new Uri(uri, UriKind.RelativeOrAbsolute), "_newWindow");
                }
                #endregion
            });
            post.ProcessError += this.ProcessSavingError;

            Guid ste_id = Guid.Empty;
            if (add_materials == add_him_materials)
            {
                ste_id = new Guid("46A00C26-1768-4521-9A33-88336E65D50C");
            }
            else if (add_materials == add_svar_materials)
            {
                ste_id = new Guid("61931973-A5BD-40CD-92A6-FA802DE6CE6A");
            }
            else if (add_materials == add_techn_materials)
            {
                ste_id = new Guid("BCE12453-3AB9-4FCB-8FB3-4811A311B764");
            }
            else
            {
                return;
            }

            post.Perform(new SaveAddMaterials_PROTO()
            {
                list = savedMaterials,
                prodid = this._transfer.prod_id,
                saveType = saveType,
                order_id = urlparams.Keys.Contains("orderid") ? new Guid(urlparams["orderid"]) : Guid.Empty,
                ste_id = ste_id
            });
        }