示例#1
0
        public static MvcHtmlString GetAllUserGroupList(this HtmlHelper htmlHelper, string name, string selectedValue)
        {
            List <UEUser> group = UserEmailBLL.GetUserGroupList();

            string option      = "";
            string alloptgroup = "";

            for (int i = 0; i < group.Count; i++)
            {
                UEUser item = group[i];

                if (selectedValue == item.UserName)
                {
                    option += " <option selected='selected' value = '" + item.UserName + "' > " + item.NickName + " </option >";
                }
                else
                {
                    option += " <option value = '" + item.UserName + "' > " + item.NickName + " </option >";
                }
            }
            alloptgroup += option;

            alloptgroup = "<select style = 'width: 100 %;' class='select2' id=" + name + " name=" + name + ">" +
                          "<option value=''>&nbsp;&nbsp;&nbsp;所有用户</option>" +
                          alloptgroup +
                          "</select>";
            return(new MvcHtmlString(alloptgroup));
        }
示例#2
0
        public ActionResult SendUserEmail(Dictionary <string, string> queryvalues)
        {
            ILog log = LogManager.GetLogger("Callback");

            log.Info("开始接受参数!");



            string UEUserID    = queryvalues.ContainsKey("userid") ? queryvalues["userid"] : string.Empty;
            string UETitle     = queryvalues.ContainsKey("title") ? queryvalues["title"] : string.Empty;
            string UEContent   = queryvalues.ContainsKey("content") ? queryvalues["content"] : string.Empty;
            string UEItemValue = queryvalues.ContainsKey("gold") ? queryvalues["gold"] : string.Empty;
            string UEItemType  = "1";
            string UEItemNum   = "1";

            log.Info(UEUserID + "," + UETitle + "," + UEContent + "," + UEItemValue);

            UserEmail ue = new UserEmail {
                UEUserID = UEUserID
            };

            List <uint> UserIDList = UEUserID.Split(',').Select(x => Convert.ToUInt32(x)).ToList();



            Service_ItemMail_C ServiceItemMailC;


            ServiceItemMailC = Service_ItemMail_C.CreateBuilder()
                               .AddRangeUserID(UserIDList)
                               .SetTitle(UETitle)
                               .SetContext(UEContent)
                               .SetItemType(Convert.ToUInt32(UEItemType))
                               .SetItemValue(Convert.ToUInt32(UEItemValue))
                               .SetItemNum(Convert.ToUInt32(UEItemNum))
                               .Build();


            Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_SEND_ITEMMAIL, ServiceItemMailC.ToByteArray()));

            ue = new UserEmail {
                UEUserID = UEUserID, UETime = DateTime.Now, UETitle = UETitle, UEContent = UEContent, UEAuthor = "admin", UEItemNum = Convert.ToInt32(UEItemNum), UEItemType = (ueItemType)Convert.ToInt32(UEItemType), UEItemValue = Convert.ToInt32(UEItemValue)
            };


            if ((CenterCmd)tbind.header.CommandID == CenterCmd.CS_SEND_ITEMMAIL)
            {
                Service_ItemMail_S ServiceItemMailS = Service_ItemMail_S.ParseFrom(tbind.body.ToBytes());
                if (ServiceItemMailS.Suc)
                {
                    int result = UserEmailBLL.Add(ue);
                    if (result > 0)
                    {
                        return(Content("0", "string"));
                    }
                }
            }

            return(Content("1", "string"));
        }