Esempio n. 1
0
        public bool CreateAndAddNotice(JobType type, int agentsNeeded, List<Node> whichNodes, out Notice notice)
        {
            Notice n = null;
            Int64 id = _freeID;
            _freeID++;
            switch (type)
            {
                case JobType.Attack:
                    n = new AttackJob(agentsNeeded, whichNodes, id);
                    break;
                case JobType.Disrupt:
                    n = new DisruptJob(agentsNeeded, whichNodes, id);
                    break;
                case JobType.Occupy:
                    n = new OccupyJob(agentsNeeded, whichNodes, id);
                    break;
                case JobType.Repair:
                    n = new RepairJob(whichNodes, id);
                    break;
            }
            if (n == null)
                throw new ArgumentException("Input to CreateNotice, JoType : " + type.GetType().Name + " was not of appropriate type. It's type was: " + type.GetType());

            bool b = AddNotice(n);
            notice = n;

            return b;
        }
Esempio n. 2
0
 public static List<Notice> GetNoticeList(Notice notice, int PageSize, int PageIndex)
 {
     NoticeBLL noticeBLL = new NoticeBLL();
     //IES.JW.Model.Notice notice = new IES.JW.Model.Notice();
     IES.JW.Model.User user = IES.Service.UserService.CurrentUser;
     notice.UserID = user.UserID;
     return noticeBLL.Notice_List(notice, PageIndex, PageSize);
 }
Esempio n. 3
0
 //internal TextBlock tbkMsg;
 //internal TextBlock tbkTitle;
 //internal TextBlock tbkView;
 //private bool _contentLoaded;
 public NotifyWindow(Notice notice)
 {
     this.InitializeComponent();
     this.tbkMsg.Text = notice.Message;
     this.tbkTitle.Text = notice.Title;
     this.link = notice.Link;
     this.InitEvent(notice.MessageType);
 }
Esempio n. 4
0
    protected void submit_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBox1.Text) && !string.IsNullOrEmpty(CKEditorControl1.Text))
        {

            using (var db = new ItshowEntities2())
            {

                var noticeAdd = new Notice();
                noticeAdd.Headline = TextBox1.Text;
                noticeAdd.Puttime = DateTime.Now.ToString();
              //  noticeAdd.Contents = CKEditorControl1.Text;

                noticeAdd.Image = "1";

                noticeAdd = new Notice
                    {
                        Headline = TextBox1.Text,

                        Puttime = DateTime.Now.ToString(),

                        Contents = CKEditorControl1.Text,
                        Image = "1",
                    };

                db.Notices.Add(noticeAdd);

                try
                {

                    int Vf = db.SaveChanges(); // 写数据库
                    db.SaveChanges();
                    if (Vf == 1)
                    {
                        Response.Write("<script>alert('添加成功');</script>");

                    }
                }
                catch (DbEntityValidationException Ex)

                {

                }

                      //  DbEntityValidationException

                // Response.Redirect("~/Frontstage/login.aspx");

            }

        }

        else
        {
            Response.Write("<script>alert('标题和内容不能为空');</script>");

        }
    }
Esempio n. 5
0
        public void DeleteNotice(Notice notice)
        {
            if (notice == null)
                throw new ArgumentNullException("notice");
            if(notice.IsSystem)
                throw new AaronException("Notice is system that be not deleted!");

            _noticeRepository.Delete(notice);

            _cacheManager.RemoveByPattern(NOTICE_ALL);
            _cacheManager.RemoveByPattern(NOTICE_BY_ID);
        }
Esempio n. 6
0
 public void ApplyToNotice(Notice notice, int desirability, NabfAgent a)
 {
     foreach (Notice n in _availableJobs.Get(NoticeToJobType(notice)))
     {
         if (n.ContentIsEqualTo(notice))
         {
             n.Apply(desirability, a);
             _agentToNotice.Add(a, n);
             break;
         }
     }
 }
Esempio n. 7
0
        public void Muted_notice_does_not_throw_exception()
        {
            Twitter.Setup(new Setup() {
                { "consumerkey", "jgsldfghdfgu5y" },
                { "consumersecret", "593u46[po3jkryt'lsgldkjfsf,adfsdfg" },
                { "accesstoken", "4528345-jahfkjsdgnpsuehtpuehgjn;SDMnspuihgs" },  // should be "accesstoken"
                { "accesstokensecret", "3573JSL;KGEPUTWPDMS;LKGJRGUITU55L2T" }     // should be "accesstokensecret"
            });

            Notice n = new Notice("This won't be broadcast.");
            n.SetMedia(typeof(Twitter));
            n.Mute().Send();
        }
Esempio n. 8
0
 /// <summary>
 /// 插入一条新通知
 /// </summary>
 /// <param name="notice">通知</param>
 /// <returns></returns>
 public Boolean InsertNOTICE(Notice notice)
 {
     Boolean flag = true;
     try
     {
         sqlMapper.Insert("InsertNOTICE", notice);
     }
     catch (Exception)
     {
         flag = false;
     }
     return flag;
 }
Esempio n. 9
0
 /// <summary>
 /// 获取通知对象
 /// </summary>
 /// <returns></returns>
 private Notice GetNotice()
 {
     Notice notice = new Notice();
     notice.title = this.titleTextBox.Text;
     notice.content = this.contentTextBox.Text;
     try
     {
         notice.id = Int32.Parse(this.idHiddenField.Value);
     }
     catch (Exception)
     {
     }
     return notice;
 }
Esempio n. 10
0
    /// <summary>
    /// 获取通知对象
    /// </summary>
    /// <returns></returns>
    private Notice GetNotice()
    {
        User user = (User)Session["login"];
        if (null == user || user.role != UserRole.ADMIN)
        {
            GlobalMethod.RedirectLogin(Response);
            return null;
        }

        Notice notice = new Notice();
        notice.title = this.titleTextBox.Text;
        notice.content = this.contentTextBox.Text;
        notice.dlr = user.name;
        notice.visit_count = 0;
        return notice;
    }
Esempio n. 11
0
        public bool AddJob(Notice n)
        {
            if (n.HighestAverageDesirabilityForNotice == -1)
                return false;
            if (_jobs.ContainsKey(n.HighestAverageDesirabilityForNotice))
            {
                List<Notice> l = _jobs[n.HighestAverageDesirabilityForNotice].ToList();
                l.Add(n);
                _jobs.Remove(n.HighestAverageDesirabilityForNotice);
                _jobs.Add(n.HighestAverageDesirabilityForNotice, l.ToArray());
            }
            else
                _jobs.Add(n.HighestAverageDesirabilityForNotice, new Notice[] { n });

            return true;
        }
Esempio n. 12
0
        public void Invalid_credentials_throws_NoticeDispatchException()
        {
            Email.Setup(new Setup() {
                { "to", "*****@*****.**" },
                { "from", "*****@*****.**" },
                { "ssl", true },
                { "subject", "This won't be sent" },
                { "server", "smtp.gmail.com" },
                { "port", 587 },
                { "username", "*****@*****.**" },
                { "password", "not_my_password" }
            });

            Notice test = new Notice("This won't be sent");
            test.SetMedia(typeof(Email));
            test.Send();
        }
Esempio n. 13
0
    protected void ButtonCreateNotice_Click(object sender, EventArgs e)
    {
        Dictionary<string, string> vars = new Dictionary<string, string>();

        int days = Convert.ToInt32(DropDownListDays.SelectedValue);
        int rentTypeIndex = Convert.ToInt32(DropDownListRentTypes.SelectedValue);
        vars["intDays"] = days.ToString();
        vars["strDays"] = NumberToEnglish.EnglishFromNumber(days);
        /*if (days == 3)
        {
            vars["strDays"] = "Three";
        }
        else if (days == 5)
        {
            vars["strDays"] = "Five";
        }
        else
        {
            vars["strDays"] = days.ToString();
        }*/
        QuickPM.Tenant tenant = new QuickPM.Tenant(QuickPM.Util.FormatTenantId(DropDownListTenants.SelectedValue));
        vars["tenantName"] = tenant.Name;
        vars["tenantAddress"] = tenant.Address + ", " + tenant.City + ", " + tenant.State + " " + tenant.Zip;
        //vars["amountDue"] = "Not finished yet";
        vars["owner"] = TextBoxCreditorName.Text.Trim();
        vars["deliveryLocation"] = TextBoxDeliveryLocation.Text.Trim();
        vars["date"] = DateTime.Today.ToShortDateString();
        vars["agentTelephone"] = TextBoxAgentTelephone.Text.Trim();
        Notice notice = new Notice(Request.PhysicalApplicationPath + "/App_Data/NoticeTemplates/Pay" + Request["Notice"] + "NoticeTemplate.rtf", tenant.TenantId, rentTypeIndex, vars);
        string noticeText = notice.GenerateNotice();
        //Session["NoticeText"] = noticeText;
        Response.Clear();
        Response.AddHeader("Content-Disposition", "attachment; filename=" + "Notice.rtf");
        //Response.AddHeader("Content-Length", );
        Response.ContentType = "application/rtf";
        Response.Write(noticeText);
        Response.End();
    }
Esempio n. 14
0
 private bool AddNotice(Notice no)
 {
     if (AvailableJobsContainsContentEqual(no))
         return false;
     _idToNotice.Add(no.Id, no);
     _availableJobs.Add(NoticeToJobType(no), no);
     return true;
 }
Esempio n. 15
0
        public bool RemoveNotice(Notice no)
        {
            if (!AvailableJobsContainsContentEqual(no))
                return false;

            foreach (NabfProject.AI.NabfAgent a in no.GetAgentsApplied())
                UnApplyToNotice(no, a);
            _idToNotice.Remove(no.Id);
            _availableJobs.Remove(NoticeToJobType(no), no);
            return true;
        }
Esempio n. 16
0
        public JobType NoticeToJobType(Notice no)
        {
            if (no == null)
                throw new ArgumentNullException("Input to method NoticeToType was null.");

            if (no is DisruptJob)
                return JobType.Disrupt;
            else if (no is AttackJob)
                return JobType.Attack;
            else if (no is OccupyJob)
                return JobType.Occupy;
            else if (no is RepairJob)
                return JobType.Repair;
            else
                throw new ArgumentException("Input to NoticeToJobtype, object : " + no.GetType().Name + " was not of appropriate type. It's type was: " + no.GetType());
        }
Esempio n. 17
0
        public int FindTopDesiresForNotice(Notice n, out SortedList<int, NabfAgent> topDesires, out List<NabfAgent> agents)
        {
            int desire = 0, lowestDesire = -(n.GetAgentsApplied().Count + 1);

            agents = new List<NabfAgent>();
            topDesires = new SortedList<int, NabfAgent>(new InvertedComparer<int>());
            for (int i = 0; i < n.AgentsNeeded; i++)
            {
                topDesires.Add(lowestDesire--, null);
            }
            desire = 0;
            lowestDesire = -1;

            foreach (NabfAgent a in n.GetAgentsApplied())
            {
                n.TryGetValueAgentToDesirabilityMap(a, out desire);
                if (desire > lowestDesire)
                {
                    topDesires.Add(desire, a);
                    agents.Add(a);
                    agents.Remove(topDesires.Last().Value);
                    topDesires.RemoveAt(n.AgentsNeeded);
                    lowestDesire = topDesires.Keys[n.AgentsNeeded - 1];
                }
            }

            return lowestDesire;
        }
Esempio n. 18
0
        protected override void ShowPage()
        {
            if (!base.IsLogin())
            {
                return;
            }
            this.pagetitle = "查看短消息";
            if (this.pmid <= 0)
            {
                base.AddErrLine("参数无效");
                return;
            }
            if (!CreditsFacade.IsEnoughCreditsPM(this.userid))
            {
                this.canreplypm = false;
            }
            var msg = ShortMessage.FindByID(this.pmid);

            if (msg == null)
            {
                base.AddErrLine("无效的短消息ID");
                return;
            }
            if (msg.Msgfrom == "系统" && msg.MsgfromID == 0)
            {
                msg.Message = Utils.HtmlDecode(msg.Message);
            }
            if (msg == null || (msg.MsgtoID != this.userid && msg.MsgfromID != this.userid))
            {
                base.AddErrLine("对不起, 短消息不存在或已被删除.");
                this.newnoticecount = Notice.GetNewNoticeCountByUid(this.userid);
                return;
            }
            if (DNTRequest.GetQueryString("action").CompareTo("delete") != 0)
            {
                if (DNTRequest.GetQueryString("action").CompareTo("noread") == 0)
                {
                    //PrivateMessages.SetPrivateMessageState(this.pmid, 1);
                    msg.New = true;
                    msg.Update();
                    this.ispost = true;
                    if (!msg.New && msg.Folder == 0)
                    {
                        Users.UpdateUserNewPMCount(this.userid, this.olid);
                        base.AddMsgLine("指定消息已被置成未读状态,现在将转入消息列表");
                        base.SetUrl("usercpinbox.aspx");
                        base.SetMetaRefresh();
                    }
                }
                else
                {
                    //PrivateMessages.SetPrivateMessageState(this.pmid, 0);
                    msg.New = false;
                    msg.Update();

                    if (msg.New && msg.Folder == 0)
                    {
                        Users.UpdateUserNewPMCount(this.userid, this.olid);
                    }
                }
                this.msgto        = ((msg.Folder == 0) ? msg.Msgfrom : msg.Msgto);
                this.msgfrom      = msg.Msgfrom;
                this.subject      = msg.Subject;
                this.message      = UBB.ParseUrl(Utils.StrFormat(msg.Message));
                this.postdatetime = msg.PostDateTime.ToFullString();
                this.resubject    = "re:" + msg.Subject;
                this.remessage    = Utils.HtmlEncode("> ") + msg.Message.Replace("\n", "\n> ") + "\r\n\r\n";
                return;
            }
            this.ispost = true;
            msg.Delete();
            //if (ShortMessage.DeletePrivateMessage(this.userid, pmid + "") < 1)
            //{
            //    base.AddErrLine("消息未找到,可能已被删除");
            //    return;
            //}
            base.AddMsgLine("指定消息成功删除,现在将转入消息列表");
            base.SetUrl("usercpinbox.aspx");
            base.SetMetaRefresh();
        }
Esempio n. 19
0
 public int Update(Notice item)
 {
     return(0);
 }
Esempio n. 20
0
 //从后台获取数据
 internal static void LoadFromDAL(NoticeInfo pNoticeInfo, Notice  pNotice)
 {
     pNoticeInfo.noticeId = pNotice.NoticeId;
      		pNoticeInfo.noticeContent = pNotice.NoticeContent;
      		pNoticeInfo.signName = pNotice.SignName;
      		pNoticeInfo.noticeTime = pNotice.NoticeTime;
      		pNoticeInfo.noticeTitle = pNotice.NoticeTitle;
      		pNoticeInfo.employeeName = pNotice.EmployeeName;
     pNoticeInfo.Loaded=true;
 }
Esempio n. 21
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            IReadOnlyCollection <SystemSettings> settings;

            using (var scope = serviceProvider.CreateScope())
            {
                var dbContext = scope.ServiceProvider.GetRequiredService <ReservationDbContext>();
                dbContext.Database.EnsureCreated();
                if (!dbContext.Users.AsNoTracking().Any())
                {
                    dbContext.Users.Add(new User
                    {
                        UserId       = Guid.NewGuid(),
                        UserName     = "******",
                        UserPassword = SecurityHelper.SHA256("Admin888"),
                        IsSuper      = true
                    });
                    dbContext.Users.Add(new User
                    {
                        UserId       = Guid.NewGuid(),
                        UserName     = "******",
                        UserPassword = SecurityHelper.SHA256("Test1234"),
                        IsSuper      = false
                    });
                    dbContext.Users.Add(new User
                    {
                        UserId       = Guid.NewGuid(),
                        UserName     = "******",
                        UserPassword = SecurityHelper.SHA256("Test1234"),
                        IsSuper      = false
                    });

                    var blockTypes = new List <BlockType>
                    {
                        new BlockType {
                            TypeId = Guid.NewGuid(), TypeName = "联系方式"
                        },
                        new BlockType {
                            TypeId = Guid.NewGuid(), TypeName = "IP地址"
                        },
                        new BlockType {
                            TypeId = Guid.NewGuid(), TypeName = "预约人姓名"
                        }
                    };
                    dbContext.BlockTypes.AddRange(blockTypes);

                    var placeId  = Guid.NewGuid();
                    var placeId1 = Guid.NewGuid();
                    //Places init
                    dbContext.ReservationPlaces.AddRange(new[] {
                        new ReservationPlace {
                            PlaceId = placeId, PlaceName = "第一多功能厅", UpdateBy = "System", PlaceIndex = 0, MaxReservationPeriodNum = 2
                        },
                        new ReservationPlace {
                            PlaceId = placeId1, PlaceName = "第二多功能厅", UpdateBy = "System", PlaceIndex = 1, MaxReservationPeriodNum = 2
                        }
                    }
                                                         );

                    dbContext.ReservationPeriods.AddRange(new[]
                    {
                        new ReservationPeriod
                        {
                            PeriodId          = Guid.NewGuid(),
                            PeriodIndex       = 0,
                            PeriodTitle       = "8:00~10:00",
                            PeriodDescription = "8:00~10:00",
                            PlaceId           = placeId,
                            CreateBy          = "System",
                            CreateTime        = DateTime.UtcNow,
                            UpdateBy          = "System",
                            UpdateTime        = DateTime.UtcNow
                        },
                        new ReservationPeriod
                        {
                            PeriodId          = Guid.NewGuid(),
                            PeriodIndex       = 1,
                            PeriodTitle       = "10:00~12:00",
                            PeriodDescription = "10:00~12:00",
                            PlaceId           = placeId,
                            CreateBy          = "System",
                            CreateTime        = DateTime.UtcNow,
                            UpdateBy          = "System",
                            UpdateTime        = DateTime.UtcNow
                        },
                        new ReservationPeriod
                        {
                            PeriodId          = Guid.NewGuid(),
                            PeriodIndex       = 2,
                            PeriodTitle       = "13:00~16:00",
                            PeriodDescription = "13:00~16:00",
                            PlaceId           = placeId,
                            CreateBy          = "System",
                            CreateTime        = DateTime.UtcNow,
                            UpdateBy          = "System",
                            UpdateTime        = DateTime.UtcNow
                        },
                        new ReservationPeriod
                        {
                            PeriodId          = Guid.NewGuid(),
                            PeriodIndex       = 1,
                            PeriodTitle       = "08:00~18:00",
                            PeriodDescription = "08:00~18:00",
                            PlaceId           = placeId1,
                            CreateBy          = "System",
                            CreateTime        = DateTime.UtcNow.AddSeconds(3),
                            UpdateBy          = "System",
                            UpdateTime        = DateTime.UtcNow
                        },
                    });
                    var notice = new Notice()
                    {
                        NoticeId          = Guid.NewGuid(),
                        CheckStatus       = true,
                        NoticeTitle       = "测试公告",
                        NoticeCustomPath  = "test-notice",
                        NoticePath        = "test-notice.html",
                        NoticeContent     = "测试一下",
                        NoticePublishTime = DateTime.UtcNow,
                        NoticeDesc        = "测试一下",
                        NoticePublisher   = "System"
                    };
                    dbContext.Notices.Add(notice);

                    //sys settings init
                    settings = new List <SystemSettings>
                    {
                        new SystemSettings
                        {
                            SettingId    = Guid.NewGuid(),
                            SettingName  = "SystemTitle",
                            DisplayName  = "系统标题",
                            SettingValue = "活动室预约系统"
                        },
                        new SystemSettings
                        {
                            SettingId    = Guid.NewGuid(),
                            SettingName  = "SystemKeywords",
                            DisplayName  = "系统关键词",
                            SettingValue = "预约,活动室,预定,reservation"
                        },
                        new SystemSettings
                        {
                            SettingId    = Guid.NewGuid(),
                            SettingName  = "SystemDescription",
                            DisplayName  = "系统简介",
                            SettingValue = "活动室预约系统是一个基于ASP.NET MVC 开发的一个在线预约系统。"
                        },
                        new SystemSettings
                        {
                            SettingId    = Guid.NewGuid(),
                            SettingName  = "SystemContactPhone",
                            DisplayName  = "系统联系人联系电话",
                            SettingValue = "13245642365"
                        },
                        new SystemSettings
                        {
                            SettingId    = Guid.NewGuid(),
                            SettingName  = "SystemContactEmail",
                            DisplayName  = "系统联系邮箱",
                            SettingValue = "*****@*****.**"
                        }
                    };
                    dbContext.SystemSettings.AddRange(settings);

                    dbContext.SaveChanges();
                }
                else
                {
                    settings = dbContext.SystemSettings.AsNoTracking().ToArray();
                }
            }

            if (settings.Count > 0) // init settings cache
            {
                var applicationSettingService = serviceProvider.GetRequiredService <IApplicationSettingService>();
                applicationSettingService.AddSettings(settings.ToDictionary(s => s.SettingName, s => s.SettingValue));
            }
        }
Esempio n. 22
0
        protected override void Seed(XCodeContext context)
        {
            #region 导航

            #region 系统设置

            var system_nav = new Navigate()
            {
                Name           = "系统设置",
                Url            = "#",
                Type           = MenuType.Module,
                CreateDateTime = now,
                SoreOrder      = 1
            };

            var na = new Navigate
            {
                Name           = "导航管理",
                Url            = "/Adm/Navigate/Index",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 1
            };

            get_navigates(na, "Navigate");

            system_nav.add_children_nav(na);

            var menu_manage = new Navigate
            {
                Name           = "菜单管理",
                Url            = "/Adm/Menu/Index",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 1
            };

            get_navigates(menu_manage, "Menu");

            system_nav.add_children_nav(menu_manage);

            var role_manage = new Navigate
            {
                Name           = "角色管理",
                Url            = "/Adm/Role/Index",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 2
            };

            get_navigates(role_manage, "Role");

            system_nav.add_children_nav(role_manage);

            var user_manage = new Navigate
            {
                Name           = "用户管理",
                Url            = "/Adm/User/Index",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 3
            };

            get_navigates(user_manage, "User");

            system_nav.add_children_nav(user_manage);
            system_nav.add_children_nav(new Navigate
            {
                Name           = "角色授权",
                Url            = "/Adm/Role/AuthMenus",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 4
            });

            #endregion

            #region 博客设置

            var blog_nav = new Navigate()
            {
                Name           = "博客设置",
                Url            = "#",
                Type           = MenuType.Module,
                CreateDateTime = now,
                SoreOrder      = 2
            };

            var blog_manage = new Navigate
            {
                Name           = "分类管理",
                Url            = "/Adm/Category/Index",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 1
            };

            get_navigates(blog_manage, "Category");

            blog_nav.add_children_nav(blog_manage);

            #endregion

            #region 日志查看

            var log_nav = new Navigate()
            {
                Name           = "日志查看",
                Url            = "#",
                Type           = MenuType.Module,
                CreateDateTime = now,
                SoreOrder      = 3
            };

            log_nav.add_children_nav(new Navigate
            {
                Name           = "登录日志",
                Url            = "/Adm/Loginlog/Index",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 1
            });
            log_nav.add_children_nav(new Navigate
            {
                Name           = "访问日志",
                Url            = "/Adm/PageView/Index",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 2
            });

            #endregion


            #region 邮件系统

            var mail_nav = new Navigate
            {
                Name           = "邮件系统",
                Url            = "#",
                Type           = MenuType.Module,
                CreateDateTime = now,
                SoreOrder      = 4
            };

            mail_nav.add_children_nav(new Navigate
            {
                Name           = "邮件列表",
                Url            = "/Adm/Email/Index",
                Type           = MenuType.Menu,
                CreateDateTime = now,
                SoreOrder      = 1
            });

            #endregion

            #region 实例文档

            var demo_nav = new Navigate
            {
                Name           = "示例文档",
                Url            = "#",
                Type           = MenuType.Module,
                CreateDateTime = now,
                SoreOrder      = 4
            };

            demo_nav.add_children_nav(new Navigate {
                Name = "按钮", Url = "/Adm/Demo/Base", Type = MenuType.Menu, SoreOrder = 1, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "ICON图标", Url = "/Adm/Demo/Fontawosome", Type = MenuType.Menu, SoreOrder = 16, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "高级控件", Url = "/Adm/Demo/Advance", Type = MenuType.Menu, SoreOrder = 18, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "相册", Url = "/Adm/Demo/Gallery", Type = MenuType.Menu, SoreOrder = 19, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "个人主页", Url = "/Adm/Demo/Profile", Type = MenuType.Menu, SoreOrder = 20, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "个人主页", Url = "/Adm/Demo/Profile", Type = MenuType.Menu, SoreOrder = 20, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "邮件-收件箱", Url = "/Adm/Demo/InBox", Type = MenuType.Menu, SoreOrder = 21, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "邮件-查看邮件", Url = "/Adm/Demo/InBoxDetail", Type = MenuType.Menu, SoreOrder = 22, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "邮件-写邮件", Url = "/Adm/Demo/InBoxCompose", Type = MenuType.Menu, SoreOrder = 23, CreateDateTime = now
            });
            demo_nav.add_children_nav(new Navigate {
                Name = "表单", Url = "/Adm/Demo/Form", Type = MenuType.Menu, SoreOrder = 17, CreateDateTime = now
            });

            #endregion

            #region 高级实例

            var demoAdv_nav = new Navigate
            {
                Name           = "高级示例",
                Url            = "#",
                Type           = MenuType.Module,
                CreateDateTime = now,
                SoreOrder      = 4
            };


            demoAdv_nav.add_children_nav(new Navigate {
                Name = "编辑器", Url = "/Adm/Demo/Editor", Type = MenuType.Menu, SoreOrder = 24, CreateDateTime = now
            });
            demoAdv_nav.add_children_nav(new Navigate {
                Name = "表单验证", Url = "/Adm/Demo/FormValidate", Type = MenuType.Menu, SoreOrder = 25, CreateDateTime = now
            });
            demoAdv_nav.add_children_nav(new Navigate {
                Name = "图表", Url = "/Adm/Demo/Chart", Type = MenuType.Menu, SoreOrder = 26, CreateDateTime = now
            });
            demoAdv_nav.add_children_nav(new Navigate {
                Name = "图表-Morris", Url = "/Adm/Demo/ChartMorris", Type = MenuType.Menu, SoreOrder = 27, CreateDateTime = now
            });
            demoAdv_nav.add_children_nav(new Navigate {
                Name = "ChartJs", Url = "/Adm/Demo/ChartJs", Type = MenuType.Menu, SoreOrder = 28, CreateDateTime = now
            });
            demoAdv_nav.add_children_nav(new Navigate {
                Name = "表格", Url = "/Adm/Demo/DataTable", Type = MenuType.Menu, SoreOrder = 29, CreateDateTime = now
            });
            demoAdv_nav.add_children_nav(new Navigate {
                Name = "高级表格", Url = "/Adm/Demo/DataTableAdv", Type = MenuType.Menu, SoreOrder = 30, CreateDateTime = now
            });


            var navs = new List <Navigate>
            {
                system_nav,
                blog_nav,
                log_nav,
                mail_nav,
                demo_nav,
                demoAdv_nav
            };

            AddOrUpdate(context, m => m.Name, navs.ToArray());

            #endregion

            #endregion

            var navigites = new List <Navigate>();

            foreach (var navigate in navs)
            {
                navigites.Add(navigate);
                navigites.AddRange(navigate.Children);
                foreach (var navigate_child in navigate.Children)
                {
                    navigites.AddRange(navigate_child.Children);
                }
            }

            #region 角色

            if (context.Set <Role>() != null && context.Set <Role>().FirstOrDefault() != null)
            {
                return;
            }
            var superAdminRole = new Role {
                Name = "超级管理员", Description = "超级管理员", Navigates = navigites
            };
            var guestRole = new Role {
                Name = "guest", Description = "游客", Navigates = navigites
            };
            var roles = new List <Role>
            {
                superAdminRole,
                guestRole
            };

            AddOrUpdate(context, m => m.Name, roles.ToArray());

            #endregion

            #region 用户

            var user = new List <User>
            {
                new User
                {
                    LoginName      = "zero",
                    RealName       = "zero",
                    Password       = "******".ToMD5(),
                    Email          = "*****@*****.**",
                    Status         = 2,
                    CreateDateTime = now,
                    Gender         = GenderEnum.Male,
                    Birthday       = DateTime.Today,
                    Location       = "长沙",
                    QQ             = "278100426",
                    Telephone      = "11111111111",
                    Github         = "*****@*****.**",
                    Company        = "",
                    Link           = "",
                    Roles          = new List <Role> {
                        superAdminRole
                    }
                },
                new User
                {
                    LoginName      = "sang",
                    RealName       = "sang",
                    Password       = "******".ToMD5(),
                    Email          = "*****@*****.**",
                    Status         = 2,
                    Gender         = GenderEnum.Male,
                    Birthday       = DateTime.Today,
                    Location       = "长沙",
                    QQ             = "278100426",
                    Github         = "*****@*****.**",
                    Company        = "",
                    Link           = "",
                    CreateDateTime = now,
                    Roles          = new List <Role> {
                        superAdminRole
                    }
                },
                new User
                {
                    LoginName      = "guest",
                    RealName       = "游客",
                    Password       = "******".ToMD5(),
                    Email          = "*****@*****.**",
                    Status         = 2,
                    Gender         = GenderEnum.Male,
                    Birthday       = DateTime.Today,
                    Location       = "长沙",
                    QQ             = "278100426",
                    Github         = "*****@*****.**",
                    Company        = "",
                    Link           = "",
                    CreateDateTime = now,
                    Roles          = new List <Role> {
                        guestRole
                    }
                }
            };

            AddOrUpdate(context, m => m.LoginName, user.ToArray());

            #endregion

            #region 通知

            var notice = new Notice()
            {
                Content = "XCode 博客正式上线啦",
                Author  = user.First()
            };

            context.Set <Notice>().AddOrUpdate(notice);

            #endregion

            #region 友链

            var friendly_link = new FriendlyLink()
            {
                Name  = "XCode",
                Title = "XCode",
                Link  = "http://www.x-code.me"
            };

            context.Set <FriendlyLink>().AddOrUpdate(friendly_link);

            var friendly_link1 = new FriendlyLink()
            {
                Name  = "XCode Blog",
                Title = "XCode Blog",
                Link  = "http://blog.x-code.me"
            };

            context.Set <FriendlyLink>().AddOrUpdate(friendly_link1);

            #endregion

            var article_set = context.Set <ArticleSetting>();
            article_set.Add(new ArticleSetting()
            {
                ArticlePageSize       = 10,
                CommentPageSize       = 5,
                LatestCommentPageSize = 5,
                HotCommentPageSize    = 5,
                HotArticlePageSize    = 5,
                AllowComment          = true
            });

            var site_set = context.Set <SiteSetting>();
            site_set.Add(new SiteSetting()
            {
                Title           = "XCode Blog",
                Separator       = "|",
                MetaTitle       = "XCode Blog",
                MetaKeywords    = "XCode Blog",
                MetaDescription = "XCode Blog"
            });

            var ca1 = new Category()
            {
                Name            = "前端",
                MetaTitle       = "XCode Blog",
                MetaKeywords    = "XCode Blog",
                MetaDescription = "XCode Blog"
            };

            context.Set <Category>().AddOrUpdate(ca1);

            var ca2 = new Category()
            {
                Name            = "后端",
                MetaTitle       = "XCode Blog",
                MetaKeywords    = "XCode Blog",
                MetaDescription = "XCode Blog"
            };
            context.Set <Category>().AddOrUpdate(ca2);
            var ca3 = new Category()
            {
                Name            = "杂文",
                MetaTitle       = "XCode Blog",
                MetaKeywords    = "XCode Blog",
                MetaDescription = "XCode Blog"
            };
            context.Set <Category>().AddOrUpdate(ca3);
            var tag1 = new Tag()
            {
                Name = "HTML"
            };
            context.Set <Tag>().AddOrUpdate(tag1);
            var tag2 = new Tag()
            {
                Name = "C#"
            };
            context.Set <Tag>().AddOrUpdate(tag2);
            var tag3 = new Tag()
            {
                Name = "React"
            };
            context.Set <Tag>().AddOrUpdate(tag3);
            var tag4 = new Tag()
            {
                Name = "历史"
            };
            context.Set <Tag>().AddOrUpdate(tag4);

            var article1 = new Article()
            {
                Author = user.First(),
                Tags   = new List <Tag>()
                {
                    tag1, tag2
                },
                Category     = ca1,
                Title        = "HTML",
                Views        = 10,
                CommentCount = 10,
                Content      =
                    "HTML 是用来描述网页的一种语言。HTML 指的是超文本标记语言(Hyper Text Markup Language)HTML 不是一种编程语言,而是一种标记语言(markup language)标记语言是一套标记标签(markup tag)HTML 使用标记标签来描述网页"
            };

            context.Set <Article>().AddOrUpdate(article1);
            context.Set <Article>().AddOrUpdate(new Article()
            {
                Author = user.Last(),
                Tags   = new List <Tag>()
                {
                    tag2, tag4
                },
                Category = ca2,
                Title    = "C#",
                Views    = 10,
                Content  = "C#是微软公司发布的一种面向对象的、运行于.NET Framework之上的高级程序设计语言。并定于在微软职业开发者论坛(PDC)上登台亮相。C#是微软公司研究员Anders Hejlsberg的最新成果。C#看起来与Java有着惊人的相似;它包括了诸如单一继承、接口、与Java几乎同样的语法和编译成中间代码再运行的过程。但是C#与Java有着明显的不同,它借鉴了Delphi的一个特点,与COM(组件对象模型)是直接集成的,而且它是微软公司 .NET windows网络框架的主角。"
            });
            context.Set <Article>().AddOrUpdate(new Article()
            {
                Author = user.First(),
                Tags   = new List <Tag>()
                {
                    tag2, tag3
                },
                Category = ca1,
                Title    = "React",
                Views    = 10,
                Content  = "React Native使你能够在Javascript和React的基础上获得完全一致的开发体验,构建世界一流的原生APP。React Native着力于提高多平台开发的开发效率 —— 仅需学习一次,编写任何平台。(Learn once, write anywhere)Facebook已经在多项产品中使用了React Native,并且将持续地投入建设React Native。"
            });
            context.Set <Article>().AddOrUpdate(new Article()
            {
                Author = user.Last(),
                Tags   = new List <Tag>()
                {
                    tag3, tag4
                },
                Category = ca3,
                Title    = "历史",
                Views    = 10,
                Content  = "XCode是一个完全响应式,使用 MVC + EF + Bootstrap3.3.4 版本开发的后台管理系统模板,采用了左右两栏式等多种布局形式,使用了Html5+CSS3等现代技术,提供了诸多的强大的可以重新组合的UI组件,丰富的jQuery插件,可以用于所有的Web应用程序,如网站管理后台,会员中心,CMS,CRM,OA后台系统的模板,XCode使用到的技术完全开源,支持自定义扩展,你可以根据自己的需求定制一套属于你的后台管理模板。"
            });

            context.Set <Article>().AddOrUpdate(new Article()
            {
                Author = user.Last(),
                Tags   = new List <Tag>()
                {
                    tag3, tag4
                },
                Category     = ca3,
                CommentCount = 10,
                Title        = "AngularJS",
                Views        = 10,
                Content      = "AngularJS 通过新的属性和表达式扩展了 HTML。AngularJS 可以构建一个单一页面应用程序(SPAs:Single Page Applications)。AngularJS 学习起来非常简单。。"
            });
            context.Set <Article>().AddOrUpdate(new Article()
            {
                Author = user.Last(),
                Tags   = new List <Tag>()
                {
                    tag3, tag4
                },
                Category     = ca3,
                CommentCount = 10,
                Title        = "Java",
                Content      = "Java是一门面向对象编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。Java语言作为静态面向对象编程语言的代表,极好地实现了面向对象理论,允许程序员以优雅的思维方式进行复杂的编程[1]  。Java具有简单性、面向对象、分布式、健壮性、安全性、平台独立与可移植性、多线程、动态性等特点[2]  。Java可以编写桌面应用程序、Web应用程序、分布式系统和嵌入式系统应用程序等[3]  。"
            });
            context.Set <Article>().AddOrUpdate(new Article()
            {
                Author = user.Last(),
                Tags   = new List <Tag>()
                {
                    tag3, tag4
                },
                Category     = ca3,
                Title        = "Python",
                CommentCount = 10,
                Content      = "Python[1]  (英国发音:/ˈpaɪθən/ 美国发音:/ˈpaɪθɑːn/), 是一种面向对象的解释型计算机程序设计语言,由荷兰人Guido van Rossum于1989年发明,第一个公开发行版发行于1991年。Python是纯粹的自由软件, 源代码和解释器CPython遵循 GPL(GNU General Public License)协议[2]  。Python语法简洁清晰,特色之一是强制用空白符(white space)作为语句缩进。Python具有丰富和强大的库。它常被昵称为胶水语言,能够把用其他语言制作的各种模块(尤其是C / C++)很轻松地联结在一起。常见的一种应用情形是,使用Python快速生成程序的原型(有时甚至是程序的最终界面),然后对其中[3]  有特别要求的部分,用更合适的语言改写,比如3D游戏中的图形渲染模块,性能要求特别高,就可以用C / C++重写,而后封装为Python可以调用的扩展类库。需要注意的是在您使用扩展类库时可能需要考虑平台问题,某些可能不提供跨平台的实现。。"
            });
            context.Set <Article>().AddOrUpdate(new Article()
            {
                Author = user.Last(),
                Tags   = new List <Tag>()
                {
                    tag3, tag4
                },
                Category     = ca3,
                Title        = "日记",
                CommentCount = 10,
                Content      = "日记是指用来记录其内容的载体,作为一种文体,属于记叙文性质的应用文。日记的内容,来源于我们对生活的观察,因此,可以记事,可以写人,可以状物,可以写景,也可以记述活动,凡是自己在一天中做过的,或看到的,或听到的,或想到的,都可以是日记的内容。日记也指每天记事的本子或每天所遇到的和所做的事情的记录。同时也是诗歌名,为海子的代表作之一。。"
            });

            var user1 = new List <User>
            {
                new User
                {
                    LoginName      = "admin",
                    RealName       = "admin",
                    Password       = "******".ToMD5(),
                    Email          = "*****@*****.**",
                    Status         = 2,
                    CreateDateTime = now,
                    Gender         = GenderEnum.Male,
                    Birthday       = DateTime.Today,
                    Location       = "长沙",
                    QQ             = "278100426",
                    Telephone      = "11111111111",
                    Github         = "*****@*****.**",
                    Company        = "",
                    Link           = "",
                    Roles          = new List <Role> {
                        superAdminRole
                    },
                    BookMarks = new List <Article>()
                    {
                        article1
                    },
                    LikedNotes = new List <Article>()
                    {
                        article1
                    }
                }
            };

            AddOrUpdate(context, m => m.LoginName, user1.ToArray());
        }
Esempio n. 23
0
        /// <summary>
        /// 货位出库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnOUT_Click(object sender, RoutedEventArgs e)
        {
            // 无用资讯
            CBfrt_P.Text = "";
            TBcode.Text  = "";

            string frtD = CBfrt_D.Text.Trim();

            if (string.IsNullOrEmpty(frtD))
            {
                Notice.Show("卸货点不能为空!", "错误", 3, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(TBlocX.Text.Trim()) && string.IsNullOrEmpty(TBlocY.Text.Trim()) && string.IsNullOrEmpty(TBlocZ.Text.Trim()))
            {
                Notice.Show("货位不能为空!", "错误", 3, MessageBoxIcon.Error);
                return;
            }

            if (!WindowCommon.ConfirmAction("是否进行[手动出入库]任务!!"))
            {
                return;
            }

            // 货位
            string LOC = "C-" + TBlocX.Text.Trim().PadLeft(3, '0') + "-" + TBlocY.Text.Trim().PadLeft(2, '0') + "-" + TBlocZ.Text.Trim().PadLeft(2, '0');

            if ((bool)CheckWMS.IsChecked)
            {
                // 获取Task资讯
                String    sql = String.Format(@"select * from wcs_task_info where SITE <> '{1}' and TASK_TYPE = '{2}' and W_S_LOC = '{0}'", LOC, TaskSite.完成, TaskType.出库);
                DataTable dt  = DataControl._mMySql.SelectAll(sql);
                if (!DataControl._mStools.IsNoData(dt))
                {
                    Notice.Show("该货位已存在出库任务!", "错误", 3, MessageBoxIcon.Error);
                    return;
                }
                // 无Task资讯则新增
                // 呼叫WMS 请求入库资讯---区域
                WmsModel wms = new WmsModel()
                {
                    Task_UID  = "NW" + System.DateTime.Now.ToString("yyMMddHHmmss"),
                    Task_type = WmsStatus.StockOutTask,
                    Barcode   = "",
                    W_S_Loc   = LOC,
                    W_D_Loc   = frtD
                };
                // 写入数据库
                if (new ForWMSControl().WriteTaskToWCS(wms, out string result))
                {
                    Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success);
                }
                else
                {
                    MessageBox.Show("失败!" + result);
                    Notice.Show("失败!" + result, "错误", 3, MessageBoxIcon.Error);
                }
            }
            else
            {
                Notice.Show("无法请求WMS出库!", "错误", 3, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// 获取设备
        /// </summary>
        /// <param name="parameter"></param>
        public void SelectDoorDevice(object parameter)
        {
            if (string.IsNullOrEmpty(FilePath))
            {
                Notice.Show("请选择Smartdoor安装目录的para文件夹!.", "通知", 3, MessageBoxIcon.Warning);
                return;
            }

            UInt32 deviceID = curDoorServer.deviceID;

            if (deviceID == 0)
            {
                Notice.Show("请选择门禁服务!.", "通知", 3, MessageBoxIcon.Warning);
                return;
            }

            bool              result      = false;
            string            cmd         = "select * from control_devices where deviceID = " + deviceID + " or parentID = " + deviceID;
            List <DeviceInfo> jsipDevList = new List <DeviceInfo>();
            List <PartialViewDoorServer.ViewModels.K02.DeviceInfo> k02DevList = new List <PartialViewDoorServer.ViewModels.K02.DeviceInfo>();

            using (MySqlDataReader reader = MySqlHelper.ExecuteReader(EnvironmentInfo.ConnectionString, string.Format(cmd)))
            {
                while (reader.Read())
                {
                    ushort deviceType = Convert.ToUInt16(reader["DeviceType"].ToString());
                    if (deviceType == 32)
                    {
                        #region 门禁服务
                        // 门禁服务
                        PartialViewDoorServer.ViewModels.K02.DeviceInfo k02Dev = new PartialViewDoorServer.ViewModels.K02.DeviceInfo();
                        k02Dev.type             = deviceType;
                        k02Dev.id               = Convert.ToUInt32(reader["DeviceID"].ToString());
                        k02Dev.ip               = reader["IP"].ToString();
                        k02Dev.model            = "门禁服务客户端";
                        k02Dev.status           = 1;
                        k02Dev.statusUpdateTime = DateTime.Now;
                        k02Dev.DeviceAddTime    = DateTime.Now;

                        k02DevList.Add(k02Dev);
                        #endregion
                    }
                    else if (deviceType == 100 || deviceType == 116)
                    {
                        #region 领域III
                        // 领域III
                        PartialViewDoorServer.ViewModels.K02.DeviceInfo k02Dev = new PartialViewDoorServer.ViewModels.K02.DeviceInfo();
                        k02Dev.type             = deviceType;
                        k02Dev.id               = Convert.ToUInt32(reader["DeviceID"].ToString());
                        k02Dev.ip               = reader["IP"].ToString();
                        k02Dev.status           = 1;
                        k02Dev.productDate      = DateTime.Now.ToString();
                        k02Dev.statusUpdateTime = DateTime.Now;
                        k02Dev.DeviceAddTime    = DateTime.Now;

                        k02DevList.Add(k02Dev);
                        #endregion
                    }
                    else
                    {
                        #region JSIP设备
                        // JSIP设备
                        DeviceInfo dev = new DeviceInfo();
                        dev.SendHttpTime   = DateTime.Now;
                        dev.DeviceAddTime  = DateTime.Now;
                        dev.status         = 1;
                        dev.state          = 1;
                        dev.ID             = Convert.ToUInt32(reader["DeviceID"].ToString());
                        dev.ParentDeviceID = 0;
                        dev.Name           = reader["DeviceName"].ToString();
                        dev.Type           = deviceType.ToString();
                        dev.IP             = reader["IP"].ToString();
                        dev.Mac            = reader["Mac"].ToString();
                        dev.Mask           = reader["Net_Mask"].ToString();
                        dev.GateWay        = reader["Gateway_IP"].ToString();

                        dev.SN              = string.IsNullOrEmpty(reader["SN"].ToString()) ? 0 : Convert.ToUInt32(reader["SN"].ToString());
                        dev.Company         = "捷顺科技";
                        dev.Model           = reader["Model"].ToString();
                        dev.HardwareVersion = "V1.0.0";
                        dev.SoftwareVersion = "V1.0.0";
                        dev.Manufacturer    = "捷顺科技";
                        dev.ProductDate     = DateTime.Now.ToString();
                        dev.DeviceClass     = 0;
                        dev.CPUID           = reader["CpuID"].ToString();
                        dev.RegisterState   = 1;
                        dev.HasInit         = true;
                        dev.RegisterID      = 1;
                        dev.IsHttpSended    = false;
                        dev.AuthorizeFlag   = 1;

                        jsipDevList.Add(dev);
                        #endregion
                    }
                    result = true;
                }
            }

            string k02DevicePath  = FilePath + @"\DeviceInfos.xml";
            string jsipDevicePath = FilePath + @"\CriterionDeviceInfos.xml";

            // 备份
            string devicePathBak = FilePath + @"_" + DateTime.Now.ToString("yyyyMMddHHmmss");
            CopyDirectory(FilePath, devicePathBak);

            Notice.Show("para文件夹备份成功:" + devicePathBak, "通知", 3, MessageBoxIcon.Success);

            SerializationHelper.SerializeToXMLFile <List <PartialViewDoorServer.ViewModels.K02.DeviceInfo> >(k02DevicePath, k02DevList);
            SerializationHelper.SerializeToXMLFile <List <DeviceInfo> >(jsipDevicePath, jsipDevList);

            // 2.8.1以后,自动取这个备份文件夹的文件
            string strParaDataDirDest = string.Format(@"{0}\JieLinkDoor\para", System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
            File.Copy(k02DevicePath, strParaDataDirDest + @"\DeviceInfos.xml", true);
            File.Copy(jsipDevicePath, strParaDataDirDest + @"\CriterionDeviceInfos.xml", true);

            Notice.Show("获取设备成功....", "通知", 3, MessageBoxIcon.Success);

            Notice.Show("直接结束门禁服务进程,重启门禁服务!", "通知", 3, MessageBoxIcon.Success);
        }
Esempio n. 25
0
 public async Task <ActionResponse> DeletePost(Notice post)
 {
     return(new ActionResponse(await _noticeService.Delete(post.Id)));
 }
Esempio n. 26
0
        /// <summary>
        /// 启动辊台
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BTNrun_Click(object sender, EventArgs e)
        {
            try
            {
                if (CBdev.SelectedIndex == -1)
                {
                    Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info);
                    return;
                }
                string dev = CBdev.Text;
                RGV    rgv = new RGV(dev);
                if (rgv.ActionStatus() == RGV.Run)
                {
                    Notice.Show("指令发送失败:设备运行中!", "错误", 3, MessageBoxIcon.Error);
                    return;
                }
                if (rgv.DeviceStatus() == RGV.DeviceError)
                {
                    Notice.Show("指令发送失败:设备故障!", "错误", 3, MessageBoxIcon.Error);
                    return;
                }

                // 方式
                byte site1 = RGV.RollerRun1;
                if (CBsite1.SelectedValue.ToString() == "启动2#辊台")
                {
                    site1 = RGV.RollerRun2;
                }
                if (CBsite1.SelectedValue.ToString() == "启动全部辊台")
                {
                    site1 = RGV.RollerRunAll;
                }
                // 方向
                byte site2 = RGV.RunFront;
                if (CBsite2.SelectedValue.ToString() == "反向启动")
                {
                    site2 = RGV.RunObverse;
                }
                // 类型
                byte site3 = RGV.GoodsReceive;
                if (CBsite3.SelectedValue.ToString() == "送货")
                {
                    site3 = RGV.GoodsDeliver;
                }
                // 数量
                byte site4 = RGV.GoodsQty1;
                if (CBsite4.SelectedValue.ToString() == "货物数量2")
                {
                    site4 = RGV.GoodsQty2;
                }

                byte[] order = RGV._RollerControl(rgv.RGVNum(), site1, site2, site3, site4);
                if (!DataControl._mSocket.SendToClient(dev, order, out string result))
                {
                    Notice.Show("指令发送失败:" + result.ToString(), "错误", 3, MessageBoxIcon.Error);
                    return;
                }
                Notice.Show("启动辊台 指令发送成功!", "成功", 3, MessageBoxIcon.Success);
                DataControl._mSocket.SwithRefresh(dev, false);
            }
            catch (Exception ex)
            {
                Notice.Show("指令发送失败:" + ex.ToString(), "错误", 3, MessageBoxIcon.Error);
            }
        }
Esempio n. 27
0
        //
        // GET: /Notice/Details/5

        public ViewResult Details(int id)
        {
            Notice notice = db.Notices.Find(id);

            return(View(notice));
        }
Esempio n. 28
0
        private bool RaiseEventForNotice(Notice n)
        {
            NoticeIsReadyToBeExecutedEventArgs args = new NoticeIsReadyToBeExecutedEventArgs();
            args.Agents = n.GetTopDesireAgents();
            args.Notice = n;

            if (NoticeIsReadyToBeExecutedEvent != null)
                NoticeIsReadyToBeExecutedEvent(this, args);
            foreach (NabfAgent a in n.GetTopDesireAgents())
            {
                foreach (Notice no in _agentToNotice[a])
                {
                    if (no.ContentIsEqualTo(n))
                        continue;
                    UnApplyToNotice(no, a);
                }
            }
            return true;
        }
Esempio n. 29
0
        //
        // GET: /Notice/Delete/5

        public ActionResult Delete(int id)
        {
            Notice notice = db.Notices.Find(id);

            return(View(notice));
        }
 public bool Remove(Notice notice)
 {
     return(Notices.Remove(notice));
 }
Esempio n. 31
0
 private void LoadFromId(int noticeId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(NoticeInfo)))
     {
         NoticeInfo noticeInfo=Find(GetList(), noticeId);
         if(noticeInfo==null)
             throw new AppException("未能在缓存中找到相应的键值对象");
         Copy(noticeInfo, this);
     }
     else
     {	Notice notice=new Notice( noticeId);
         if(notice.IsNew)
         throw new AppException("尚未初始化");
        	LoadFromDAL(this, notice);
     }
 }
 public bool Contains(Notice notice)
 {
     return(Notices.Contains(notice));
 }
Esempio n. 33
0
 public void Post(Notice notice)
 {
     dataManager.AddNotice(notice);
 }
 public void IndexOf(Notice notice)
 {
     Notices.IndexOf(notice);
 }
 private static Notice DefaultAction(Notice n)
 {
     return(n);
 }
 public NotificationEvent(Notice notice = null, ListChangedEventArgs changeArguments = null)
 {
     this.Notice          = notice;
     this.ChangeArguments = changeArguments;
 }
Esempio n. 37
0
 public int GetNoticeCount(Notice ofType)
 {
     return _availableJobs.Get(NoticeToJobType(ofType)).Count;
 }
Esempio n. 38
0
 [ValidateInput(false)]          //这儿相当于给字段加[AllowHtml],允许传入html
 public ActionResult NoticeAdmin(Notice notice)
 {
     return(View(notice));
 }
Esempio n. 39
0
 public bool RemoveJob(Notice n)
 {
     if (_jobs.ContainsKey(n.HighestAverageDesirabilityForNotice))
     {
         List<Notice> l = _jobs[n.HighestAverageDesirabilityForNotice].ToList();
         l.Remove(n);
         bool b = _jobs.Remove(n.HighestAverageDesirabilityForNotice);
         if (l.Count == 0)
             return b;
         if (b)
         {
             _jobs.Add(n.HighestAverageDesirabilityForNotice, l.ToArray());
             return true;
         }
         else
             return false;
     }
     else
         return false;
 }
Esempio n. 40
0
        public void ThreadMethod()
        {
            try
            {
                this.mainForm.SetUpdateLabel("버전 정보 확인중");
                int ret = VersionCheck();
                //ret = 1;
                if (ret == 0)
                {
                    this.mainForm.SetUpdateLabel("최신 버전입니다");
                }
                else if (ret == -1)
                {
                    this.mainForm.SetUpdateLabel("버전 정보를 확인하지 못하였습니다.");
                }
                else if (ret == 1)
                {
                    // 2013-05-14
                    // 개심각한 버그
                    //if (Method != 0)
                    if (Method != 2) // 업데이트후 시작해서 버전체크만
                    {
                        if (Method == 0)
                        {
                            // 정보 탭으로 가도록 한다.
                            this.mainForm.InsertUpdateProgress();
                            this.mainForm.ShowInformationTab();
                        }
                        this.mainForm.SetUpdateLabel("최신 버전 다운로드중");
                        Thread.Sleep(1000);
                        int downloadRet = Download();
                        if (downloadRet == 0)
                        {
                            //성공
                            int time = 3;
                            this.mainForm.DeleteUpdateProgress();
                            do
                            {
                                this.mainForm.SetUpdateLabel("다운로드 완료. " + time + "초뒤 재시작됩니다.");
                                Thread.Sleep(1000);
                            } while (time-- > 0);


                            Restart();
                        }
                        else if (downloadRet == -1)
                        {
                            this.mainForm.SetUpdateLabel("업데이트 오류");
                            this.mainForm.DeleteUpdateProgress();
                        }
                    }
                    else
                    {
                        // 오면 안된다.
                        this.mainForm.SetUpdateLabel("업데이트 후 자동시작으로 실행. 또 업데이트 하라고 함. 업데이트 오류");
                        this.mainForm.DeleteUpdateProgress();
                    }
                }
                //if (Method != 1 && Notice != null)
                // 2013-05-24
                if (Notice != null && Notice.Trim() != "")
                {
                    this.mainForm.ShowNotice(Notice);
                }
                Thread.Sleep(1000);
            }
            catch { }
            finally
            {
                this.mainForm.DeleteUpdateProgress();
            }
        }
Esempio n. 41
0
 public void UnApplyToNotice(Notice notice, NabfAgent a)
 {
     foreach (Notice n in _availableJobs.Get(NoticeToJobType(notice)))
     {
         if (n.ContentIsEqualTo(notice))
         {
             n.UnApply(a, this);
             _agentToNotice.Remove(a, n);
             break;
         }
     }
 }
 public void Update(Notice table)
 {
     _inotice.Update(table);
 }
Esempio n. 43
0
 private bool AvailableJobsContainsContentEqual(Notice no)
 {
     foreach (Notice n in _availableJobs.Get(NoticeToJobType(no)))
     {
         if (n.ContentIsEqualTo(no))
             return true;
     }
     return false;
 }
 public void Delete(Notice table)
 {
     _inotice.Delete(table);
 }
Esempio n. 45
0
        /// <summary>
        /// 分配货位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnLOC_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string frtP = CBfrt_P.Text.Trim();
                string code = TBcode.Text.Trim();
                string frtD = CBfrt_D.Text.Trim();

                if (string.IsNullOrEmpty(frtP) || string.IsNullOrEmpty(code))
                {
                    Notice.Show("包装线辊台设备号 / 货物条码 不能为空!", "错误", 3, MessageBoxIcon.Error);
                    return;
                }

                if (!WindowCommon.ConfirmAction("是否进行[获取入库坐标任务]!!"))
                {
                    return;
                }

                if ((bool)CheckWMS.IsChecked)
                {
                    if (string.IsNullOrEmpty(frtD))
                    {
                        Notice.Show("卸货点不能为空!", "错误", 3, MessageBoxIcon.Error);
                        return;
                    }
                    if (string.IsNullOrEmpty(TBlocX.Text.Trim()) && string.IsNullOrEmpty(TBlocY.Text.Trim()) && string.IsNullOrEmpty(TBlocZ.Text.Trim()))
                    {
                        Notice.Show("货位不能为空!", "错误", 3, MessageBoxIcon.Error);
                        return;
                    }
                    // 货位
                    string LOC = "C" + TBlocX.Text.Trim().PadLeft(3, '0') + "-" + TBlocY.Text.Trim().PadLeft(2, '0') + "-" + TBlocZ.Text.Trim().PadLeft(2, '0');
                    // 获取Task资讯
                    String    sql = String.Format(@"select TASK_UID from wcs_task_info where TASK_TYPE = '{1}' and BARCODE = '{0}'", code, TaskType.入库);
                    DataTable dt  = DataControl._mMySql.SelectAll(sql);
                    if (DataControl._mStools.IsNoData(dt))
                    {
                        Notice.Show("不存在任务Task资讯!", "错误", 3, MessageBoxIcon.Error);
                        return;
                    }

                    // 获取对应任务ID
                    string taskuid = dt.Rows[0]["TASK_UID"].ToString();
                    // 更新任务资讯
                    sql = String.Format(@"update WCS_TASK_INFO set UPDATE_TIME = NOW(), TASK_TYPE = '{0}', W_S_LOC = '{1}', W_D_LOC = '{2}' where TASK_UID = '{3}'",
                                        TaskType.入库, DataControl._mTaskTools.GetArea(frtD), LOC, taskuid);
                    DataControl._mMySql.ExcuteSql(sql);

                    // 对应 WCS 清单
                    DataControl._mTaskTools.CreateCommandIn(taskuid, frtD);
                    Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success);
                }
                else
                {
                    if (new ForWMSControl().ScanCodeTask_Loc(frtP, code))
                    {
                        Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success);
                    }
                    else
                    {
                        Notice.Show("失败!", "错误", 3, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error);
            }
        }
Esempio n. 46
0
        protected void btn_Sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    Score      Score      = db.Score.FirstOrDefault(t => t.ID == ScoreID && t.IsDel != true);
                    AuditState auditstate = (AuditState)Convert.ToInt32(this.ddl_Audit.SelectedValue);
                    Notice     Notice     = new Notice();
                    if (Score != null)
                    {
                        if (Score.AuditState == AuditState.待初审 && Score.FirstAuditUserID == UserID && db.ScoreAuditUser.FirstOrDefault(t => t.UserID == UserID && t.ScoreAuditUserType == ScoreAuditUserType.初审人) != null)
                        {
                            if (auditstate == AuditState.通过)
                            {
                                Score.AuditState = AuditState.待终审;

                                Notice.Contenet = "当前有一条奖扣记录需要审核|主题:" + Score.Title + "(" + db.ScoreEvent.FirstOrDefault(t => t.ID == Score.ScoreEventID).BScore
                                                  + "分)"
                                                  + "|记录人:" + db.User.FirstOrDefault(t => t.ID == Score.CreateUserID).RealName
                                                  + "|参与人:" + new ScoreUserDAO().GetScoreUser(Score.ID)
                                                  + "|初审人:" + db.User.FirstOrDefault(t => t.ID == Score.FirstAuditUserID.Value).RealName
                                                  + "|终审人:" + db.User.FirstOrDefault(t => t.ID == Score.LastAuditUserID.Value).RealName
                                                  + "|状态:待终审";
                                Notice.IsSend       = false;
                                Notice.NoticeType   = NoticeType.积分制消息;
                                Notice.ReciveUserID = Score.LastAuditUserID.Value;
                                Notice.SendUserID   = UserID;
                                Notice.SendDate     = DateTime.Now;
                                Notice.SourceID     = Score.ID;
                                Notice.URL          = ParaUtils.SiteURL + "/jfz/app/RegistrationDetail.html?flag=1&id=" + Score.ID;
                                db.Notice.Add(Notice);

                                //给每个人发一个
                                foreach (ScoreUser ScoreUser in db.ScoreUser.Where(t => t.IsDel != true && t.ScoreID == Score.ID).ToList())
                                {
                                    Notice          = new Notice();
                                    Notice.Contenet = "您有一条奖扣记录正在审核中|主题:" + Score.Title + "(" + db.ScoreEvent.FirstOrDefault(t => t.ID == Score.ScoreEventID).BScore
                                                      + "分)"
                                                      + "|记录人:" + db.User.FirstOrDefault(t => t.ID == Score.CreateUserID).RealName
                                                      + "|参与人:" + new ScoreUserDAO().GetScoreUser(Score.ID)
                                                      + "|初审人:" + db.User.FirstOrDefault(t => t.ID == Score.FirstAuditUserID.Value).RealName
                                                      + "|终审人:" + db.User.FirstOrDefault(t => t.ID == Score.LastAuditUserID.Value).RealName
                                                      + "|状态:待终审";
                                    Notice.IsSend       = false;
                                    Notice.NoticeType   = NoticeType.积分制消息;
                                    Notice.ReciveUserID = ScoreUser.UserID;
                                    Notice.SendUserID   = UserID;
                                    Notice.SourceID     = Score.ID;
                                    Notice.SendDate     = DateTime.Now;
                                    Notice.URL          = ParaUtils.SiteURL + "/jfz/app/RegistrationDetail.html?flag=2&id=" + Score.ID;
                                    db.Notice.Add(Notice);
                                }
                            }
                            else
                            {
                                Score.AuditState = AuditState.驳回;

                                foreach (ScoreUser ScoreUser in db.ScoreUser.Where(t => t.IsDel != true && t.ScoreID == Score.ID).ToList())
                                {
                                    Notice          = new Notice();
                                    Notice.Contenet = "您有一条奖扣记录被驳回|主题:" + Score.Title + "(" + db.ScoreEvent.FirstOrDefault(t => t.ID == Score.ScoreEventID).BScore
                                                      + "分)"
                                                      + "|记录人:" + db.User.FirstOrDefault(t => t.ID == Score.CreateUserID).RealName
                                                      + "|参与人:" + new ScoreUserDAO().GetScoreUser(Score.ID)
                                                      + "|初审人:" + db.User.FirstOrDefault(t => t.ID == Score.FirstAuditUserID.Value).RealName
                                                      + "|终审人:" + db.User.FirstOrDefault(t => t.ID == Score.LastAuditUserID.Value).RealName
                                                      + "|状态:驳回";
                                    Notice.IsSend       = false;
                                    Notice.NoticeType   = NoticeType.积分制消息;
                                    Notice.ReciveUserID = ScoreUser.UserID;
                                    Notice.SendUserID   = UserID;
                                    Notice.SendDate     = DateTime.Now;
                                    Notice.SourceID     = Score.ID;
                                    Notice.URL          = ParaUtils.SiteURL + "/jfz/app/RegistrationDetail.html?flag=2&id=" + Score.ID;
                                    db.Notice.Add(Notice);
                                }
                            }
                            Score.FirstAuditDate = DateTime.Now;
                            Score.FirstAuditMark = this.txt_EventMark.Text.Trim();
                        }
                        if (Score.AuditState == AuditState.待终审 && Score.LastAuditUserID == UserID && db.ScoreAuditUser.FirstOrDefault(t => t.UserID == UserID && t.ScoreAuditUserType == ScoreAuditUserType.终审人) != null)
                        {
                            if (auditstate == AuditState.通过)
                            {
                                Score.AuditState = AuditState.通过;

                                foreach (ScoreUser ScoreUser in db.ScoreUser.Where(t => t.IsDel != true && t.ScoreID == Score.ID).ToList())
                                {
                                    Notice          = new Notice();
                                    Notice.Contenet = "您有一条奖扣记录已审核通过|主题:" + Score.Title + "(" + db.ScoreEvent.FirstOrDefault(t => t.ID == Score.ScoreEventID).BScore
                                                      + "分)"
                                                      + "|记录人:" + db.User.FirstOrDefault(t => t.ID == Score.CreateUserID).RealName
                                                      + "|参与人:" + new ScoreUserDAO().GetScoreUser(Score.ID)
                                                      + "|初审人:" + db.User.FirstOrDefault(t => t.ID == Score.FirstAuditUserID.Value).RealName
                                                      + "|终审人:" + db.User.FirstOrDefault(t => t.ID == Score.LastAuditUserID.Value).RealName
                                                      + "|状态:通过";
                                    Notice.IsSend       = false;
                                    Notice.NoticeType   = NoticeType.积分制消息;
                                    Notice.ReciveUserID = ScoreUser.UserID;
                                    Notice.SendUserID   = UserID;
                                    Notice.SourceID     = Score.ID;
                                    Notice.SendDate     = DateTime.Now;
                                    Notice.URL          = ParaUtils.SiteURL + "/jfz/app/RegistrationDetail.html?flag=2&id=" + Score.ID;
                                    db.Notice.Add(Notice);
                                }
                            }
                            else
                            {
                                Score.AuditState = AuditState.驳回;

                                foreach (ScoreUser ScoreUser in db.ScoreUser.Where(t => t.IsDel != true && t.ScoreID == Score.ID).ToList())
                                {
                                    Notice          = new Notice();
                                    Notice.Contenet = "您有一条奖扣记录被驳回|主题:" + Score.Title + "(" + db.ScoreEvent.FirstOrDefault(t => t.ID == Score.ScoreEventID).BScore
                                                      + "分)"
                                                      + "|记录人:" + db.User.FirstOrDefault(t => t.ID == Score.CreateUserID).RealName
                                                      + "|参与人:" + new ScoreUserDAO().GetScoreUser(Score.ID)
                                                      + "|初审人:" + db.User.FirstOrDefault(t => t.ID == Score.FirstAuditUserID.Value).RealName
                                                      + "|终审人:" + db.User.FirstOrDefault(t => t.ID == Score.LastAuditUserID.Value).RealName
                                                      + "|状态:驳回";
                                    Notice.IsSend       = false;
                                    Notice.NoticeType   = NoticeType.积分制消息;
                                    Notice.ReciveUserID = ScoreUser.UserID;
                                    Notice.SendUserID   = UserID;
                                    Notice.SendDate     = DateTime.Now;
                                    Notice.SourceID     = Score.ID;
                                    Notice.URL          = ParaUtils.SiteURL + "/jfz/app/RegistrationDetail.html?flag=2&id=" + Score.ID;
                                    db.Notice.Add(Notice);
                                }
                            }

                            Score.LastAuditDate = DateTime.Now;
                            Score.LastAuditMark = this.txt_EventMark.Text.Trim();
                        }

                        db.SaveChanges();
                        ShowMessage();
                        new SysLogDAO().AddLog(LogType.操作日志_修改, "审核奖扣积分信息", UserID);
                    }
                    else
                    {
                        ShowMessage("找不到积分奖扣信息");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                return;
            }
        }
 public void Save(Notice table)
 {
     _inotice.Save(table);
 }
Esempio n. 48
0
 private void ShowNotice(Notice notice)
 {
     if (notice == Notice.Empty)
     {
         if (_emptyNotice == null)
         {
             _emptyNotice = CreateNoticeBlock(notice.GetText());
         }
         LayoutRoot.Children.Add(_emptyNotice);
     }
     else if (notice == Notice.Loading)
     {
         if (_loadingNotice == null)
         {
             _loadingNotice = CreateNoticeBlock(notice.GetText());
         }
         LayoutRoot.Children.Add(_loadingNotice);
     }
     else
         throw new Exception("Unknown enum type");
 }
Esempio n. 49
0
 /// <summary>
 /// 保存
 /// </summary>
 public override void Save()
 {
     if(!m_Loaded)//新增
     {
         Notice notice=new Notice();
         SaveToDb(this, notice,true);
     }
     else//修改
     {
         Notice notice=new Notice(noticeId);
         if(notice.IsNew)
             throw new AppException("该数据已经不存在了");
         SaveToDb(this, notice,false);
     }
 }
        public async Task NoticeRepositoryAsyncAllMethodTest()
        {
            #region [0] DbContextOptions<T> Object Creation and ILoggerFactory Object Creation
            //[0] DbContextOptions<T> Object Creation and ILoggerFactory Object Creation
            var options = new DbContextOptionsBuilder <NoticeAppDbContext>()
                          .UseInMemoryDatabase(databaseName: $"NoticeApp{Guid.NewGuid()}").Options;
            //.UseSqlServer("server=(localdb)\\mssqllocaldb;database=NoticeApp;integrated security=true;").Options;

            var serviceProvider = new ServiceCollection().AddLogging().BuildServiceProvider();
            var factory         = serviceProvider.GetService <ILoggerFactory>();
            #endregion

            #region [1] AddAsync() Method Test
            //[1] AddAsync() Method Test
            using (var context = new NoticeAppDbContext(options))
            {
                context.Database.EnsureCreated(); // 데이터베이스가 만들어져 있는지 확인

                //[A] Arrange
                var repository = new NoticeRepositoryAsync(context, factory);
                var model      = new Notice {
                    Name = "[1] 관리자", Title = "공지사항입니다.", Content = "내용입니다."
                };

                //[B] Act
                await repository.AddAsync(model); // Id: 1
            }
            using (var context = new NoticeAppDbContext(options))
            {
                //[C] Assert
                Assert.AreEqual(1, await context.Notices.CountAsync());
                var model = await context.Notices.Where(n => n.Id == 1).SingleOrDefaultAsync();

                Assert.AreEqual("[1] 관리자", model.Name);
            }
            #endregion

            #region [2] GetAllAsync() Method Test
            //[2] GetAllAsync() Method Test
            using (var context = new NoticeAppDbContext(options))
            {
                // 트랜잭션 관련 코드는 InMemoryDatabase 공급자에서는 지원 X
                //using (var transaction = context.Database.BeginTransaction()) { transaction.Commit(); }
                //[A] Arrange
                var repository = new NoticeRepositoryAsync(context, factory);
                var model      = new Notice {
                    Name = "[2] 홍길동", Title = "공지사항입니다.", Content = "내용입니다."
                };

                //[B] Act
                await repository.AddAsync(model);                                               // Id: 2

                await repository.AddAsync(new Notice { Name = "[3] 백두산", Title = "공지사항입니다." }); // Id: 3
            }
            using (var context = new NoticeAppDbContext(options))
            {
                //[C] Assert
                var repository = new NoticeRepositoryAsync(context, factory);
                var models     = await repository.GetAllAsync();

                Assert.AreEqual(3, models.Count()); // TotalRecords: 3
            }
            #endregion

            #region [3] GetByIdAsync() Method Test
            //[3] GetByIdAsync() Method Test
            using (var context = new NoticeAppDbContext(options))
            {
                // Empty
            }
            using (var context = new NoticeAppDbContext(options))
            {
                var repository = new NoticeRepositoryAsync(context, factory);
                var model      = await repository.GetByIdAsync(2);

                Assert.IsTrue(model.Name.Contains("길동"));
                Assert.AreEqual("[2] 홍길동", model.Name);
            }
            #endregion

            #region [4] EditAsync() Method Test
            //[4] EditAsync() Method Test
            using (var context = new NoticeAppDbContext(options))
            {
                // Empty
            }
            using (var context = new NoticeAppDbContext(options))
            {
                var repository = new NoticeRepositoryAsync(context, factory);
                var model      = await repository.GetByIdAsync(2);

                model.Name = "[2] 임꺽정"; // Modified
                await repository.EditAsync(model);

                var updateModel = await repository.GetByIdAsync(2);

                Assert.IsTrue(updateModel.Name.Contains("꺽정"));
                Assert.AreEqual("[2] 임꺽정", updateModel.Name);
                Assert.AreEqual("[2] 임꺽정",
                                (await context.Notices.Where(m => m.Id == 2).SingleOrDefaultAsync())?.Name);
            }
            #endregion

            #region [5] DeleteAsync() Method Test
            //[5] DeleteAsync() Method Test
            using (var context = new NoticeAppDbContext(options))
            {
                // Empty
            }
            using (var context = new NoticeAppDbContext(options))
            {
                var repository = new NoticeRepositoryAsync(context, factory);
                await repository.DeleteAsync(2);

                Assert.AreEqual(2, (await context.Notices.CountAsync()));
                Assert.IsNull(await repository.GetByIdAsync(2));
            }
            #endregion

            #region [6] GetAllAsync(PagingAsync)() Method Test
            //[6] GetAllAsync(PagingAsync)() Method Test
            using (var context = new NoticeAppDbContext(options))
            {
                // Empty
            }
            using (var context = new NoticeAppDbContext(options))
            {
                int pageIndex = 0;
                int pageSize  = 1;

                var repository = new NoticeRepositoryAsync(context, factory);
                var noticesSet = await repository.GetAllAsync(pageIndex, pageSize);

                var firstName   = noticesSet.Records.FirstOrDefault()?.Name;
                var recordCount = noticesSet.TotalRecords;

                Assert.AreEqual("[3] 백두산", firstName);
                Assert.AreEqual(2, recordCount);
            }
            #endregion

            #region [7] GetStatus() Method Test
            //[7] GetStatus() Method Test
            using (var context = new NoticeAppDbContext(options))
            {
                int parentId = 1;

                var no1 = await context.Notices.Where(m => m.Id == 1).SingleOrDefaultAsync();

                no1.ParentId = parentId;
                no1.IsPinned = true; // Pinned

                context.Entry(no1).State = EntityState.Modified;
                context.SaveChanges();

                var repository = new NoticeRepositoryAsync(context, factory);
                var r          = await repository.GetStatus(parentId);

                Assert.AreEqual(1, r.Item1); // Pinned Count == 1
            }
            #endregion
        }
Esempio n. 51
0
 //数据持久化
 internal static void SaveToDb(NoticeInfo pNoticeInfo, Notice  pNotice,bool pIsNew)
 {
     pNotice.NoticeId = pNoticeInfo.noticeId;
      		pNotice.NoticeContent = pNoticeInfo.noticeContent;
      		pNotice.SignName = pNoticeInfo.signName;
      		pNotice.NoticeTime = pNoticeInfo.noticeTime;
      		pNotice.NoticeTitle = pNoticeInfo.noticeTitle;
      		pNotice.EmployeeName = pNoticeInfo.employeeName;
     pNotice.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pNotice.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(NoticeInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pNoticeInfo.noticeId = pNotice.NoticeId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(NoticeInfo)))
     {
         ResetCache();
     }
 }
Esempio n. 52
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Finish_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string sql;
                switch (_TYPE)
                {
                case 0:
                    if (string.IsNullOrEmpty(CBfrt.Text.Trim()) || string.IsNullOrEmpty(CBtype.Text))
                    {
                        Notice.Show("固定辊台与作业类型不能为空!", "错误", 3, MessageBoxIcon.Error);
                        return;
                    }
                    // 生成单号
                    TBwcsno.Text = (CBtype.Text.Substring(0, 1) == TaskType.入库 ? "I" : "O") + System.DateTime.Now.ToString("yyMMddHHmmss");

                    // 单托
                    TBtaskid1.Text = "T1" + System.DateTime.Now.ToString("yyMMddHHmmss");
                    if (string.IsNullOrEmpty(TBlocfrom1.Text.Trim()) || string.IsNullOrEmpty(TBlocto1.Text.Trim()) || string.IsNullOrEmpty(TBcode1.Text.Trim()))
                    {
                        Notice.Show("请将资讯填写完整!", "错误", 3, MessageBoxIcon.Error);
                        return;
                    }
                    sql = string.Format(@"insert into wcs_task_info(TASK_UID, TASK_TYPE, BARCODE, W_S_LOC, W_D_LOC) values('{0}','{1}','{2}','{3}','{4}');",
                                        TBtaskid1.Text, CBtype.Text.Substring(0, 1), TBcode1.Text.Trim(), TBlocfrom1.Text.Trim(), TBlocto1.Text.Trim());

                    // 双托
                    if (_NUM == 2)
                    {
                        TBtaskid2.Text = "T2" + System.DateTime.Now.ToString("yyMMddHHmmss");

                        if (string.IsNullOrEmpty(TBlocfrom2.Text.Trim()) || string.IsNullOrEmpty(TBlocto2.Text.Trim()) || string.IsNullOrEmpty(TBcode2.Text.Trim()))
                        {
                            Notice.Show("请将资讯填写完整!", "错误", 3, MessageBoxIcon.Error);
                            return;
                        }

                        sql += string.Format(@"insert into wcs_task_info(TASK_UID, TASK_TYPE, BARCODE, W_S_LOC, W_D_LOC) values('{0}','{1}','{2}','{3}','{4}');",
                                             TBtaskid2.Text, CBtype.Text.Substring(0, 1), TBcode2.Text.Trim(), TBlocfrom2.Text.Trim(), TBlocto2.Text.Trim());
                    }

                    sql += string.Format(@"insert into wcs_command_master(WCS_NO,FRT,TASK_UID_1,TASK_UID_2) values('{0}','{1}','{2}','{3}')",
                                         TBwcsno.Text, CBfrt.Text.Trim(), TBtaskid1.Text, TBtaskid2.Text);

                    DataControl._mMySql.ExcuteSql(sql);

                    // 锁定设备
                    DataControl._mTaskTools.DeviceLock(TBwcsno.Text, CBfrt.Text.Trim());

                    MessageBox.Show(string.Format(@"生成清单成功:清单号【{0}】;1#任务【{1}】;2#任务【{2}】", TBwcsno.Text, TBtaskid1.Text, TBtaskid2.Text));

                    break;

                case 1:
                    if (string.IsNullOrEmpty(CBfrt.Text.Trim()) || string.IsNullOrEmpty(TBlocfrom1.Text.Trim()) || string.IsNullOrEmpty(CBsite1.Text.Trim()) ||
                        string.IsNullOrEmpty(TBlocto1.Text.Trim()) || string.IsNullOrEmpty(TBcode1.Text.Trim()) || string.IsNullOrEmpty(CBstep.Text.Trim()))
                    {
                        Notice.Show("请将资讯填写完整!", "错误", 3, MessageBoxIcon.Error);
                        return;
                    }

                    sql = string.Format(@"update wcs_task_info set W_S_LOC = '{1}', W_D_LOC = '{2}', SITE = '{3}' where TASK_UID = '{0}';",
                                        TBtaskid1.Text, TBlocfrom1.Text.Trim(), TBlocto1.Text.Trim(), CBsite1.Text.Substring(0, 1));

                    if (!string.IsNullOrEmpty(TBtaskid2.Text))
                    {
                        if (string.IsNullOrEmpty(TBlocfrom2.Text.Trim()) || string.IsNullOrEmpty(TBlocto2.Text.Trim()) ||
                            string.IsNullOrEmpty(TBcode2.Text.Trim()) || string.IsNullOrEmpty(CBsite1.Text.Substring(0, 1)))
                        {
                            Notice.Show("请将资讯填写完整!", "错误", 3, MessageBoxIcon.Error);
                            return;
                        }
                        sql += string.Format(@"update wcs_task_info set UPDATE_TIME = NOW(), W_S_LOC = '{1}', W_D_LOC = '{2}', SITE = '{3}' where TASK_UID = '{0}';",
                                             TBtaskid2.Text, TBlocfrom2.Text.Trim(), TBlocto2.Text.Trim(), CBsite2.Text.Substring(0, 1));
                    }

                    sql += string.Format(@"update wcs_command_master set UPDATE_TIME = NOW(), FRT = '{1}', STEP = '{2}' where WCS_NO = '{0}'",
                                         TBwcsno.Text, CBfrt.Text.Trim(), CBstep.Text.Substring(0, 1));

                    DataControl._mMySql.ExcuteSql(sql);

                    // 解锁设备数据状态
                    DataControl._mTaskTools.DeviceUnLock(_FRT);
                    // 锁定设备
                    DataControl._mTaskTools.DeviceLock(TBwcsno.Text, CBfrt.Text.Trim());

                    break;

                default:
                    Notice.Show("TYPE 不可识别!", "错误", 3, MessageBoxIcon.Error);
                    this.Close();
                    break;
                }
                this.Close();
            }
            catch (Exception ex)
            {
                Notice.Show(ex.ToString(), "错误", 3, MessageBoxIcon.Error);
            }
        }
Esempio n. 53
0
 public void Handle(Notice message)
 {
     _notifications.Add(message);
 }
Esempio n. 54
0
        /// <summary>
        /// 分配卸货
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnFRT_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string frtP = CBfrt_P.Text.Trim();
                string code = TBcode.Text.Trim();
                string frtD = CBfrt_D.Text.Trim();

                if (string.IsNullOrEmpty(frtP) || string.IsNullOrEmpty(code))
                {
                    Notice.Show("包装线辊台设备号 / 货物条码 不能为空!", "错误", 3, MessageBoxIcon.Error);
                    return;
                }

                if (!WindowCommon.ConfirmAction("是否进行[获取入库区域任务]!!"))
                {
                    return;
                }

                if ((bool)CheckWMS.IsChecked)
                {
                    if (string.IsNullOrEmpty(frtD))
                    {
                        Notice.Show("卸货点不能为空!", "错误", 3, MessageBoxIcon.Error);
                        return;
                    }
                    // 获取Task资讯
                    String    sql = String.Format(@"select * from wcs_task_info where SITE <> '{1}' and BARCODE = '{0}'", code, TaskSite.完成);
                    DataTable dt  = DataControl._mMySql.SelectAll(sql);
                    if (!DataControl._mStools.IsNoData(dt))
                    {
                        Notice.Show("货物条码已存在任务!", "提示", 3, MessageBoxIcon.Info);
                        return;
                    }
                    // 无Task资讯则新增
                    // 呼叫WMS 请求入库资讯---区域
                    WmsModel wms = new WmsModel()
                    {
                        Task_UID  = "NW" + System.DateTime.Now.ToString("yyMMddHHmmss"),
                        Task_type = WmsStatus.StockInTask,
                        Barcode   = code,
                        W_S_Loc   = DataControl._mTaskTools.GetArea(frtP),
                        W_D_Loc   = DataControl._mTaskTools.GetArea(frtD)
                    };
                    // 写入数据库
                    if (new ForWMSControl().WriteTaskToWCS(wms, out string result))
                    {
                        Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success);
                    }
                    else
                    {
                        Notice.Show("失败:" + result, "错误", 3, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    if (new ForWMSControl().ScanCodeTask_P(frtP, code))
                    {
                        Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success);
                    }
                    else
                    {
                        Notice.Show("失败!", "错误", 3, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error);
            }
        }
    public NoticeWindow win;    //活动窗口

    public void initContent(Notice notice, NoticeWindow win, ArrayList dailyList)
    {
        this.notice = notice;
        this.win    = win;
        content.Initialize(win, notice, dailyList);
    }
        private static IReadOnlyCollection <SystemSettings> InitData(ReservationDbContext dbContext)
        {
            var blockTypes = new List <BlockType>
            {
                new BlockType {
                    TypeId = Guid.NewGuid(), TypeName = "Contact Phone"
                },
                new BlockType {
                    TypeId = Guid.NewGuid(), TypeName = "IP"
                },
                new BlockType {
                    TypeId = Guid.NewGuid(), TypeName = "Contact Name"
                }
            };

            dbContext.BlockTypes.AddRange(blockTypes);

            var placeId  = Guid.NewGuid();
            var placeId1 = Guid.NewGuid();

            //Places init
            dbContext.ReservationPlaces.AddRange(new[]
            {
                new ReservationPlace {
                    PlaceId = placeId, PlaceName = "第一多功能厅", UpdateBy = "System", PlaceIndex = 0, MaxReservationPeriodNum = 2
                },
                new ReservationPlace {
                    PlaceId = placeId1, PlaceName = "第二多功能厅", UpdateBy = "System", PlaceIndex = 1, MaxReservationPeriodNum = 2
                },
            });

            dbContext.ReservationPeriods.AddRange(new[]
            {
                new ReservationPeriod
                {
                    PeriodId          = Guid.NewGuid(),
                    PeriodIndex       = 0,
                    PeriodTitle       = "8:00~10:00",
                    PeriodDescription = "8:00~10:00",
                    PlaceId           = placeId,
                    CreateBy          = "System",
                    CreateTime        = DateTime.UtcNow,
                    UpdateBy          = "System",
                    UpdateTime        = DateTime.UtcNow
                },
                new ReservationPeriod
                {
                    PeriodId          = Guid.NewGuid(),
                    PeriodIndex       = 1,
                    PeriodTitle       = "10:00~12:00",
                    PeriodDescription = "10:00~12:00",
                    PlaceId           = placeId,
                    CreateBy          = "System",
                    CreateTime        = DateTime.UtcNow,
                    UpdateBy          = "System",
                    UpdateTime        = DateTime.UtcNow
                },
                new ReservationPeriod
                {
                    PeriodId          = Guid.NewGuid(),
                    PeriodIndex       = 2,
                    PeriodTitle       = "13:00~16:00",
                    PeriodDescription = "13:00~16:00",
                    PlaceId           = placeId,
                    CreateBy          = "System",
                    CreateTime        = DateTime.UtcNow,
                    UpdateBy          = "System",
                    UpdateTime        = DateTime.UtcNow
                },
                new ReservationPeriod
                {
                    PeriodId          = Guid.NewGuid(),
                    PeriodIndex       = 0,
                    PeriodTitle       = "上午",
                    PeriodDescription = "上午",
                    PlaceId           = placeId1,
                    CreateBy          = "System",
                    CreateTime        = DateTime.UtcNow,
                    UpdateBy          = "System",
                    UpdateTime        = DateTime.UtcNow
                },
                new ReservationPeriod
                {
                    PeriodId          = Guid.NewGuid(),
                    PeriodIndex       = 1,
                    PeriodTitle       = "下午",
                    PeriodDescription = "下午",
                    PlaceId           = placeId1,
                    CreateBy          = "System",
                    CreateTime        = DateTime.UtcNow,
                    UpdateBy          = "System",
                    UpdateTime        = DateTime.UtcNow
                },
            });
            var notice = new Notice()
            {
                NoticeId          = Guid.NewGuid(),
                CheckStatus       = true,
                NoticeTitle       = "test",
                NoticeCustomPath  = "test-notice",
                NoticePath        = "test-notice.html",
                NoticeContent     = "just for test",
                NoticePublishTime = DateTime.UtcNow,
                NoticeDesc        = "just for test",
                NoticePublisher   = "System"
            };

            dbContext.Notices.Add(notice);

            //sys settings init
            var settings = new List <SystemSettings>
            {
                new SystemSettings
                {
                    SettingId    = Guid.NewGuid(),
                    SettingName  = "SystemTitle",
                    DisplayName  = "系统标题/SystemTitle",
                    SettingValue = "OpenReservation"
                },
                new SystemSettings
                {
                    SettingId    = Guid.NewGuid(),
                    SettingName  = "SystemKeywords",
                    DisplayName  = "系统关键词/Keywords",
                    SettingValue = "预约,活动室,预定,reservation,booking"
                },
                new SystemSettings
                {
                    SettingId    = Guid.NewGuid(),
                    SettingName  = "SystemDescription",
                    DisplayName  = "系统简介/Description",
                    SettingValue = "online reservation system powered by powerful asp.net core"
                },
                new SystemSettings
                {
                    SettingId    = Guid.NewGuid(),
                    SettingName  = "SystemContactPhone",
                    DisplayName  = "系统联系人联系电话/ContactPhone",
                    SettingValue = "13245642365"
                },
                new SystemSettings
                {
                    SettingId    = Guid.NewGuid(),
                    SettingName  = "SystemContactEmail",
                    DisplayName  = "系统联系邮箱/ContactEmail",
                    SettingValue = "*****@*****.**"
                }
            };

            dbContext.SystemSettings.AddRange(settings);

            dbContext.SaveChanges();

            return(settings);
        }
Esempio n. 57
0
 private void RemoveNotice(Notice notice)
 {
     switch (notice)
     {
         case Notice.Empty:
             LayoutRoot.Children.Remove(_emptyNotice);
             break;
         case Notice.Loading:
             LayoutRoot.Children.Remove(_loadingNotice);
             break;
         default:
             throw new Exception("Unrecognized enum type");
     }
 }
Esempio n. 58
0
 protected void OnPaging(object sender, GridViewPageEventArgs e)
 {
     BindData();
     Notice.PageIndex = e.NewPageIndex;
     Notice.DataBind();
 }
Esempio n. 59
0
 private void LoadData()
 {
     Guid id =new Guid(Request["id"]);
     Notice = bllNotice.Get(id);
 }
Esempio n. 60
0
        public async Task <IHttpActionResult> PostNotice()
        {
            PetterResultType <Notice> petterResultType = new PetterResultType <Notice>();
            List <Notice>             notices          = new List <Notice>();
            List <NoticeFile>         noticeFiles      = new List <NoticeFile>();

            Notice notice = new Notice();

            if (Request.Content.IsMimeMultipartContent())
            {
                string folder = HostingEnvironment.MapPath(UploadPath.NoticePath);
                Utilities.CreateDirectory(folder);

                var provider = await Request.Content.ReadAsMultipartAsync();

                foreach (var content in provider.Contents)
                {
                    string fieldName = content.Headers.ContentDisposition.Name.Trim('"');
                    if (!string.IsNullOrEmpty(content.Headers.ContentDisposition.FileName))
                    {
                        NoticeFile noticeFile = new NoticeFile();
                        var        file       = await content.ReadAsByteArrayAsync();

                        string fileName = Utilities.additionFileName(content.Headers.ContentDisposition.FileName.Trim('"'));

                        if (!FileExtension.NoticeExtensions.Any(x => x.Equals(Path.GetExtension(fileName.ToLower()), StringComparison.OrdinalIgnoreCase)))
                        {
                            petterResultType.IsSuccessful = false;
                            petterResultType.JsonDataSet  = null;
                            petterResultType.ErrorMessage = ResultErrorMessage.FileTypeError;
                            return(Ok(petterResultType));
                        }

                        string fullPath = Path.Combine(folder, fileName);
                        File.WriteAllBytes(fullPath, file);
                        string thumbnamil = Path.GetFileNameWithoutExtension(fileName) + "_thumbnail" + Path.GetExtension(fileName);

                        Utilities.ResizeImage(fullPath, thumbnamil, FileSize.NoticeWidth, FileSize.NoticeHeight, ImageFormat.Png);
                        noticeFile.FileName = fileName;
                        noticeFile.FilePath = UploadPath.NoticePath.Replace("~", "");

                        noticeFiles.Add(noticeFile);
                    }
                    else
                    {
                        string str = await content.ReadAsStringAsync();

                        string item = HttpUtility.UrlDecode(str);

                        #region switch case
                        switch (fieldName)
                        {
                        case "MemberNo":
                            notice.MemberNo = int.Parse(item);
                            break;

                        case "Title":
                            notice.Title = item;
                            break;

                        case "Content":
                            notice.Content = item;
                            break;

                        default:
                            break;
                        }
                        #endregion switch case
                    }
                }

                notice.StateFlag    = StateFlags.Use;
                notice.DateCreated  = DateTime.Now;
                notice.DateModified = DateTime.Now;

                // 공지게시판 등록
                db.Notices.Add(notice);
                int num = await this.db.SaveChangesAsync();

                // 공지게시판 파일 등록
                foreach (var item in noticeFiles)
                {
                    item.NoticeNo = notice.NoticeNo;
                }

                db.NoticeFiles.AddRange(noticeFiles);
                int num1 = await this.db.SaveChangesAsync();

                notices.Add(notice);
                petterResultType.IsSuccessful = true;
                petterResultType.JsonDataSet  = notices;
            }
            else
            {
                petterResultType.IsSuccessful = false;
                petterResultType.JsonDataSet  = null;
            }

            return(Ok(petterResultType));
        }