Beispiel #1
0
        public int UptZt(int cid)
        {
            try
            {
                string sql = "select * from Agent";

                List <Model.Agent> la = DapperHelper.GetList <Model.Agent>(sql);

                Model.Agent aa   = la.FirstOrDefault(x => x.AgentId.Equals(cid));
                string      sql1 = "";
                if (aa.AgentState == 0)
                {
                    sql1 = $"UPDATE Agent SET AgentState=AgentState+1 where AgentId={cid}";
                }
                else
                {
                    sql1 = $"UPDATE Agent SET AgentState=AgentState-1 where AgentId={cid}";
                }
                int i = DapperHelper.Execute(sql1);
                return(i);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void add_unit(Model.Agent card)
        {
            try
            {
                string        con_str    = Properties.Settings.Default.con_str;
                SqlConnection connection = new SqlConnection(con_str);
                connection.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = connection;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "[dbo].[CreateNewUnit]";

                cmd.Parameters.Add(new SqlParameter("@boss", card.Boss)
                {
                    Direction = ParameterDirection.Input
                });
                cmd.Parameters.Add(new SqlParameter("@name", card.Name)
                {
                    Direction = ParameterDirection.Input
                });
                cmd.Parameters.Add(new SqlParameter("@id", card.Id)
                {
                    Direction = ParameterDirection.Output
                });
                //cmd.Parameters.Add(new SqlParameter("@status_code",100) { Direction=ParameterDirection.Input};
                cmd.ExecuteNonQuery();
                ((App)App.Current).all_data.stat_it(0, ((App)App.Current).the_person.Id, "success add_unit");
                card.Id = Convert.ToInt64(cmd.Parameters["@id"].Value);
                connection.Close();
            }
            catch (Exception e) { MessageBox.Show(e.ToString()); ((App)App.Current).all_data.stat_it(0, ((App)App.Current).the_person.Id, "fail add_unit"); }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //-----------权限控制开始-----------
            //当前角色
            int Rid = CurrentManager.RoleId;

            BLL.Sys_role_rightManager rrService = new BLL.Sys_role_rightManager();

            //查看权限
            if (!rrService.IsPermission(Rid, 44))
            {
                viewAc = false;
                Response.Write("<script>alert('非法操作,请返回!');history.go(-1);</script>");
                Response.End();
            }
            //修改权限
            if (!rrService.IsPermission(Rid, 124))
            {
                mdfAc = false;
            }
            //查找权限
            if (!rrService.IsPermission(Rid, 125))
            {
                searchAc = false;
            }
            //-----------权限控制结束-----------

            //代理初始化
            Model.Agent agent = BLL.AgentManager.GetAgentByPK(agentUserID);
            UserName = agentUserName;
            RoleId   = (agentRoleID + 1).ToString();
            ID       = agentUserID.ToString();
        }
Beispiel #4
0
 void _del_card(object param)
 {
     ((App)App.Current).all_data.stat_it(agent.Id, ((App)App.Current).the_person.Id, "deleting agent");
     ((App)App.Current).all_data.delete_unit(agent);
     units.Remove(agent);
     agent = new Model.Agent();
 }
        public IActionResult ActivityShowFT(int ftid)
        {
            //获取全部数据
            var ls = _agentRepository.ShowAgent();

            Model.Agent aa = ls.FirstOrDefault(x => x.AgentId.Equals(ftid));
            return(Ok(aa));
        }
Beispiel #6
0
 public IEither <IEnumerable <ICommandError>, Agent> CreateOrUpdateAgent(Model.Agent agent)
 {
     return(this.CommandProcessor.Process(
                new Business.Agent.Commands.AgentUpdateCommand
     {
         Data = agent
     }));
 }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //-----------权限控制开始-----------
            //当前角色
            int Rid = CurrentManager.RoleId;

            BLL.Sys_role_rightManager rrService = new BLL.Sys_role_rightManager();

            //查看权限
            if (!rrService.IsPermission(Rid, 180))
            {
                viewAc = false;
                Response.Write("<script>alert('非法操作,请返回!');history.go(-1);</script>");
                Response.End();
            }
            //增加权限
            if (!rrService.IsPermission(Rid, 120))
            {
                addAc = false;
            }
            //修改权限
            if (!rrService.IsPermission(Rid, 121))
            {
                mdfAc = false;
            }
            //查找权限
            if (!rrService.IsPermission(Rid, 122))
            {
                searchAc = false;
            }

            //修改密码
            if (!rrService.IsPermission(Rid, 123))
            {
                passwordAc = false;
            }
            //-----------权限控制结束-----------

            //代理初始化
            Model.Agent agent = BLL.AgentManager.GetAgentByPK(agentUserID);
            Credit      = agent.Credit.ToString();
            UserCredit  = agent.UserCredit.ToString();
            ResetCredit = agent.ResetCredit;
            UserName    = agentUserName;
            RoleId      = (agentRoleID + 1).ToString();
            Percent     = (agent.Percent * 100).ToString();
            CommissionA = (agent.CommissionA * 100).ToString("0");
            CommissionB = (agent.CommissionB * 100).ToString("0");
            CommissionC = (agent.CommissionC * 100).ToString("0");
            ID          = agentUserID.ToString();
            ItemMin     = agent.ItemMin.ToString();
            ItemMax     = agent.ItemMax.ToString();
            ItemsMax    = agent.ItemsMax.ToString();
            Currency    = agent.Currency;
        }
Beispiel #8
0
        public IEither <IEnumerable <ICommandError>, IEnumerable <IEvent> > Handle(
            Model.Agent agent,
            Commands.AgentUpdateCommand command)
        {
            if (command.AggregateId == Guid.Empty)
            {
                return(CommandResult.Handled(new Events.AgentNewEvent(command.Data)));
            }

            return(CommandResult.Handled(new Events.AgentUpdatedEvent(command.Data)));
        }
Beispiel #9
0
 public int AddAgent(Model.Agent a)
 {
     try
     {
         string sql = $"insert into Agent values (null,'{a.AgentName}','{a.BackgroudColor}','{a.Icon}','{a.BCImg}','{a.Fans}',{a.Consume},{a.Money},'{a.NFans}',{a.Two},{a.Three},{a.One},'{a.Explaina}',{a.AgentState})";
         return(DapperHelper.Execute(sql));
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #10
0
        public int UptAgent(Model.Agent a)
        {
            try
            {
                string sql = $"update  Agent set AgentName='{a.AgentName}',BackgroudColor='{a.BackgroudColor}',Icon='{a.Icon}',BCImg='{a.BCImg}',Fans='{a.Fans}',Consume={a.Consume},Money={a.Money},NFans='{a.NFans}',Two={a.Two},Three={a.Three},One={a.One},Explaina='{a.Explaina}',AgentState={a.AgentState} where AgentId={a.AgentId}";

                return(DapperHelper.Execute(sql));
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #11
0
        public IEither <IEnumerable <ICommandError>, IEnumerable <IEvent> > Handle(
            Model.Agent agent,
            Commands.AppointmentUpdateCommand command)
        {
            if (command.AggregateId == Guid.Empty)
            {
                return(CommandResult.Failed(
                           new AgentNotFoundError(command.AggregateId)));
            }

            if (!agent.IsValidAddress(command.Data.Address))
            {
                return(CommandResult.Failed(
                           new InvalidAddressError(command.Data.Address)));
            }

            if (!agent.IsValidSchedule(command.Data.StartDate, command.Data.EndDate))
            {
                return(CommandResult.Failed(
                           new InvalidScheduleError(
                               command.Data.StartDate,
                               command.Data.EndDate,
                               command.Data.AgentId)));
            }

            if (command.Data.AppointmentId != 0)
            {
                if (agent.HasAppointment(command.Data.AppointmentId))
                {
                    return(CommandResult.Handled(new Events.AppointmentUpdatedEvent(command.Data)));
                }

                return(CommandResult.Failed(
                           new MissingAppointmentError(
                               command.Data.AppointmentId,
                               command.Data.AgentId)));
            }

            if (agent.CanScheduleAppointment(command.Data.StartDate, command.Data.EndDate))
            {
                return
                    (CommandResult.Handled(new Events.AppointmentNewEvent(agent.Appointments.Count() + 1,
                                                                          command.Data)));
            }

            return(CommandResult.Failed(
                       new AppointmentConflictError(
                           command.Data.StartDate,
                           command.Data.EndDate,
                           command.Data.AgentId)));
        }
Beispiel #12
0
 public IHttpActionResult PostAgent(Model.Agent agent)
 {
     try
     {
         return(this.AgentService.CreateOrUpdateAgent(agent)
                .Case <IHttpActionResult>(
                    errors => this.Conflict(),
                    newAgent => this.Ok(newAgent)));
     }
     catch (Exception ex)
     {
         return(this.InternalServerError(ex));
     }
 }
Beispiel #13
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Agent model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Agent set ");
            strSql.Append("TrueName=@TrueName,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("Words=@Words,");
            strSql.Append("ComID=@ComID,");
            strSql.Append("Account=@Account,");
            strSql.Append("PassWord=@PassWord,");
            strSql.Append("QQ=@QQ,");
            strSql.Append("WeChat=@WeChat,");
            strSql.Append("Xiaoqu=@Xiaoqu");
            strSql.Append(" where ID=@ID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@TrueName", DbType.String),
                new SQLiteParameter("@Phone",    DbType.String),
                new SQLiteParameter("@Words",    DbType.String),
                new SQLiteParameter("@ComID",    DbType.Int32,8),
                new SQLiteParameter("@Account",  DbType.String),
                new SQLiteParameter("@PassWord", DbType.String),
                new SQLiteParameter("@QQ",       DbType.String),
                new SQLiteParameter("@WeChat",   DbType.String),
                new SQLiteParameter("@Xiaoqu",   DbType.String),
                new SQLiteParameter("@ID",       DbType.Int32, 8)
            };
            parameters[0].Value = model.TrueName;
            parameters[1].Value = model.Phone;
            parameters[2].Value = model.Words;
            parameters[3].Value = model.ComID;
            parameters[4].Value = model.Account;
            parameters[5].Value = model.PassWord;
            parameters[6].Value = model.QQ;
            parameters[7].Value = model.WeChat;
            parameters[8].Value = model.Xiaoqu;
            parameters[9].Value = model.ID;

            int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #14
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.Agent DataRowToModel(DataRow row)
 {
     Model.Agent model = new Model.Agent();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["TrueName"] != null)
         {
             model.TrueName = row["TrueName"].ToString();
         }
         if (row["Phone"] != null)
         {
             model.Phone = row["Phone"].ToString();
         }
         if (row["Words"] != null)
         {
             model.Words = row["Words"].ToString();
         }
         if (row["ComID"] != null && row["ComID"].ToString() != "")
         {
             model.ComID = int.Parse(row["ComID"].ToString());
         }
         if (row["Account"] != null)
         {
             model.Account = row["Account"].ToString();
         }
         if (row["PassWord"] != null)
         {
             model.PassWord = row["PassWord"].ToString();
         }
         if (row["QQ"] != null)
         {
             model.QQ = row["QQ"].ToString();
         }
         if (row["WeChat"] != null)
         {
             model.WeChat = row["WeChat"].ToString();
         }
         if (row["Xiaoqu"] != null)
         {
             model.Xiaoqu = row["Xiaoqu"].ToString();
         }
     }
     return(model);
 }
Beispiel #15
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            Model.Affiliate affiliate = new Model.Affiliate
            {
                Id = Convert.ToInt32(affiliateDropDown.SelectedItem.Value)
            };

            Model.Agent agent = new Model.Agent
            {
                Id = Convert.ToInt32(agentDropDown.SelectedItem.Value)
            };

            Model.RiskPackage riskPackage = new Model.RiskPackage
            {
                Id = Convert.ToInt32(riskPackageDropDown.SelectedItem.Value)
            };

            Model.Insured insured = new Model.Insured
            {
                Id = Convert.ToInt32(insuredDropDown.SelectedItem.Value)
            };

            Model.Vehicle vehicle = new Model.Vehicle
            {
                RegisterNumber = registerNumberDropDown.SelectedItem.Value
            };

            Model.Policy policy = new Model.Policy
            {
                CreatedOn   = DateTime.Now,
                StartDate   = Convert.ToDateTime(startDateTextBox.Value),
                EndDate     = Convert.ToDateTime(expireDateTextBox.Value),
                Affiliate   = affiliate,
                Agent       = agent,
                Insured     = insured,
                Premium     = Convert.ToDecimal(premiumTextBox.Text),
                RiskPackage = riskPackage,
                Vehicle     = vehicle
            };

            policyDao.InsertPolicy(policy);

            Response.Redirect("~/Pages/Policy/Policies.aspx");
        }
Beispiel #16
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.Agent model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Agent(");
            strSql.Append("ID,TrueName,Phone,Words,ComID,Account,PassWord,QQ,WeChat,Xiaoqu)");
            strSql.Append(" values (");
            strSql.Append("@ID,@TrueName,@Phone,@Words,@ComID,@Account,@PassWord,@QQ,@WeChat,@Xiaoqu)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID",       DbType.Int32,   8),
                new SQLiteParameter("@TrueName", DbType.String),
                new SQLiteParameter("@Phone",    DbType.String),
                new SQLiteParameter("@Words",    DbType.String),
                new SQLiteParameter("@ComID",    DbType.Int32,   8),
                new SQLiteParameter("@Account",  DbType.String),
                new SQLiteParameter("@PassWord", DbType.String),
                new SQLiteParameter("@QQ",       DbType.String),
                new SQLiteParameter("@WeChat",   DbType.String),
                new SQLiteParameter("@Xiaoqu",   DbType.String)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.TrueName;
            parameters[2].Value = model.Phone;
            parameters[3].Value = model.Words;
            parameters[4].Value = model.ComID;
            parameters[5].Value = model.Account;
            parameters[6].Value = model.PassWord;
            parameters[7].Value = model.QQ;
            parameters[8].Value = model.WeChat;
            parameters[9].Value = model.Xiaoqu;

            int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //-----------权限控制开始-----------
            //当前角色
            int Rid = CurrentManager.RoleId;

            BLL.Sys_role_rightManager rrService = new BLL.Sys_role_rightManager();

            //查看权限
            if (!rrService.IsPermission(Rid, 47))
            {
                viewAc = false;
                Response.Write("<script>alert('非法操作,请返回!');history.go(-1);</script>");
                Response.End();
            }
            //修改权限
            if (!rrService.IsPermission(Rid, 130))
            {
                mdfAc = false;
            }
            //查找权限
            if (!rrService.IsPermission(Rid, 131))
            {
                searchAc = false;
            }
            //-----------权限控制结束-----------
            //代理初始化
            //BLL.AgentManager agentManager = new BLL.AgentManager();
            //string names = agentManager.getUserNames(agentUserName);
            //double nPercent = 0;
            //IList<Model.Agent> agents = agentManager.GetAgentByUserNames(names);
            //foreach (Model.Agent iagent in agents)
            //{
            //    nPercent += iagent.Percent;
            //}

            Model.Agent agent = BLL.AgentManager.GetAgentByPK(agentUserID);
            UserName = agentUserName;
            RoleId   = (agentRoleID + 1).ToString();
            Percent  = (agent.Percent * 100).ToString();
        }
Beispiel #18
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Agent GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,TrueName,Phone,Words,ComID,Account,PassWord,QQ,WeChat,Xiaoqu from Agent ");
            strSql.Append(" where ID=@ID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID", DbType.Int32, 8)
            };
            parameters[0].Value = ID;

            Model.Agent model = new Model.Agent();
            DataSet     ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #19
0
        public string AddUser(string UserName, string Password, string TCpassword, DateTime Birthday, string Name,
                              string Tel, string Email, string Agent, string post, string Answer)
        {
            if (UserName.Trim() == "")
            {
                return("err8");
            }
            else
            {
                if (UserName.Trim().Length < 6 || UserName.Trim().Length > 15)
                {
                    return("err9");
                }
            }
            if (ChkBadWord(UserName.Trim()))//检测是否有非法字符
            {
                return("err8");
            }
            Model.User  info     = new Model.User();
            Model.Agent agent    = null;
            Model.Agent subAgent = null;
            Model.Agent parAgent = null;
            Model.Agent zAgent   = null;

            if (!string.IsNullOrEmpty(Email))
            {
                if (DAL.UserService.IsExistEmail(Email))
                {
                    return("err:email");   //邮箱重复
                }
            }


            AgentManager am = new AgentManager();

            if (string.IsNullOrEmpty(Agent) || Agent == "undefined")
            {
                //网站直接会员
                ConfigManager cm   = new ConfigManager();
                string        styp = "人民币";

                Model.Config config = cm.GetConfigByOtype(styp);
                Agent = config.Oval;
            }

            //代理会员
            agent = am.GetAgentByUserName(Agent);

            //if (agent==null)
            //{
            //     return "err2";

            //}
            //选择的币种是否与推荐人币种一致
            //info.parentcode = agent.ParentCode;
            subAgent = am.GetAgentByUserName(agent.SubCompany);
            parAgent = am.GetAgentByUserName(agent.Partner);
            zAgent   = am.GetAgentByUserName(agent.GeneralAgent);

            info.GeneralAgent           = agent.GeneralAgent;
            info.GeneralAgentPercent    = Convert.ToDecimal(zAgent.Percent);
            info.GeneralAgentCommission = zAgent.CommissionA;
            info.Agent           = Agent;
            info.AgentPercent    = Convert.ToDecimal(agent.Percent);
            info.AgentCommission = agent.CommissionA;

            info.CompanyPercent       = 0;
            info.PartnerCommission    = 0;
            info.SubCompany           = agent.SubCompany;
            info.SubCompanyPercent    = Convert.ToDecimal(subAgent.Percent);
            info.SubCompanyCommission = subAgent.CommissionA;
            info.Partner           = agent.Partner;
            info.PartnerPercent    = Convert.ToDecimal(parAgent.Percent);
            info.PartnerCommission = parAgent.CommissionA;
            info.Percent           = 0;
            info.Commission        = 0;
            info.Credit            = 0;
            info.UpUserName        = agent.UserName;
            info.UpUserID          = agent.ID;
            info.UpRoleId          = agent.RoleId;
            info.ItemMin           = agent.ItemMin;
            info.ItemMax           = agent.ItemMax;
            info.ItemsMax          = agent.ItemsMax;
            info.Group             = "A";
            info.ResetCredit       = "0";
            info.RegistrationTime  = DateTime.Now;
            info.LastLoginTime     = DateTime.Now;
            info.UserLevel         = "5";
            info.Coefficient       = 0;
            info.Proportion        = 0;
            info.Balance           = 0;
            info.RoleId            = 6;

            info.UserName   = UserName.Trim();
            info.Password   = Password;
            info.TCpassword = TCpassword;
            info.Birthday   = Birthday;
            info.Name       = Name.Trim();
            info.Tel        = Tel;
            info.Email      = Email;

            info.Agent = Agent.Trim();

            info.Status    = 1;
            info.MoneyType = "0";
            info.regip     = Util.RequestHelper.GetIP();
            info.Post      = post.Trim();
            info.Answer    = Answer.Trim();


            bool reval = UserManager.AddAgentUser2(info);

            if (reval)
            {
                //用户登录
                UserManager um   = new UserManager();
                Model.User  user = null;
                user = um.GetUserByUserName(info.UserName);
                if (user != null)
                {
                    Session[ProjectConfig.LOGINUSER] = user;
                    CookieHelper cook = new CookieHelper();
                    //cook.SetCookie(ProjectConfig.LANGUAGE_COOK, "tw", TimeSpan.FromDays(1));
                    Application[user.ID + "Session"] = this.Session.SessionID;
                    user.LastLoginIP = RequestHelper.GetIP();
                    UserManager.UpdateUser(user);
                    //会员登录日志
                    UserManager.AddLogClient(user.UserName);

                    //发送游戏帐号开通信息到后台

                    Boolean isOk = Getpwds(Password, "1");
                }
            }
            if (reval)
            {
                //当注册成功时,发送邮件。
                try
                {
                    string isok = SendEmail2(Email, UserName, Name);
                    if (isok != "ok")
                    {
                        return("1000");
                    }
                    //else return "ok";
                    return("ok");
                }
                catch (Exception)
                {
                    return("8008");
                }
            }
            else
            {
                return("err");
            }
        }
        public int UptAgent(Model.Agent a)
        {
            string sql = $"update  Agent set values (null,'{a.AgentName}', '{a.Icon}', '{a.BCImg}', '{a.BackgroudColor}', '{a.Fans}', {a.AgentState}, {a.One}, {a.Two}, {a.Three},'{a.Explaina}')";

            return(DapperHelper.Execute(sql));
        }
Beispiel #21
0
 void _new_card(object param)
 {
     is_redacting = false;
     agent        = new Model.Agent();
 }
Beispiel #22
0
 void Refresh(object param)
 {
     agent  = new Model.Agent();
     _units = ((App)App.Current).all_data.get_units();
 }