Example #1
0
        private void WebRequestDirSaver(MResponse ClientResponse, MNetworkClient NetworkClient)
        {
            if (!AccessController.IsPrivilege(NetworkClient, "requests.add"))
            {
                return;
            }

            var WebRequestDirItem = Package.Unpacking <WebRequestDir>(ClientResponse.DataBytes);

            using (var db = new DatabaseContext())
            {
                db.Attach(WebRequestDirItem);
                db.SaveChanges();

                Sender.Broadcast("WebRequestDir.Save.Confirm", WebRequestDirItem, ClientResponse.WindowUid);

                WebRequestItem WebRequestItem =
                    db.WebRequestItems.FirstOrDefault(x => x.Id == WebRequestDirItem.WebRequestItemId);

                MBinding_WebRequest MBinding = new MBinding_WebRequest();
                MBinding.Item      = WebRequestItem;
                MBinding.Params    = db.WebRequestParamsItems.Where(x => x.WebRequestItemId == WebRequestItem.Id).ToArray();
                MBinding.Directory = WebRequestDirItem;

                Sender.Broadcast("WebRequestItem.MBinding_WebRequest.Add", MBinding);
            }
        }
        private void TextBox_RequestLink_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (!TextBox_RequestLink.IsReadOnly)
            {
                if (TextBox_RequestLink.IsFocused && RequestDirectory != null)
                {
                    var RequestItem = new WebRequestItem();
                    RequestItem.Id   = RequestDirectory.WebRequestId;
                    RequestItem.Link = GeneralLogic.RequestLink;

                    Sender.SendToServer("WebRequestItem.Update.Link", RequestItem);
                }

                if (TextBox_RequestLink.IsFocused && GeneralLogic.RequestMethod == "GET")
                {
                    if (Timer_EditorRequestData_PropertyChanged != null && Timer_EditorRequestData_PropertyChanged.IsEnabled)
                    {
                        Timer_EditorRequestData_PropertyChanged.Stop();
                    }

                    Timer_EditorRequestData_PropertyChanged = CustomTimer.Create(delegate(object sender, EventArgs e)
                    {
                        if (GeneralLogic.RequestMethod != "GET")
                        {
                            return;
                        }

                        UpdateDataGrid_OnTextBox();
                    }, new TimeSpan(0, 0, 1));
                }
            }
        }
Example #3
0
        private void WebRequestLinkUpdate(MResponse ClientResponse, MNetworkClient NetworkClient)
        {
            if (!AccessController.IsPrivilege(NetworkClient, "requests.edit"))
            {
                return;
            }

            using (var db = new DatabaseContext())
            {
                var RequestItem = Package.Unpacking <WebRequestItem>(ClientResponse.DataBytes);

                WebRequestItem DbRequestItem = db.WebRequestItems.FirstOrDefault(x => x.Id == RequestItem.Id);
                DbRequestItem.Link = RequestItem.Link;
                db.SaveChanges();

                Sender.SendOmit(NetworkClient, "WebRequestItem.Update.Link.Confirm", DbRequestItem, ClientResponse.WindowUid);
            }
        }
        internal void ComboBox_RequestType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            GeneralLogic.RequestMethod_SetComboBoxItem(ComboBox_RequestType);

            EditorRequestData.RequestLink =
                GeneralLogic.RequestLinkChanged(EditorRequestData.RequestLink);

            GeneralLogic.SetHeaderName(TabItemView);

            if (RequestDirectory != null && RequestDirectory.WebRequestId != 0 && GeneralLogic.RequestMethod != null)
            {
                var RequestItem = new WebRequestItem();
                RequestItem.Id     = RequestDirectory.WebRequestId;
                RequestItem.Method = GeneralLogic.RequestMethod;

                Sender.SendToServer("WebRequestItem.Update.Method", RequestItem);
            }
        }
Example #5
0
        private void WebRequestDirUpdate(MResponse ClientResponse, MNetworkClient NetworkClient)
        {
            if (!AccessController.IsPrivilege(NetworkClient, "requests.edit"))
            {
                return;
            }

            var RequestDirectory = Package.Unpacking <ModelRequestDirectory>(ClientResponse.DataBytes);

            using (var db = new DatabaseContext())
            {
                WebRequestDir WebDir = db.WebRequestDirs.FirstOrDefault(x => x.Id == RequestDirectory.Id);
                WebDir.Title = RequestDirectory.Title;

                WebRequestItem RequestItem = db.WebRequestItems.FirstOrDefault(x => x.Id == WebDir.WebRequestItemId);
                RequestItem.Title = RequestDirectory.RequestTitle;

                db.SaveChanges();

                Sender.Broadcast("WebRequestDir.RequestDirectory.Update.Confirm",
                                 RequestDirectory, ClientResponse.WindowUid);
            }
        }
Example #6
0
        private void WebRequestSaver(MResponse ClientResponse, MNetworkClient NetworkClient)
        {
            if (!AccessController.IsPrivilege(NetworkClient, "requests.add"))
            {
                return;
            }

            var WebRequestBinding = Package.Unpacking <MBinding_WebRequestSaver>(ClientResponse.DataBytes);

            using (var db = new DatabaseContext())
            {
                WebRequestItem _WebRequestItem = WebRequestBinding.Item;

                db.Attach(_WebRequestItem);
                db.SaveChanges();

                WebRequestParamsItem[] _WebRequestParams = WebRequestBinding.Params;

                for (int i = 0; i < _WebRequestParams.Length; i++)
                {
                    _WebRequestParams[i].WebRequestItemId = _WebRequestItem.Id;

                    _WebRequestParams[i].Description =
                        (_WebRequestParams[i].Description == null) ? "" : _WebRequestParams[i].Description;

                    db.Attach(_WebRequestParams[i]);
                }
                db.SaveChanges();

                Sender.Broadcast("WebRequestItem.MBinding_WebRequestSaver.Save.Confirm", new MBinding_WebRequestSaver
                {
                    Item   = _WebRequestItem,
                    Params = _WebRequestParams
                }, ClientResponse.WindowUid);
            }
        }