Пример #1
0
        public JsonResponse UpdateItemMenu([FromBody]JsonRequest model)
        {
            try
            {
                UpdateView ret = model.Data.ToString().DeserializeObject<UpdateView>();
                if (ret.KID <= 0)
                {
                    return FastJson("", model.Token, 1, "kid不能为空");
                }
                SysLoginUser user = UserInfoUtil.UserInfo(model.Token);
                var data = BlogHelper.Update_Sysmenu(ret.Update, ret.KID, new OpertionUser()
                {
                    UserId = user?.Model?.KID.ToString(),
                    UserName = user?.Model?.UserName,
                    UserClientIp = GetIP(),
                });
                return FastJson(data, model.Token, data.IsSucceed ? 0 : 1, data.Message);

            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "/Menu/DelItemMenuByKid");
                return new JsonResponse() { Code = 1, Msg = $"请求失败:{ex.Message}" };
            }
        }
Пример #2
0
        public JsonResponse StartOrStop([FromBody] JsonRequest model)
        {
            try
            {
                UpdateView up = model?.Data?.ToString().DeserializeObject <UpdateView>();
                if (up == null || up.Update == null || string.IsNullOrEmpty(up.Num))
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "参数不合法"
                    });
                }
                var opt = new OpertionUser();

                var infodic = AddBaseInfo <Bloginfo>(up.Update, model.Token, false, ref opt);

                var dicwhere = new Dictionary <string, object>()
                {
                    { nameof(Bloginfo.BlogNum), up.Num }
                };
                var res1 = BlogHelper.UpdateByWhere_Bloginfo(infodic, dicwhere, opt);
                Task.Run(() =>
                {
                    CacheHelper.DelCacheItem(ConfigUtil.BlogListCacheKey);
                    CacheHelper.DelCacheItem($"{ConfigUtil.BlogItemCacheKeyPrefix}{up.Num}");
                });
                return(FastResponse(res1, model.Token, 0, 0, res1.Message));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "AdminBlogController/UpdateItemBlog");
                return(new JsonResponse {
                    Code = 1, Msg = "程序视乎开小差" + ex.Message
                });
            }
        }
Пример #3
0
        public JsonResponse GetItemBlog([FromBody] JsonRequest model)
        {
            try
            {
                UpdateView up = model?.Data?.ToString().DeserializeObject <UpdateView>();
                if (up == null || string.IsNullOrEmpty(up.Num))
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "参数不合法"
                    });
                }

                var entity = BlogHelper.GetModelByNum(up.Num);
                if (entity == null)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = $"暂未查询到{up.KID}该信息"
                    });
                }

                return(FastResponse(entity, model.Token));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "AdminBlogController/GetList_Blog");
                return(new JsonResponse {
                    Code = 1, Msg = "程序视乎开小差" + ex.Message
                });
            }
        }
Пример #4
0
        public void Update(int id)
        {
            var model = _contact.FirstOrDefault(c => c.Id == id);
            var view  = new UpdateView(model);

            Render(view);
        }
 public JsonResponse GetList([FromBody] JsonRequest model)
 {
     try
     {
         UpdateView view = model.Data.DeserialObject <UpdateView>();
         if (view == null || view.Where == null)
         {
             return(new JsonResponse {
                 Code = 1, Msg = "参数错误"
             });
         }
         if (string.IsNullOrEmpty(view.OrderBy))
         {
             view.OrderBy = "CreateTime desc";
         }
         var retdata = BlogHelper.GetJsonListPage_Comment(model.Page, model.Limit, view.OrderBy, view.Where);
         return(FastJson(retdata.data, model.Token, retdata.code.Toint(), retdata != null ? "请求成功" : "请求失败", retdata != null ? retdata.count : 0));
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex, "AdminCommentController/GetList");
         return(new JsonResponse {
             Code = 1, Msg = "程序错误" + ex.Message
         });
     }
 }
Пример #6
0
        public JsonResponse UpdateItem([FromBody] JsonRequest model)
        {
            try
            {
                UpdateView view = model.Data.DeserialObject <UpdateView>();
                if (view == null || view.KID <= 0 || view.Update == null)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "参数不合法"
                    });
                }
                SysLoginUser user = UserInfoUtil.UserInfo(model.Token);
                if (!user.IsAdmin)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "暂无操作权限"
                    });
                }
                OpertionUser opt = new OpertionUser();
                view.Update = AddBaseInfo <Category>(view.Update, model.Token, false, ref opt);

                Result res = BlogHelper.Update_Category(view.Update, view.KID, opt);
                return(FastJson(res, model.Token, res.IsSucceed ? 0 : 1, res.IsSucceed ? "操作成功" : "操作失败"));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "CategoryController/UpdateItem");
                return(new JsonResponse {
                    Code = 1, Msg = "程序错误" + ex.Message
                });
            }
        }
Пример #7
0
        public JsonResponse UpdateMember([FromBody] JsonRequest model)
        {
            try
            {
                UpdateView item = model?.Data.ToString().DeserialObject <UpdateView>();
                if (model == null || item.Update == null || string.IsNullOrEmpty(item.Num))
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "参数不合法"
                    });
                }

                item.Update.Add(nameof(Member.UpdateTime), DateTime.Now.Tostr());
                item.Update.Add(nameof(Member.UpdateUserId), 1);
                item.Update.Add(nameof(Member.UpdateUserName), "会员修改昵称");
                var res = BlogHelper.UpdateByWhere_Member(item.Update, new Dictionary <string, object>()
                {
                    { nameof(Member.IsDeleted), 0 },
                    { nameof(Member.UserAccount), item.Num }
                }, new OpertionUser());


                return(new JsonResponse {
                    Code = res.IsSucceed ? 0 : 1, Msg = res.Message
                });
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "MemberController/UpdateMember");
                return(new JsonResponse {
                    Code = 1, Msg = "程序好像开小差了" + ex
                });
            }
        }
Пример #8
0
 public JsonResponse GetList([FromBody] JsonRequest model)
 {
     try
     {
         UpdateView view = model.Data.ToString().DeserializeObject <UpdateView>();
         if (view == null || view.Where == null)
         {
             view       = new UpdateView();
             view.Where = new Dictionary <string, object>();
         }
         view.Where.Add(nameof(Category.IsDeleted), 0);
         if (string.IsNullOrEmpty(view.OrderBy))
         {
             view.OrderBy = "CreateTime desc";
         }
         var list = BlogHelper.GetJsonListPage_Category(model.Page, model.Limit, view.OrderBy, view.Where);
         return(FastResponse(list.data, model.Token, list.code.Toint(), list.code.Toint() == 0 ? list.count : 0));
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex, "CategoryController/GetListCartgory");
         return(new JsonResponse {
             Code = 1, Msg = "程序视乎开小差了"
         });
     }
 }
Пример #9
0
        private void FunctionSwitcher(string SelectedFunctionName)
        {
            UserControl usc;

            switch (SelectedFunctionName)
            {
            case "Create":
                usc = new CreateView();
                break;

            case "Update":

                usc             = new UpdateView();
                usc.DataContext = new CategoryViewModel {
                    SelectedCategoryId = this.SelectedCategoryId
                };
                break;

            case "Delete":
                DeleteCategory();
                usc = new CategoryView();
                break;

            default:
                usc = new CategoryView();
                break;
            }
            ;
            Session.Instance.SetNextView(usc);
        }
Пример #10
0
 public JsonResponse DeleteItem([FromBody] JsonRequest model)
 {
     try
     {
         UpdateView view = model.Data.DeserialObject <UpdateView>();
         if (view == null || view.KID <= 0)
         {
             return(new JsonResponse {
                 Code = 1, Msg = "参数不合法"
             });
         }
         view.Update = new Dictionary <string, object>();
         view.Update.Add(nameof(Sysrole.IsDeleted), 0);
         OpertionUser opt = new OpertionUser();
         view.Update = AddBaseInfo <Sysrole>(view.Update, model.Token, false, ref opt);
         Result res = BlogHelper.Update_Sysrole(view.Update, view.KID, opt);
         return(FastJson(res, model.Token, res.IsSucceed ? 0 : 1, res.IsSucceed ? "操作成功" : "操作失败"));
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex, "AdminRoleController/DeleteItem");
         return(new JsonResponse {
             Code = 1, Msg = "程序错误" + ex.Message
         });
     }
 }
Пример #11
0
        public JsonResponse IsOrNotPraise([FromBody] JsonRequest model)
        {
            try
            {
                UpdateView item = model?.Data?.ToString().DeserialObject <UpdateView>();
                if (item == null || item.Where == null)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "参数不合法"
                    });
                }
                item.Where.Add(nameof(ArticlePraise.IsDeleted), 0);
                string blognum = item.Where["BlogNum"].ToString();

                int count = BlogHelper.GetCount_ArticlePraise(new Dictionary <string, object>()
                {
                    { nameof(ArticlePraise.BlogNum), blognum },
                    { nameof(ArticlePraise.IsDeleted), 0 }
                });

                var ret = BlogHelper.GetModelByWhere_ArticlePraise(item.Where);

                return(new JsonResponse {
                    Code = 0, Data = new { ArticlePraise = ret?.KID > 0, Count = count }
                });
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "BlogController/IsOrNotPraise");
                return(new JsonResponse {
                    Code = 1, Msg = "程序好像开小差了" + ex.Message
                });
            }
        }
Пример #12
0
 public void ChangeMethod()
 {
     if (SelectedMember != null)
     {
         UpdateView changeView = new UpdateView();
         Messenger.Default.Send(SelectedMember);
         changeView.Show();
     }
 }
Пример #13
0
        public async Task <ApiResult <bool> > Update(UpdateView bundle)
        {
            var json        = JsonConvert.SerializeObject(bundle);
            var httpContent = new StringContent(json, Encoding.UTF8, "application/json");
            var url         = $"/api/Notification/";
            var result      = await Update(url, httpContent);

            return(result);
        }
Пример #14
0
        private static void ShowUpdate()
        {
            var updateViewModel = new UpdateViewModel(UpdateManager.Instance.NewUpdate.Version);
            var updateView      = new UpdateView {
                DataContext = updateViewModel
            };

            updateView.Show();
        }
Пример #15
0
        /// <summary>
        /// 采集数据到达
        /// </summary>
        /// <param name="newData"></param>
        void cm_OnDataChanged(CompassModuleData newData)
        {
            UpdateView ev2 = delegate(CompassModuleData args)
            {
                VMThis.CMDataRT = args;

                CMDataList.Add(args);
            };

            Dispatcher.BeginInvoke(ev2, newData);
        }
Пример #16
0
        public JsonResponse ResetPsw([FromBody] JsonRequest model)
        {
            try
            {
                UpdateView item = model?.Data.ToString().DeserialObject <UpdateView>();
                if (model == null || item.Update == null || !item.Update.ContainsKey(nameof(Member.UserAccount)))
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "参数不合法"
                    });
                }
                var qrkey       = item.Update["QrcodeKey"].ToString();
                var qrcode      = item.Update["Qrcode"].ToString();
                var userAccount = item.Update[nameof(Member.UserAccount)].ToString();

                string key = $"{userAccount}_{qrkey}";
                var    qr  = CacheHelper.GetCacheItem(key)?.ToString() ?? "";
                if (qr != qrcode)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "验证码错误请重试"
                    });
                }
                CacheHelper.DelCacheItem(key);

                var mem = BlogHelper.GetModelByWhere_Member(new Dictionary <string, object>
                {
                    { nameof(Member.IsDeleted), 0 },
                    { nameof(Member.UserAccount), userAccount }
                });
                if (mem == null || mem?.KID <= 0)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "该账户不存在"
                    });
                }
                item.Update.Add(nameof(Member.UpdateTime), DateTime.Now);
                item.Update.Add(nameof(Member.UpdateUserId), mem.UpdateUserId);
                item.Update.Add(nameof(Member.UpdateUserName), mem.UpdateUserName);
                var res = BlogHelper.Update_Member(item.Update, mem.KID, new OpertionUser());

                return(new JsonResponse {
                    Code = res.IsSucceed ? 0 : 1, Msg = res.Message
                });
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "MemberController/ResetPsw");
                return(new JsonResponse {
                    Code = 1, Msg = "程序好像开小差了" + ex
                });
            }
        }
Пример #17
0
 private void UpdListView(ListViewItem lvi)
 {
     if (UpdateView.InvokeRequired)
     {
         UpdateView.Invoke(new Action <ListViewItem>(UpdListView), new object[] { lvi });
     }
     else
     {
         UpdateView.Items.Add(lvi);
         UpdateView.Refresh();
     }
 }
Пример #18
0
        public JsonResponse RegistItemMember([FromBody] JsonRequest model)
        {
            try
            {
                UpdateView item = model.Data.ToString()?.DeserialObject <UpdateView>();
                if (item == null || item.Update == null || !item.Update.ContainsKey(nameof(Member.UserAccount)))
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "参数不合法"
                    });
                }
                var qrkey  = item.Update["Qrcodekey"].ToString();
                var qrcode = item.Update["Qrcode"].ToString();


                string qr = CacheHelper.GetCacheItem($"Blogimgcode_{qrkey}")?.ToString() ?? "";
                if (qr != qrcode)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "验证码错误"
                    });
                }
                var userAccount = item.Update[nameof(Member.UserAccount)].ToString();
                var mem         = BlogHelper.GetModelByWhere_Member(new Dictionary <string, object>
                {
                    { nameof(Member.IsDeleted), 0 },
                    { nameof(Member.UserAccount), userAccount }
                });
                if (mem != null || mem?.KID > 0)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "账户已存在,请直接登录"
                    });
                }
                item.Update.Add("CreateTime", DateTime.Now);
                item.Update.Add("CreateUserId", 1);
                item.Update.Add(nameof(Member.CreateUserName), "system");
                var res = BlogHelper.Add_Member(item.Update, new Service.Models.View.OpertionUser());

                return(new JsonResponse {
                    Code = res.IsSucceed ? 0 : 1, Msg = res.Message
                });
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "MemberController/RegistItemMember");
                return(new JsonResponse {
                    Code = 1, Msg = "程序好像开小差了" + ex
                });
            }
        }
    public MainView()
    {
        var vm = new MainViewModel();

        this.DataContext = vm;

        vm.UpdateRequested += (sender, e) =>
        {
            var updateView = new UpdateView();
            updateView.DataContext = e.Data;                    // Gets the instance of the viewModel here

            updateView.ShowDialog();
        };
    }
Пример #20
0
        private void MainTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (StartView.RestartWorkflow == null)
            {
                StartView.RestartWorkflow += RestartWorkflow;
            }

            e.Handled = false;

            if (GlobalObjects.ViewModel.BlockNavigation)
            {
                MainTabControl.SelectedIndex = _cacheIndex;
                return;
            }

            ThemeManager.TransitionsEnabled = MainTabControl.SelectedIndex != 4;
            ThemeManager.TransitionsEnabled = false;

            TabItem tabItem = null;

            if (MainTabControl.SelectedIndex > -1)
            {
                tabItem            = ((TabItem)MainWindowTabs.Items[MainTabControl.SelectedIndex]);
                tabItem.IsSelected = true;
                tabItem.IsEnabled  = true;
            }

            if (_cacheIndex != MainTabControl.SelectedIndex)
            {
                if (tabItem != null && !GlobalObjects.ViewModel.ResetXml)
                {
                    if (!tabItem.Content.GetType().ToString().ToLower().Contains("productview"))
                    {
                        ProductView.UpdateXml();
                    }
                    if (!tabItem.Content.GetType().ToString().ToLower().Contains("display"))
                    {
                        DisplayView.UpdateXml();
                    }
                    if (!tabItem.Content.GetType().ToString().ToLower().Contains("update"))
                    {
                        UpdateView.UpdateXml();
                    }
                }
                GlobalObjects.ViewModel.ResetXml = false;

                _cacheIndex = MainWindowTabs.SelectedIndex;
            }
        }
Пример #21
0
        public async Task <ApiResult <bool> > Update(UpdateView bundle)
        {
            var notification = await _context.Notifications.FindAsync(bundle.Id);

            if (notification == null)
            {
                return(new ApiErrorResult <bool>("Không tồn tại thông báo"));
            }

            notification.View = true;
            _context.Notifications.Update(notification);
            await _context.SaveChangesAsync();

            return(new ApiSuccessResult <bool>());
        }
Пример #22
0
        private void RestartWorkflow(object sender, EventArgs eventArgs)
        {
            for (var i = 1; i < MainTabControl.Items.Count; i++)
            {
                var tabItem = (TabItem)MainTabControl.Items[i];
                //tabItem.IsEnabled = false;
            }

            ProductView.Reset();
            UpdateView.Reset();
            DisplayView.Reset();

            ProductView.LoadXml();
            DisplayView.LoadXml();
            UpdateView.LoadXml();
        }
Пример #23
0
        private void CanvasWaveform_Loaded(object sender, RoutedEventArgs e)
        {
            propertyChangedEventHandler   = new System.ComponentModel.PropertyChangedEventHandler(ScaleManager_PropertyChanged);
            ScaleManager.PropertyChanged += propertyChangedEventHandler;
            signalViewer = SignalViewBase.GetSignalViewer(Variable, ScaleManager);

            Core.BookMarks.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(BookMarks_CollectionChanged);

            UpdateCanvas();

            updateView = new UpdateView(CursorViewer_CursorPositionChangedEvent);
            CursorViewer.CursorPositionChangedEvent += updateView;

            Height = Variable.Height;

            this.InvalidateVisual();
        }
Пример #24
0
 /// <summary>
 /// 画面更新
 /// </summary>
 /// <param name="strVID">ベンダーid</param>
 /// <param name="strPID">プロダクトid</param>
 /// <param name="strHub">ハブ</param>
 private void updateScreen(string strVID, string strPID, string strHub)
 {
     if (this.InvokeRequired)
     {
         UpdateView uv = new UpdateView(updateScreen);
         this.Invoke(uv, new string[] { strVID, strPID, strHub });
     }
     else
     {
         this.driveText.Text = this.m_cDrive.ToString();
         this.vidText.Text   = strVID;
         this.pidText.Text   = strPID;
         this.portText.Text  = strHub;
         // 実行中を終了
         Application.UseWaitCursor = false;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List <string> empData = Session["empData"] as List <string>;
                ManagerName.InnerText = Global.ReadDataString($"SELECT EMPNAME FROM EMPLOYEES WHERE RESOURCENAME='{Session["ManagerName"].ToString()}';");
                NameViewLabel.Text    = "Employee Name: " + empData[0];
                DateViewLabel.Text    = "Date Submited: " + empData[1];
                TotalHoursLabel.Text  = "Total Hours Worked: " + empData[2];
                TotalAppLabel.Text    = " Total Hours Applied: " + empData[2];

                DataTable df = Session["DataFile"] as DataFile;

                UpdateView.DataSource = df;
                UpdateView.DataBind();
            }
        }
Пример #26
0
        public ViewResult Update(int id)
        {
            Guarantor  guarantor  = _guarantor.GetGuarantor(id);
            UpdateView updateView = new UpdateView()
            {
                Id            = guarantor.ID,
                FirstName     = guarantor.FirstName,
                LastName      = guarantor.LastName,
                Email         = guarantor.Email,
                Phone         = guarantor.Phone,
                Address       = guarantor.Address,
                Nationality   = guarantor.Nationality,
                Gender        = guarantor.Gender,
                MaritalStatus = guarantor.MaritalStatus
            };

            return(View(updateView));
        }
Пример #27
0
 public JsonResponse GetItemMenuByKid([FromBody]JsonRequest model)
 {
     try
     {
         UpdateView ret = model.Data.ToString().DeserializeObject<UpdateView>();
         if (ret.KID <= 0)
         {
             return FastJson("", model.Token, 1, "kid不能为空");
         }
         Sysmenu data = BlogHelper.GetModelByKID_Sysmenu(ret.KID);
         return FastJson(data, model.Token);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex, "/Menu/GetItemMenuByKid");
         return new JsonResponse() { Code = 1, Msg = $"请求失败:{ex.Message}" };
     }
 }
Пример #28
0
 private void XmlImported(object sender, EventArgs eventArgs)
 {
     try
     {
         GlobalObjects.ViewModel.PropertyChangeEventEnabled = false;
         ProductView.LoadXml();
         DisplayView.LoadXml();
         UpdateView.LoadXml();
     }
     catch (Exception ex)
     {
         ex.LogException();
     }
     finally
     {
         GlobalObjects.ViewModel.PropertyChangeEventEnabled = true;
     }
 }
Пример #29
0
        public JsonResponse AddItemBlog([FromBody] JsonRequest model)
        {
            try
            {
                UpdateView up = model?.Data?.ToString().DeserializeObject <UpdateView>();
                if (up == null || up.Update == null)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = "参数不合法"
                    });
                }
                var opt     = new OpertionUser();
                var content = up.Update[nameof(Blogcontent.Content)].ToString();
                var blognum = Guid.NewGuid().ToString().Replace("-", "");


                var infodic = AddBaseInfo <Bloginfo>(up.Update, model.Token, true, ref opt);
                infodic.Add(nameof(Bloginfo.BlogNum), blognum);
                //var contdic = AddBaseInfo<Blogcontent>(updic, model.Token, true, ref opt);
                infodic.Add(nameof(Blogcontent.BloginfoNum), blognum);

                var res1 = BlogHelper.Add_Bloginfo(infodic, opt);
                //var res2 = BlogHelper.Add_Blogcontent(infodic, opt);
                if (!res1.IsSucceed)
                {
                    return(new JsonResponse {
                        Code = 1, Msg = $"添加失败{res1.SerializeObject()};"
                    });
                }
                Task.Run(() =>
                {
                    CacheHelper.DelCacheItem(ConfigUtil.BlogListCacheKey);
                    CacheHelper.DelCacheItem($"{ConfigUtil.BlogItemCacheKeyPrefix}{up.Num}");
                });
                return(FastResponse("", model.Token, 0, 0, "添加成功"));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "AdminBlogController/AddItemBlog");
                return(new JsonResponse {
                    Code = 1, Msg = "程序视乎开小差" + ex.Message
                });
            }
        }
Пример #30
0
        public void updateUsers()
        {
            UpdateView updateview = new UpdateView();

            if (selectedCustomer == null)
            {
                MessageBox.Show("No customer selected");
            }
            else
            {
                var viewModelMessage = new ViewModelMessage()
                {
                    cust  = selectedCustomer,
                    Text  = "Update",
                    SName = statedata
                };
                Messenger.Default.Send(viewModelMessage);
                updateview.ShowDialog();
            }
        }
Пример #31
0
 public UpdateView()
 {
     InitializeComponent();
     View = this;
 }