Example #1
0
 protected void DataGrid1_ItemCommand1(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument);
         UserOperator.Delete(id);
         WebTools.Alert(this, "删除成功!");
         this.SimplePager1.Changed = true;
     }
     else if (e.CommandName == "Detail")
     {
         int id = Convert.ToInt32(e.CommandArgument);
         this.Pop(id);
     }
     else if (e.CommandName == "ResetPwd")
     {
         int  id     = Convert.ToInt32(e.CommandArgument);
         bool result = UserOperator.ResetPwd(id, ConfigurationManager.AppSettings["DefaultPassword"].ToString());
         if (result)
         {
             WebTools.Alert(this, "密码重置成功!");
         }
         else
         {
             WebTools.Alert(this, "密码重置失败!");
         }
     }
 }
Example #2
0
    public DataTable DgBind()
    {
        DataTable table = null;
        string    name  = this.txtUserName.Text;

        table = UserOperator.Search(name);
        return(table);
    }
Example #3
0
        public async Task <UserSubSearchModel> FindByIdAsync(string userId)
        {
            var result = _context.Users.Where(v => v.Id == userId);

            result = (IQueryable <ApplicationUser>)ExpandOperator.ExpandRelatedEntities <ApplicationUser>(result);

            var user = await result.FirstOrDefaultAsync();

            var userSearch = UserOperator.SetUserSearchModelCascade(user);

            return(userSearch);
        }
Example #4
0
 public bool Insert(UserDTO userDTO)
 {
     try
     {
         var          user         = AutoMapperHelper.MapTo <User>(userDTO);
         UserOperator userOperator = new UserOperator();
         return(userOperator.Insert(user));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #5
0
 public IEnumerable <User> GetAll()
 {
     try
     {
         UserOperator userOperator = new UserOperator();
         var          users        = userOperator.GetAll();
         return(users);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
 async public Task <User> GetCurrentUserAsync()
 {
     using (UserOperator userOperator = new UserOperator(_hostname, _hostProperties, _networkOperationStatusListener))
     {
         try
         {
             return(await userOperator.SearchCurrentUserAsync());
         }
         catch (OperatorException)
         {
             return(null);
         }
     }
 }
Example #7
0
 async public Task <User> SearchUserByNameAsync(string name)
 {
     using (UserOperator userOperator = new UserOperator(_hostname, _hostProperties))
     {
         try
         {
             return(await userOperator.SearchUserByNameAsync(name));
         }
         catch (OperatorException)
         {
             return(null);
         }
     }
 }
Example #8
0
 async public Task <User> SearchUserByUsernameAsync(string username)
 {
     using (UserOperator userOperator = new UserOperator(_hostname, _hostProperties, _networkOperationStatusListener))
     {
         try
         {
             return(await userOperator.SearchUserByUsernameAsync(username));
         }
         catch (OperatorException)
         {
             return(null);
         }
     }
 }
Example #9
0
    protected void btnSure_Click(object sender, EventArgs e)
    {
        string result = UserOperator.ChangePwd(this.Operator.OperatorID, this.txtOldPwd.Text.Trim(), this.txtNewPwd.Text.Trim());

        if (result.Length > 0)
        {
            WebTools.Alert(this, result);
            return;
        }
        else
        {
            WebTools.Alert(this, "修改成功,请重新登录!");
            return;
        }
    }
Example #10
0
        public async Task <IEnumerable <UserSearchModel> > GetAllAsync()
        {
            var queryData = from U in _context.Users
                            select U;

            var result = QueryOperate <ApplicationUser> .Execute(queryData);

            result = (IQueryable <ApplicationUser>)ExpandOperator.ExpandRelatedEntities <ApplicationUser>(result);

            //以下执行完后才会去数据库中查询
            var users = await result.ToListAsync();

            var usersSearch = UserOperator.SetUserSearchModelCascade(users);

            return(usersSearch);
        }
Example #11
0
    private void giveOperator(List <OperatorInfo> operatorInfos, List <Item> items)
    {
        bool tmpbool = true;

        for (int i = 0; i < operatorInfos.Count; ++i)
        {
            int tmp = i;
            //Debug.Log("들어간 값 : " + resultName + "/ 디비 값 : " + operatorInfos[tmp].EgName);
            if (resultName == operatorInfos[tmp].EgName)
            {
                Debug.Log("너어는 진짜");

                if (LoadData.instance.UserInfo.userOperator.Count <= 0)
                {
                    Inventory.instance.Add(items[tmp]);
                    Inventory.instance.Add(operatorInfos[tmp]);

                    UserOperator userOperator = new UserOperator();
                    userOperator.indexName = operatorInfos[tmp].NameNumber;
                    LoadData.instance.UserInfo.userOperator.Add(userOperator);
                }
                else
                {
                    foreach (UserOperator item in LoadData.instance.UserInfo.userOperator)
                    {
                        if (item.indexName == operatorInfos[tmp].NameNumber)
                        {
                            item.operatorUse++;
                            tmpbool = false;
                            break;
                        }
                    }

                    if (tmpbool == true)
                    {
                        Inventory.instance.Add(items[tmp]);
                        Inventory.instance.Add(operatorInfos[tmp]);
                        UserOperator userOperator = new UserOperator();
                        userOperator.indexName = operatorInfos[tmp].NameNumber;
                        LoadData.instance.UserInfo.userOperator.Add(userOperator);
                    }
                }
                break;
            }
        }
        LoadData.instance._SaveDataUserInfo();
    }
Example #12
0
    protected void imgBtnLogin_Click(object sender, ImageClickEventArgs e)
    {
        string result = UserOperator.Login(this.txtLoginName.Text.Trim(), this.txtPwd.Text.Trim());

        if (result == "2")
        {
            WebTools.Alert(this, "登陆失败,请检查用户名和密码");
        }
        else if (result == "1")
        {
            WebTools.Alert(this, "登陆失败,错误代码为1");
        }
        else
        {
            Session["OperatorInfo"] = result;
            Response.Redirect("~/index.aspx");
        }
    }
        public bool Add(UserOperatorDto userOperatorDto)
        {
            UserOperator userOperator = new UserOperator
            {
                Name  = userOperatorDto.Name,
                Phone = userOperatorDto.Phone
            };

            try
            {
                _dbContext.UserOperators.Add(userOperator);
                _dbContext.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #14
0
        /// <summary>
        /// 评测一组用例
        /// </summary>
        /// <param name="stdInput">标准输入</param>
        /// <param name="stdOutput">标准输出</param>
        /// <param name="stdQuery">标准查询</param>
        /// <returns></returns>
        public SingleJudgeResult Judge(string stdInput, DbData stdOutput, DbQueryData stdQuery)
        {
            Stopwatch    sw        = new Stopwatch();
            DbDataReader reader    = null;
            DbQueryData  usrQuery  = null;
            DbData       usrOutput = null;

            try
            {
                sw.Start();
                reader = UserOperator.ExecuteReader(JudgeTask.SourceCode, JudgeTask.TimeLimit);

                usrQuery  = BaseDbOperator.ReadQueryData(reader);
                usrOutput = UserOperator.ReadDbData();
            }
            catch (Exception ex)
            {
                return(new SingleJudgeResult
                {
                    ResultCode = JudgeResultCode.RuntimeError,
                    JudgeDetail = ex.Message,
                    TimeCost = 0
                });
            }
            finally
            {
                sw.Stop();
            }

            CompareResult   result     = CompareAnswer(stdOutput, stdQuery, usrOutput, usrQuery);
            JudgeResultCode resultCode = (result == CompareResult.Accepted)
                ? JudgeResultCode.Accepted
                : JudgeResultCode.WrongAnswer;

            return(new SingleJudgeResult
            {
                ResultCode = resultCode,
                TimeCost = (int)sw.ElapsedMilliseconds
            });
        }
Example #15
0
 internal static void operator_location(this TextWriter trapFile, UserOperator @operator, Location location)
 {
     trapFile.WriteTuple("operator_location", @operator, location);
 }
Example #16
0
 internal static void operators(this TextWriter trapFile, UserOperator method, string methodName, string symbol, Type classKey, Type returnType, UserOperator originalDefinition)
 {
     trapFile.WriteTuple("operators", method, methodName, symbol, classKey, returnType, originalDefinition);
 }
Example #17
0
 /// <summary>
 /// 스탯 유저인포에따른 증가값을 연산하는 함수. 플롯값도 있을수 있기때문에 오버로딩
 /// </summary>
 /// <param name="info"></param>
 /// <param name="data"></param>
 /// <returns></returns>
 public int StatCalculation(UserOperator info, int data)
 {
     return(data + (int)(info.lv * (data * 0.2f)));
 }
Example #18
0
        static void Main(string[] args)
        {
            //设置apikey
            Config config = new Config("your apikey");
            Dictionary <string, string> data = new Dictionary <string, string>();
            Result result = null;

            // 获取用户信息
            UserOperator user = new UserOperator(config);

            result = user.get(data);
            Console.WriteLine(result);

            // 获取模板信息
            TplOperator tpl = new TplOperator(config);

            data.Clear();
            data.Add("tpl_id", "1");
            result = tpl.getDefault(data);
            Console.WriteLine(result);


            // 发送单条短信
            SmsOperator sms = new SmsOperator(config);

            data.Clear();
            data.Add("mobile", "14012341234");
            data.Add("text", "【yunpian】您的验证码是9981");
            result = sms.singleSend(data);
            Console.WriteLine(result);
            // 发送模板短信(不推荐使用)
            // data.Clear();
            // string tpl_value = HttpUtility.UrlEncode(
            // HttpUtility.UrlEncode("#code#", Encoding.UTF8) + "=" +
            // HttpUtility.UrlEncode("1234", Encoding.UTF8) + "&" +
            // HttpUtility.UrlEncode("#company#", Encoding.UTF8) + "=" +
            // HttpUtility.UrlEncode("云片网", Encoding.UTF8), Encoding.UTF8);
            // data.Add("mobile", "14012341231,123,13012312312");
            // data.Add("tpl_value", tpl_value);
            // data.Add("tpl_id", "1");
            // result = sms.tplSingleSend(data);
            // Console.WriteLine(result);

            // 发送批量短信
            data.Clear();
            data.Add("mobile", "14012341231,123,13012312312");
            data.Add("text", "【yunpian】您的验证码是9981");
            result = sms.batchSend(data);
            Console.WriteLine(result);
            // 发送个性化短信
            data.Clear();
            data.Add("mobile", "14022341231,123,13112312312,13112312312");
            data.Add("text", "【yunpian】您的验证码是9981,【yunpian】您的验证码是1981,【yunpian】您的验证码是9921,【yunpian】您的验证码是9981");
            result = sms.multiSend(data);
            Console.WriteLine(result);

            // 发送语音
            VoiceOperator voice = new VoiceOperator(config);

            data.Clear();
            data.Add("code", "1421");
            data.Add("mobile", "13012312312");
            result = voice.send(data);
            Console.WriteLine(result);

            // 发送流量
            FlowOperator flow = new FlowOperator(config);

            data.Clear();
            result = flow.getPackage(data);
            Console.WriteLine(result);

            data.Clear();
            data.Add("sn", "1008601");
            data.Add("mobile", "18712341234");
            result = flow.recharge(data);
            Console.WriteLine(result);
            Console.ReadLine();
        }
Example #19
0
 internal static Tuple operators(UserOperator method, string methodName, string symbol, Type classKey, Type returnType, UserOperator originalDefinition) => new Tuple("operators", method, methodName, symbol, classKey, returnType, originalDefinition);
Example #20
0
 internal static Tuple operator_location(UserOperator @operator, Location location) => new Tuple("operator_location", @operator, location);
 public RetrieveUserFilter(UserOperator userOperator, Expression <Func <T> > selectFieldExpression, String findValue)
 {
     this.userOperator          = userOperator;
     this.selectFieldExpression = selectFieldExpression;
     this.findValue             = findValue;
 }
Example #22
0
    public int StatCalculation(OperatorInfo info, float data)
    {
        UserOperator userOperator = Stage.instance.UserInfo.userOperator[info.NameNumber];

        return((int)(data + (userOperator.lv * (data * 0.2f))));
    }
Example #23
0
 public UserServices(UserOperator user, IdWorker wk, ILogger <UserServices> log)
 {
     userOperator = user;
     worker       = wk;
     Logger       = log;
 }