Esempio n. 1
0
        /// <summary>
        /// 下拉框
        /// </summary>
        public void DDLDataBind()
        {
            //绑定状态
            Type type = typeof(SysStatus);

            List <ListItem> list = DisplayNameExtension.GetSelectList(SysStatus.Enable, type);

            ddlStatus.DataSource = list;
            ddlStatus.DataBind();
            //绑定部门
            GetAllDepartment(ddlDepartment);
        }
Esempio n. 2
0
        /// <summary>
        /// @author:wp
        /// @datetime:2016-08-31
        /// @desc:绑定场地标签
        /// </summary>
        public void BinderLabel()
        {
            Type type = typeof(HotelTypeName);

            selHotelType.DataSource = DisplayNameExtension.GetSelectList(HotelTypeName.HType1, type);
            selHotelType.DataBind();

            //获取启用的场地标签
            var DataList = _labelService.GetAllByEnable(1);

            repLabel.DataSource = DataList;
            repLabel.DataBind();
        }
Esempio n. 3
0
        public AjaxMessage CreateMessage(sm_Message msg, int msgType, string msgId)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            try
            {
                if (msg != null)
                {
                    sm_Message        message      = new sm_Message();
                    sm_Message        draftMessage = new sm_Message();  //草稿
                    List <sm_Message> msgList      = new List <sm_Message>();

                    string[] employee = msg.ToEmployee.ToString().Split(',');
                    Type     type     = typeof(SendTypeName);
                    var      Typelist = DisplayNameExtension.GetSelectList(SendTypeName.GetMsg, type, false);
                    foreach (ListItem item in Typelist)
                    {
                        for (int i = 0; i < employee.Length; i++)
                        {
                            message = new sm_Message();
                            message.FromEmployee   = LoginInfo.UserInfo.EmployeeId;
                            message.MessageContent = msg.MessageContent;
                            message.MessageTitle   = msg.MessageTitle;
                            message.ToEmployee     = employee[i];
                            message.SendDateTime   = DateTime.Now;
                            message.IsRead         = 0; //0 未读   1 已读
                            message.SendType       = item.Value.ToInt32();
                            message.IsDraft        = 0;
                            message.IsGarbage      = 0;
                            msgList.Add(message);
                        }
                    }

                    if (msgType == 1)       //发件
                    {
                        //删除草稿
                        if (!string.IsNullOrEmpty(msgId))
                        {
                            _msgService.DeleteMsg(msgId);
                        }
                        ////发送信息
                        int result = _msgService.InsertFroList(msgList);

                        if (result > 0)
                        {
                            ajax.Message   = "发送成功";
                            ajax.IsSuccess = true;
                        }
                    }
                    else if (msgType == 2)
                    {
                        //草稿

                        if (!string.IsNullOrEmpty(msgId))
                        {
                            draftMessage = _msgService.GetByID(msgId.ToInt32());
                            draftMessage.MessageContent = msg.MessageContent;
                            draftMessage.MessageTitle   = msg.MessageTitle;
                        }
                        else
                        {
                            draftMessage = message;
                        }

                        draftMessage.ToEmployee = msg.ToEmployee;
                        draftMessage.IsDraft    = 1;
                        draftMessage.SendType   = (byte)SendTypeName.SendMsg;

                        int result = 0;
                        if (!string.IsNullOrEmpty(msgId))       //修改
                        {
                            result = _msgService.Update(draftMessage);
                        }
                        else                //新增
                        {
                            result = _msgService.Insert(draftMessage);
                        }

                        if (result > 0)
                        {
                            ajax.Message   = "保存草稿成功";
                            ajax.IsSuccess = true;
                        }
                    }


                    var d = new { employeeId = msg.ToEmployee };
                    Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext <Hubs.MessageHub>().Clients.All.newMsg(d);
                }
            }
            catch (Exception e)
            {
                ajax.Message   = e.Message.ToString();
                ajax.IsSuccess = false;
            }
            return(ajax);
        }