示例#1
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            // save readiness
            LayoutRoot.Content = "Сохранение готовностей...";
            LayoutRoot.IsBusy = true;

            if (chkHimDate.IsChecked.Value && !this.techn_dates.him_date.HasValue) this.techn_dates.him_date = this.current_date;
            if (chkSvarDate.IsChecked.Value && !this.techn_dates.svar_date.HasValue) this.techn_dates.svar_date = this.current_date;
            if (chkTechnDate.IsChecked.Value && !this.techn_dates.techn_date.HasValue) this.techn_dates.techn_date = this.current_date;

            if (!chkHimDate.IsChecked.Value && this.techn_dates.him_date.HasValue) this.techn_dates.him_date = null;
            if (!chkSvarDate.IsChecked.Value && this.techn_dates.svar_date.HasValue) this.techn_dates.svar_date = null;
            if (!chkTechnDate.IsChecked.Value && this.techn_dates.techn_date.HasValue) this.techn_dates.techn_date = null;

            PostRequest<PostResult> post = new PostRequest<PostResult>(this.Dispatcher, "/Technology/TechnDates.aspx/SaveForProduct");
            post.ProcessResponse += new PostRequest<PostResult>.ProcessResponseEvent(delegate(PostResult result)
            {
                LayoutRoot.IsBusy = false;
            });
            post.Perform(new SaveDates_PROTO()
            {
                order_id = this.order_id,
                product_id = this.product_id,
                dates = this.techn_dates
            });

            this.DialogResult = true;
        }
示例#2
0
        private void ApplyCurrentRouteToAll(object sender, RoutedEventArgs e)
        {
            if (grid.SelectedItems.Count > 0)
            {
                string current_route = (grid.SelectedItem as transfer_route).route;

                foreach (transfer_route item in grid.ItemsSource)
                {
                    item.route = current_route;

                    PostRequest<PostResult> post = new PostRequest<PostResult>(this.Dispatcher, "/Technology/Service.aspx/SaveRoute");
                    post.ProcessResponse += ProcessSavingRoute;
                    post.Perform(new SaveRoute_PROTO() { saved_route = item });
                }
            }
        }
示例#3
0
        public static void Main(string[] args)
        {
            var settings = new HttpClientSettings
            {
                Authenticator = new BasicAuthenticator("guest", "guest")
            };

            const string root = "http://localhost:55672/api/";

            settings.Configure<JsonDotNetSerializer>(s =>
                s.ConfigureSettings(c =>
                {
                    c.ContractResolver = new RabbitContractResolver();
                }));

            var client = HttpClient.Create(root, settings);

            var options = new
            {
                vhost = "integration",
                name = "ErrorQueue",
                count = "1",
                requeue = "true",
                encoding = "auto",
                truncate = "50000"
            };

            var resource = client.BuildRelativeResource("queues/:vhost/:queue/get", new
            {
                vhost = "integration",
                queue = "ErrorQueue"
            });

            var request = new PostRequest(
                resource, new ObjectRequestBody(options));

            request.AddHeader("Accept", string.Empty);

            var messages = client.Run(request)
                .OnOk()
                .As<List<Message>>();

            Console.WriteLine(messages.Count);

            Console.ReadLine();
        }
示例#4
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                Currency n = new Currency();
                n.recordId  = index;
                n.name      = "";
                n.reference = "";


                PostRequest <Currency> req = new PostRequest <Currency>();
                req.entity = n;
                PostResponse <Currency> res = _systemService.ChildDelete <Currency>(req);
                if (!res.Success)
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, res.Summary).Show();
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
        public IActionResult Create([FromBody] PostRequest request)
        {
            if (request == null)
            {
                throw new Exception("post request cannot be null");
            }


            request.PostId = Guid.NewGuid().ToString();


            // Mapping request data to domain models
            var post = _mapper.Map <Post>(request);

            post.UserId = HttpContext.GetUserId();

            _postService.AddPost(post);

            return(CreatedAtAction("Get", new { id = post.Id }, _mapper.Map <PostResponse>(post)));
        }
示例#6
0
        public async Task <ActionResult <object> > Create([FromBody] PostRequest reqObj)
        {
            if (String.IsNullOrWhiteSpace(reqObj.Body) ||
                String.IsNullOrWhiteSpace(reqObj.AuthorID) ||
                (String.IsNullOrWhiteSpace(reqObj.TopicID) && String.IsNullOrWhiteSpace(reqObj.TopicTitle)))
            {
                return(BadRequest());
            }

            using (var connection = new NpgsqlConnection(this.config["ConnectionString"]))
            {
                var sql = $"CALL create_post('{reqObj.Body}', '{reqObj.AuthorID}', '{reqObj.TopicID}')";
                if (String.IsNullOrEmpty(reqObj.TopicID))
                {
                    sql = $"CALL create_starter_post('{reqObj.Body}', '{reqObj.AuthorID}', '{reqObj.TopicTitle}')";
                }

                return(Ok(await connection.ExecuteAsync(sql)));
            }
        }
示例#7
0
        public async Task <IActionResult> Create([FromBody] PostRequest postRequest)
        {
            var post = new Post()
            {
                Id = Guid.NewGuid(), Name = postRequest.Name, UserId = HttpContext.GetUserId()
            };


            await postService.CreatePost(post);

            var baseURL  = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.ToUriComponent()}";
            var location = $"{baseURL}/{APIRoute.Post.Get.Replace("{postId}", post.Id.ToString())}";

            var postResponse = new PostResponse()
            {
                Id = post.Id
            };

            return(Created(location, postResponse));
        }
示例#8
0
        private void DefaultValues()
        {
            lblTime.Text   = string.Empty;
            lblStatus.Text = string.Empty;
            if (string.IsNullOrWhiteSpace(Properties.Settings.Default.PostRequest))
            {
                return;
            }

            PostRequestProp = Util.Deserialize <PostRequest>(Properties.Settings.Default.PostRequest);
            tbUrl.Text      = PostRequestProp.URL;
            rtbRequest.Text = PostRequestProp.Body;

            foreach (var header in PostRequestProp.Header)
            {
                dgvHeader.Rows.Add(header.HeaderKey, header.HeaderValue);
            }

            tabInput.TabPages[1].Text = string.Format("Headers ({0})", PostRequestProp.Header.Count);
        }
示例#9
0
        static async Task Add(GrpcClient client)
        {
            PostRequest postRequest = new PostRequest()
            {
                Domain = "Domain-Name", Description = "Description-Name"
            };

            postRequest.Comments.Add(new CommentRequest()
            {
                Text = "Comment 1"
            });
            postRequest.Comments.Add(new CommentRequest()
            {
                Text = "Comment 2"
            });

            var reply = await client.AddPostAsync(postRequest);

            DisplayPostResponse(reply);
        }
示例#10
0
        public async Task <bool> AproveRejectPost(PostRequest post)
        {
            try
            {
                var postData = new StringContent(JsonConvert.SerializeObject(post), Encoding.UTF8, "application/json");

                var result = await _httpClient.PutAsync("Editor", postData);

                if (result.IsSuccessStatusCode)
                {
                    var response = JsonConvert.DeserializeObject <bool>(result.Content.ReadAsStringAsync().Result);
                    return(response);
                }
                return(false);
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
示例#11
0
        public async Task <IActionResult> AproveRejectPost([FromBody] PostRequest request)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    var message = ModelState.ToDictionary(d => d.Key, d => d.Value.Errors.Select(e => e.ErrorMessage).ToList());
                    return(BadRequest(message));
                }

                var result = await _facade.AproveRejectPost(request);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                log.Error(new Exception(), ex.Message);
            }
            return(null);
        }
示例#12
0
        public object Get(PostRequest req)
        {
            var posts = (QueryResponse <Post>)Get(new PostQueryRequest()
            {
                Filter = $"id:{req.Id}"
            });

            if (posts.Results.Count != 1)
            {
                throw HttpError.NotFound($"Post does not exist");
            }
            var post = posts.Results[0];

            using (var db = DbFactory.Open())
            {
                post.ViewsToday = db.Count <PostLog>(x => x.RequestType == typeof(PostRequest).ToString() && x.EntryDate >= DateTime.UtcNow.Date && x.EntryDate < DateTime.UtcNow.Date.AddDays(1));
            }

            return(post);
        }
示例#13
0
        public void DeleteScheduleBenefitRecord(string benefitId, string bsId)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                ScheduleBenefits s = new ScheduleBenefits();
                s.bsId      = Convert.ToInt32(bsId);
                s.benefitId = Convert.ToInt32(benefitId);



                PostRequest <ScheduleBenefits> req = new PostRequest <ScheduleBenefits>();
                req.entity = s;
                PostResponse <ScheduleBenefits> r = _benefitsService.ChildDelete <ScheduleBenefits>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    ScheduleBenefitsStore.Reload();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#14
0
        internal static PostResponse WebClientPost(PostRequest postRequest)
        {
            var postResponse = new PostResponse();

            using (WebClient wc = new WebClient())
            {
                var sw = new System.Diagnostics.Stopwatch();

                foreach (var header in postRequest.Header)
                {
                    wc.Headers.Add(header.HeaderKey, header.HeaderValue);
                }

                try
                {
                    sw.Start();
                    postResponse.ResponseBody = wc.UploadString(postRequest.URL, "POST", postRequest.Body);
                    sw.Stop();

                    postResponse.StatusCode = "OK";
                }
                catch (Exception ex)
                {
                    postResponse.StatusCode   = "Error";
                    postResponse.ResponseBody = ex.Message;
                }



                if (sw.Elapsed.TotalSeconds > 1)
                {
                    postResponse.Time = string.Format("{0:0.00} s", sw.Elapsed.TotalSeconds);
                }
                else
                {
                    postResponse.Time = string.Format("{0:000} ms", sw.Elapsed.TotalMilliseconds);
                }
            }

            return(postResponse);
        }
        private bool matchInput(Window currentWindow, PostRequest request, USSDSession <Object> session, USSDResponse response)
        {
            String regExp = currentWindow.getInput().RegExp;

            String value = request.getInputValue();

            session[currentWindow.getInput().Name] = value;

            if (currentWindow.getInput().RegExp != null)
            {
                bool matches = regularExpressionMatches(regExp, value, request);

                if (!matches)
                {
                    request.redirectTo(currentWindow.getInput().OnErrorTargetWindow, session, response);
                    return(false);
                }
            }

            return(true);
        }
示例#16
0
        public async Task <ActionResult> UpdatePost([FromRoute] int id,
                                                    [FromBody] PostRequest postDto)
        {
            try
            {
                bool userIsPermitted = await this.CheckIsAuthorOfPostOrAdminAsync(id);

                if (!userIsPermitted)
                {
                    return(Forbid());
                }

                await _postService.EditPostAsync(id, postDto);

                return(NoContent());
            }
            catch (EntityNotFoundException)
            {
                return(NotFound());
            }
        }
示例#17
0
        public PostGetViewModel Handle(PostRequest message, PostGetViewModel result)
        {
            var post = ActivePosts.FirstOrDefault();

            if (message.Slug != null)
            {
                post = AllPosts.FirstOrDefault(x => x.Slug.ToLower() == message.Slug.ToLower());
            }
            if (post == null)
            {
                return(result);              //Decision: don't throw, handle downstream as to what this means
            }
            var previous = ActivePosts.OrderBy(x => x.PublishedAtCst).FirstOrDefault(x => x.PublishedAtCst > post.PublishedAtCst);
            var next     = ActivePosts.FirstOrDefault(x => x.PublishedAtCst < post.PublishedAtCst);

            result.Post     = post;
            result.Previous = previous;
            result.Next     = next;

            return(result);
        }
示例#18
0
        public async Task <IActionResult> Update(int id, PostRequest request)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(new ModelStateDictionary(ModelState)));
                }
                Post post = await service.Update(request, id);

                if (post == null)
                {
                    return(NotFound(new { Error = "Not found" }));
                }
                return(Ok(mapper.Map <PostMapper>(post)));
            }
            catch (Exception e)
            {
                return(ServerError(new { Error = e.Message }));
            }
        }
示例#19
0
 public PlaceResponse CreatePlace(PostRequest <Place> request)
 {
     using (var db = new EventSourceDbContext(_contextOptions))
     {
         var newPlace = new Place()
         {
             DateRegistered = request.Payload.DateRegistered,
             Capacity       = request.Payload.Capacity,
             Location       = request.Payload.Location.ToLower(),
             Name           = request.Payload.Name.ToLower(),
             Description    = request.Payload.Description,
             City           = request.Payload.City.ToLower()
         };
         db.Places.Add(newPlace);
         db.SaveChanges();
         return(new PlaceResponse()
         {
             Place = newPlace,
         });
     }
 }
示例#20
0
        private bool AddPeriodsList(string scheduleIdString, List <VacationSchedulePeriod> periods)
        {
            short i          = 1;
            int   scheduleId = Convert.ToInt32(scheduleIdString);

            foreach (var period in periods)
            {
                period.seqNo = i++;
                period.vsId  = scheduleId;
            }
            PostRequest <VacationSchedulePeriod[]> periodRequest = new PostRequest <VacationSchedulePeriod[]>();

            periodRequest.entity = periods.ToArray();
            PostResponse <VacationSchedulePeriod[]> response = _branchService.ChildAddOrUpdate <VacationSchedulePeriod[]>(periodRequest);

            if (!response.Success)
            {
                return(false);
            }
            return(true);
        }
        public async Task <ActionResult> Create([FromBody] PostRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }


            var entity = _mapper.Map <PostEntity>(request);

            entity.senderId = (ObjectId)userId;

            var data = await _postRepository.AddAsync(entity);


            return(data == null
                ? StatusCode(HttpConstants.NotExtended, new ErrorModel { message = Messages.DefaultMessage })
                : Ok(new ResultModel {
                result = true
            }));
        }
        public async Task <IActionResult> Create([FromBody] PostRequest request)
        {
            var newTag = new Tag
            {
                Name      = request.Name,
                CreatedId = HttpContext.GetUserId(),
                CreatedOn = DateTime.UtcNow
            };

            var created = await _postService.CreateTagAsync(newTag);

            if (!created)
            {
                return(BadRequest(new  { Message = "Unable to create tag" }));
            }

            var baseUrl     = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.ToUriComponent()}";
            var locationUri = baseUrl + "/" + APIRoute.Tag.Get.Replace("{tagName}", newTag.Name);

            return(Created(locationUri, _mapper.Map <TagResponse>(newTag)));
        }
示例#23
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                Dependant n = new Dependant();
                n.seqNo      = index;
                n.employeeId = Request.QueryString["employeeId"];

                PostRequest <Dependant> req = new PostRequest <Dependant>();
                req.entity = n;
                PostResponse <Dependant> resp = _employeeService.ChildDelete <Dependant>(req);
                if (!resp.Success)
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(resp);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    dependandtsStore.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#24
0
        public void DeleteWSRecord(int index)
        {
            try
            {
                //Step 2 :  remove the object from the store
                WorkSequence s = new WorkSequence();
                s.seqNo = index;
                //s.reference = "";

                s.wfId = currentWorkFlowId.Text;
                PostRequest <WorkSequence> req = new PostRequest <WorkSequence>();
                req.entity = s;
                PostResponse <WorkSequence> r = _companyStructureRepository.ChildDelete <WorkSequence>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    workSequenceStore.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#25
0
        public void DeleteRecord(string ruleId, string classId, string accessType, string seqNo)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                RuleTrigger s = new RuleTrigger();
                s.ruleId     = ruleId;
                s.classId    = classId;
                s.accessType = accessType;
                s.seqNo      = seqNo;
                PostRequest <RuleTrigger> req = new PostRequest <RuleTrigger>();
                req.entity = s;
                PostResponse <RuleTrigger> r = _companyStructureService.ChildDelete <RuleTrigger>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Reload();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#26
0
        public void DeleteBody(string te, string language)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                TemplateBody s = new TemplateBody();
                s.teId       = Convert.ToInt32(te);
                s.languageId = Convert.ToInt32(language);
                //s.intName = "";

                PostRequest <TemplateBody> req = new PostRequest <TemplateBody>();
                req.entity = s;
                PostResponse <TemplateBody> r = _administrationService.ChildDelete <TemplateBody>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);;
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store2.Remove(language);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#27
0
        /// <summary>
        /// Implemeted only online lookup
        /// </summary>
        /// <param name="category"></param>
        /// <param name="numberOfPosts"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public static async Task<ModelWrapper<List<Post>>> GetPostsOnline(PostRequest postRequest)
        {
            // check internet connection
            if (!ConnectionInfo.InternetConnected())
            {
                return new ModelWrapper<List<Post>>(TaskResult.NoInternet);
            }

            // get posts online
            try
            {
                using (HttpClient httpClient = new HttpClient())
                {
                    
                    string postsData = await httpClient.GetStringAsync(postRequest.GetUri());

                    List<Post> tempList = JsonConvert.DeserializeObject<List<Post>>(postsData);

                    if (tempList != null && tempList.Count > 0)
                    {
                        if (postRequest.SaveRequired)
                        {
                            // successfully retrieve posts, so save them
                            DataManager.SavePosts(tempList, postRequest.CurrentCategory, postRequest.CurrentOffset); 
                        }

                        return new ModelWrapper<List<Post>>(tempList, TaskResult.Success);
                    }
                    else
                    {
                        return new ModelWrapper<List<Post>>(TaskResult.NoData);
                    }
                }
            }
            catch (Exception)
            {
                return new ModelWrapper<List<Post>>(TaskResult.Error);
            }

        }
示例#28
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                AssetManagementPurchaseOrder n = new AssetManagementPurchaseOrder();
                n.recordId = index;


                PostRequest <AssetManagementPurchaseOrder> req = new PostRequest <AssetManagementPurchaseOrder>();
                req.entity = n;
                PostResponse <AssetManagementPurchaseOrder> res = _assetManagementService.ChildDelete <AssetManagementPurchaseOrder>(req);
                if (!res.Success)
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(res);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#29
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                TerminationReason s = new TerminationReason();
                s.recordId = index;
                s.name     = "";
                //s.intName = "";

                PostRequest <TerminationReason> req = new PostRequest <TerminationReason>();
                req.entity = s;
                PostResponse <TerminationReason> r = _employeeService.ChildDelete <TerminationReason>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#30
0
        protected void SavePattern(object sender, DirectEventArgs e)
        {
            string          day = e.ExtraParams["pattern"];
            CalendarPattern b   = JSON.Deserialize <CalendarPattern>(day);

            b.caId = CurrentCalendar.Text;

            b.year = CurrentYear.Text;



            PostRequest <CalendarPattern> request = new PostRequest <CalendarPattern>();

            request.entity = b;
            PostResponse <CalendarPattern> response = _branchService.ChildAddOrUpdate <CalendarPattern>(request);

            if (!response.Success)//it maybe another check
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.ErrorUpdatingRecord, GetGlobalResourceObject("Errors", response.ErrorCode) != null ? GetGlobalResourceObject("Errors", response.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + response.LogId : response.Summary).Show();
                return;
            }

            //Step 2 : saving to store


            else
            {
                LoadDays();
                //Display successful notification
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordSavingSucc
                });

                this.patternWindow.Close();
            }
        }
示例#31
0
        public void DeleteRecord(string paycode, string name)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                PayCode s = new PayCode();
                s.payCode = paycode;
                s.name    = name;
                //s.intName = "";

                PostRequest <PayCode> req = new PostRequest <PayCode>();
                req.entity = s;
                PostResponse <PayCode> r = _payrollService.ChildDelete <PayCode>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Reload();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#32
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                DayType s = new DayType();
                s.recordId     = index;
                s.color        = "";
                s.isWorkingDay = false;
                s.name         = "";
                PostRequest <DayType> req = new PostRequest <DayType>();
                req.entity = s;
                PostResponse <DayType> r = _timeAttendanceService.ChildDelete <DayType>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, r.Summary).Show();
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#33
0
        public void DeleteConditionRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                Model.Company.Structure.RuleCondition s = new Model.Company.Structure.RuleCondition();
                s.recordId = index;
                s.ruleId   = currentRuId.Text;


                PostRequest <Model.Company.Structure.RuleCondition> req = new PostRequest <Model.Company.Structure.RuleCondition>();
                req.entity = s;
                PostResponse <Model.Company.Structure.RuleCondition> r = _companyStructureService.ChildDelete <Model.Company.Structure.RuleCondition>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    FillConditionStore();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#34
0
        private void ChildWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // load readiness
            LayoutRoot.IsBusy = true;
            ProductPn1.Text = product_pn1;

            PostRequest<transfer_techn_dates> post = new PostRequest<transfer_techn_dates>(this.Dispatcher, "/Technology/TechnDates.aspx/GetForProduct");
            post.ProcessResponse += new PostRequest<transfer_techn_dates>.ProcessResponseEvent(delegate(transfer_techn_dates dates)
            {
                this.techn_dates = dates;

                this.chkHimDate.IsChecked = dates.him_date.HasValue;
                this.chkSvarDate.IsChecked = dates.svar_date.HasValue;
                this.chkTechnDate.IsChecked = dates.techn_date.HasValue;

                LayoutRoot.IsBusy = false;
            });
            post.Perform(new GetDates_PROTO()
            {
                order_id = this.order_id,
                product_id = this.product_id,
            });
        }
示例#35
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
            });
        }
示例#36
0
        private void RequestKmhCard(object sender, RoutedEventArgs e)
        {
            ShowGlobalMask("Загрузка КМХ...");

            PostRequest<transfer> post = new PostRequest<transfer>(this.Dispatcher, "/Technology/Service.aspx/RequestKmhCard");
            post.ProcessResponse += this.ProcessKmhCard;
            post.ProcessError += this.ProcessKmhCardError;

            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;
            post.Perform(string.Format("{{ 'prod_id': '{0}', 'order_id': '{1}' }}", urlparams["prodid"], urlparams.Keys.Contains("orderid") ? urlparams["orderid"] : Guid.Empty.ToString()));
        }
示例#37
0
        private void RequestDicts(object sender, RoutedEventArgs e)
        {
            ShowGlobalMask("Загрузка словарей...");

            PostRequest<Dicts> post = new PostRequest<Dicts>(this.Dispatcher, "/Technology/Service.aspx/RequestDicts");
            post.ProcessResponse += this.ProcessDicts;
            post.ProcessError += this.ProcessDictsError;

            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;
            post.Perform("{ 'dicts': 'pvd,um,sf,s,ste' }");
        }
示例#38
0
        private void RequestAddMaterials(object sender, RoutedEventArgs e)
        {
            ShowGlobalMask("Загрузка дополнительных материалов...");

            PostRequest<List<transfer_add>> post = new PostRequest<List<transfer_add>>(this.Dispatcher, "/Technology/Service.aspx/RequestAddMaterials");
            post.ProcessResponse += this.ProcessAddMaterials;

            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;
            post.Perform(string.Format("{{ 'prod_id': '{0}', 'order_id': '{1}' }}", urlparams["prodid"], urlparams.Keys.Contains("orderid") ? urlparams["orderid"] : Guid.Empty.ToString()));
        }
示例#39
0
        private void insertFromBuffer(object sender, RoutedEventArgs e)
        {
            ShowGlobalMask("Вставка из буфера обмена...");

            PostRequest<List<transfer_add>> post = new PostRequest<List<transfer_add>>(this.Dispatcher, "/Technology/Buffer.aspx/Select");
            post.ProcessResponse += new PostRequest<List<transfer_add>>.ProcessResponseEvent(delegate(List<transfer_add> selected)
            {
                DataGrid dataGrid = (AddTabs.SelectedItem as TabItem).Content as DataGrid;
                var add_materials = dataGrid.ItemsSource as ObservableCollection<transfer_add>;

                foreach (var item in selected)
                {
                    item.UMs = _dicts.UMs;
                    item.Ss = _dicts.Ss;
                    item.STEs = _dicts.STEs;
                    add_materials.Add(item);
                    item.UpdateDicts();
                }
                HideGlobalMask();
            });
            post.ProcessError += new PostRequest<List<transfer_add>>.ProcessErrorEvent(delegate()
            {
                MessageBox.Show("Ошибка при вставке из буфера");
                HideGlobalMask();
            });

            post.Perform("{}");
        }
示例#40
0
        private void GenerateDatesForOrder(object sender, RoutedEventArgs e)
        {
            PostRequest<PostResult> post = new PostRequest<PostResult>(this.Dispatcher, "/Technology/TechnDates.aspx/GenerateForOrder");
            post.ProcessResponse += new PostRequest<PostResult>.ProcessResponseEvent(delegate (PostResult result)
                {

                });
            post.Perform(new GerenateDates_PROTO() {
                order_id = new Guid(dbg_order_id.Text),
                product_id = new Guid(dbg_product_id.Text),
                gen_date = DateTime.Now
            });
        }
示例#41
0
        protected void SyncColumnsToServerDB()
        {
            List<transfer_column> saving_columns = new List<transfer_column>();
            foreach (var metaColumn in this.columns)
            {
                var gridColumn = grid.Columns.Single(clm => String.Equals(clm.Header, metaColumn.Header));
                saving_columns.Add(new transfer_column()
                {
                    uid = new Guid(MD5CryptoServiceProvider.GetMd5String(metaColumn.Header)),
                    hidden = gridColumn.Visibility == Visibility.Visible ? false : true,
                    position = gridColumn.DisplayIndex,
                    width = (int)gridColumn.Width.DisplayValue
                });
            }

            PostRequest<PostResult> post = new PostRequest<PostResult>(this.Dispatcher, "/Technology/Service.aspx/SetColumns");
            post.Perform(new SET_COLUMNS_PROTO() { columns = saving_columns, ClassificationTreeId = new Guid("11110000-0000-0000-0000-000011110101") });
        }
示例#42
0
        private void DataBind(object sender, RoutedEventArgs e)
        {
            PostRequest<List<transfer>> post = new PostRequest<List<transfer>>(this.Dispatcher, "/Technology/Service.aspx/GetTechConsist");
            post.ProcessResponse += this.ProcessListKmh;

            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;
            post.Perform(string.Format("{{ 'prod_id': '{0}', 'order_id': '{1}' }}", urlparams["prodid"], urlparams.Keys.Contains("orderid") ? urlparams["orderid"] : Guid.Empty.ToString()));
        }
示例#43
0
        void selectionRoute_Closed(object sender, EventArgs e)
        {
            SelectionRoute selectionRoute = sender as SelectionRoute;
            if ((bool)selectionRoute.DialogResult)
            {
                this._edited_route.route = selectionRoute.ResultRoute;

                PostRequest<PostResult> post = new PostRequest<PostResult>(this.Dispatcher, "/Technology/Service.aspx/SaveRoute");
                post.ProcessResponse += ProcessSavingRoute;
                post.Perform(new SaveRoute_PROTO() { saved_route = this._edited_route });
            }
        }
示例#44
0
        private void RequestDicts(object sender, RoutedEventArgs e)
        {
            PostRequest<Dicts> post = new PostRequest<Dicts>(this.Dispatcher, "/Technology/Service.aspx/RequestDicts");
            post.ProcessResponse += this.ProcessDicts;

            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;
            post.Perform("{ 'dicts': 's' }");
        }
示例#45
0
        private void DataBind(object sender, RoutedEventArgs e)
        {
            PostRequest<List<transfer_route>> post = new PostRequest<List<transfer_route>>(this.Dispatcher, "/Technology/Service.aspx/RequestAllRoutes");
            post.ProcessResponse += this.ProcessListRoutes;

            post.Perform(string.Format("{{ 'prod_id': '{0}' }}", _prod_id));
        }
示例#46
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
            });
        }
示例#47
0
 public HtmlTag post_csrf(PostRequest request)
 {
     return new HtmlTag("h1", h => h.Text("POST HOLA"));
 }
示例#48
0
 protected void DataBind(object sender, RoutedEventArgs e)
 {
     PostRequest<List<transfer_ware>> post = new PostRequest<List<transfer_ware>>(this.Dispatcher, "/Technology/Service.aspx/RequestListWares");
     post.ProcessResponse += this.ProcessListWares;
     post.Perform("{ }");
 }
示例#49
0
        private void GetApplicability(object sender, RoutedEventArgs e)
        {
            PostRequest<List<transfer_appl>> post = new PostRequest<List<transfer_appl>>(this.Dispatcher, "/Technology/Service.aspx/GetApplicability");
            post.ProcessResponse += this.ProcessApplicability;

            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;
            post.Perform(String.Format("{{ 'prodid': '{0}' }}", urlparams["prodid"]));
        }
示例#50
0
        protected void ColumnsBind(object sender, RoutedEventArgs e)
        {
            //list.Add(new MetaColumn() { Header = "Уровень вхождения", Binding = "level" });

            columns.Add(new MetaColumn() { Header = "Обозначение узла", Binding = "unit_pn1" });
            columns.Add(new MetaColumn() { Header = "Наименование узла", Binding = "unit_pn2" });

            columns.Add(new MetaColumn() { Header = "Обозначение детали", Binding = "prod_pn1" });
            columns.Add(new MetaColumn() { Header = "Наименование детали", Binding = "prod_pn2" });

            columns.Add(new MetaColumn() { Header = "Позиция", Binding = "level" });
            columns.Add(new MetaColumn() { Header = "Кол-во деталей в узле по спецификации", Binding = "count" });
            //list.Add(new MetaColumn() { Header = "Единица измерения количества", Binding = "config.measure" });
            columns.Add(new MetaColumn() { Header = "Группа замены", Binding = "group_exchange" });
            columns.Add(new MetaColumn() { Header = "Главная замена", Binding = "number_exchange" });

            columns.Add(new MetaColumn() { Header = "Материал", Binding = "material" });
            columns.Add(new MetaColumn() { Header = "Вид поставки", Binding = "pvd" });
            columns.Add(new MetaColumn() { Header = "Маршрут", Binding = "route" });
            columns.Add(new MetaColumn() { Header = "Маршрут по применяемости", Binding = "route_changed", Booled = true });
            //list.Add(new MetaColumn() { Header = "Материал", Binding = "kmh.material" });
            columns.Add(new MetaColumn() { Header = "Форма заготовки", Binding = "sf" });
            columns.Add(new MetaColumn() { Header = "Размер заготовки", Binding = "ss" });
            columns.Add(new MetaColumn() { Header = "Кол-во деталей из заготовки", Binding = "sd" });
            columns.Add(new MetaColumn() { Header = "Масса штамповки", Binding = "stw" });
            columns.Add(new MetaColumn() { Header = "Масса заготовки", Binding = "sw" });
            columns.Add(new MetaColumn() { Header = "Размер поковки", Binding = "sp" });
            columns.Add(new MetaColumn() { Header = "Норма расхода", Binding = "no" });
            columns.Add(new MetaColumn() { Header = "Единица измерения нормы расхода", Binding = "um" });
            columns.Add(new MetaColumn() { Header = "Примечание", Binding = "cmt_ogt" });
            //list.Add(new MetaColumn() { Header = "Автор последнего изменения", Binding = "last_user" });
            columns.Add(new MetaColumn() { Header = "КМХ утв гл. технологом", Binding = "gotov_kmh", Booled = true });
            columns.Add(new MetaColumn() { Header = "КМХ утв гл. технологом (Дата)", Binding = "gotov_date" });
            //list.Add(new MetaColumn() { Header = "Дата последнего изменения", Binding = "date_update" });

            columns.Add(new MetaColumn() { Header = "Готовность технолога", Binding = "gotov_tech", Booled = true });
            columns.Add(new MetaColumn() { Header = "Готовность сварщика", Binding = "gotov_svar", Booled = true });
            columns.Add(new MetaColumn() { Header = "Готовность химика", Binding = "gotov_him", Booled = true });
            columns.Add(new MetaColumn() { Header = "Дата добавления", Binding = "added_date", Converter = new DateTimeConverter()});
            columns.Add(new MetaColumn() { Header = "Актуальность", Binding = "actual", Booled = true });
            columns.Add(new MetaColumn() { Header = "По приказу", Binding = "isprikaz", Booled = true });

            columns.Add(new MetaColumn() { Header = "Последние изменения (пользователь)", Binding = "last_change_user" });
            columns.Add(new MetaColumn() { Header = "Последние изменения (дата)", Binding = "last_change_date", Converter = new DateTimeConverter() });

            foreach (var metaColumn in columns)
            {
                metaColumn.Visible = true;

                if (metaColumn.Booled)
                {
                    grid.Columns.Add(new DataGridCheckBoxColumn()
                    {
                        Header = metaColumn.Header,
                        Binding = new Binding(metaColumn.Binding),
                        IsReadOnly = true
                    });
                }
                else
                {
                    grid.Columns.Add(new DataGridTextColumn()
                    {
                        Header = metaColumn.Header,
                        Binding = new Binding(metaColumn.Binding)
                        {
                            Converter = metaColumn.Converter
                        },
                        IsReadOnly = true
                    });
                }
            }

            // get setting from server DB
            PostRequest<List<transfer_column>> post = new PostRequest<List<transfer_column>>(this.Dispatcher, "/Technology/Service.aspx/GetColumns");
            post.ProcessResponse += delegate(List<transfer_column> list2)
            {
                foreach (var metaColumn in this.columns)
                {
                    var dbColumn = list2.Single(it => it.uid == new Guid(MD5CryptoServiceProvider.GetMd5String(metaColumn.Header)));
                    var gridColumn = grid.Columns.Single(clm => String.Equals(clm.Header, metaColumn.Header));
                    metaColumn.Visible = !dbColumn.hidden;
                    metaColumn.Width = dbColumn.width;
                    gridColumn.Width = new DataGridLength(dbColumn.width);
                    gridColumn.DisplayIndex = dbColumn.position;
                }
                SyncMetaColumnsToUserUI(false);
                //getting_columns = true;

                bw.DoWork += grid_ColumnWidthWorker;
                bw.RunWorkerAsync();

                grid.ColumnReordered += this.grid_ColumnDisplayIndexChanged;
                grid.LayoutUpdated += this.grid_LayoutUpdated;
            };
            post.Perform(new SET_COLUMNS_PROTO() { ClassificationTreeId = new Guid("11110000-0000-0000-0000-000011110101") });
        }
示例#51
0
        private void copyToBuffer(object sender, RoutedEventArgs e)
        {
            ShowGlobalMask("Копирование в буфер обмена...");

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

            PostRequest<PostResult> post = new PostRequest<PostResult>(this.Dispatcher, "/Technology/Buffer.aspx/Insert");
            post.ProcessResponse += new PostRequest<PostResult>.ProcessResponseEvent(delegate(PostResult result)
            {
                if (result.Opcode != 0)
                {
                    MessageBox.Show(result.Message);
                }
                HideGlobalMask();
            });
            post.ProcessError += new PostRequest<PostResult>.ProcessErrorEvent(delegate()
            {
                MessageBox.Show("Ошибка при копировании в буфер");
                HideGlobalMask();
            });

            DataGrid dataGrid = (AddTabs.SelectedItem as TabItem).Content as DataGrid;
            post.Perform(new BufferInsert_PROTO() { inserted = dataGrid.SelectedItems.Cast<transfer_add>().ToList() });
        }
示例#52
0
        private void ConnectToDataSource()
        {
            IDictionary<string, string> urlparams = HtmlPage.Document.QueryString;
            PostRequest<UniTransfer> post = new PostRequest<UniTransfer>(this.Dispatcher, urlparams["data"].Substring(0, urlparams["data"].IndexOf('?')));
            post.ProcessResponse += new PostRequest<UniTransfer>.ProcessResponseEvent(delegate(UniTransfer result)
                {
                    ShowGlobalMask("Распаковка данных...");

                    BindColumns(result.columns);

                    IList<IDictionary> source = new List<IDictionary>();
                    foreach (var row in result.rows)
                    {
                        var cells = new Dictionary<string, object>();

                        foreach (var column in result.columns)
                        {
                            if (column.uniType == UniColumn.UniType.Decimal)
                            {
                                cells[column.dataBind] = Convert.ToDecimal(row[result.columns.IndexOf(column)], CultureInfo.InvariantCulture);
                            }
                            else
                            {
                                cells[column.dataBind] = row[result.columns.IndexOf(column)];
                            }
                        }

                        (source as List<IDictionary>).Add(cells);
                    }

                    if (source.Count() > 0)
                    {
                        grid.FilteredItemsSource = source.ToArray().ToDataSource();
                    }

                    HideGlobalMask();
                });
            post.ProcessError += new PostRequest<UniTransfer>.ProcessErrorEvent(delegate()
                {
                });

            string dataUrl = urlparams["data"];
            string dataParams = dataUrl.Substring(dataUrl.IndexOf('?')+1);
            string innerParams = "";

            foreach (var param in dataParams.Split('&').Where(i => !String.IsNullOrEmpty(i)))
            {
                innerParams += string.Format("'{0}': '{1}',", param.Split('=').First(), param.Split('=').Last());
            }

            post.Perform(string.Format("{{ {0} }}", innerParams.Substring(0, innerParams.Length - 1)));
            ShowGlobalMask("Загрузка данных...");
        }