Ejemplo n.º 1
0
        /// <summary>
        /// 判断用户是否存在
        /// </summary>
        /// <param name="username">用户名</param>
        /// <returns></returns>
        public bool SelectUser(string username)
        {
            DAL.Users user   = new DAL.Users();
            bool      result = user.SelectUser(username);

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 用户登录,http://mobile.huobi3j.com/user/login
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">密码(不加密)</param>
        /// <returns></returns>
        public ActionResult Login(string username,string password)
        {
            if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
            {
                return GetJson(new JsonResponse { status = false, message = "参数有误!" });
            }

            string pwdMd5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "md5");
            DAL.Users dal = new DAL.Users();
            Model.Users user = null;
            if (Regex.IsMatch(username, @"^\d+$"))//通讯号码
            {
                user = dal.GetEntity(new string[] { "CheckState", "UIN", "LoginPwd" }, 1, username, pwdMd5);
            }
            else if (Regex.IsMatch(username, Validator.EmailPattern))
            {
                user = dal.GetEntity(new string[] { "CheckState", "Email", "LoginPwd" }, 1, username, pwdMd5);
            }
            else if (Regex.IsMatch(username, @"\w+") /*&& Regex.IsMatch(loginKey, @"\d+")*/ )//自定义登陆帐号
            {
                user = dal.GetEntity(new string[] { "CheckState", "LoginName", "LoginPwd" }, 1, username, pwdMd5);
            }
            else
            {
                return null;
            }

            if (user == null)
            {
                return GetJson(new JsonResponse { status = false, message = "用户不存在!" });
            }

            return GetJson(new { status = true, data = user });
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 用户删除操作
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnUdelete2_Click(object sender, EventArgs e)
 {
     BLL.UsersBLL objUB = new BLL.UsersBLL();
     if (dataGridView2.SelectedRows.Count > 0)
     {
         if (MessageBox.Show("确认要删除该行数据吗?", "删除确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             int rst = dataGridView2.SelectedRows.Count;
             foreach (DataGridViewRow dr in dataGridView2.SelectedRows)
             {
                 DAL.Users objU = new DAL.Users();
                 objU.uid = (int)dr.Cells["uid"].Value;
                 rst     -= objUB.Delete(objU);
             }
             if (rst == 0)
             {
                 MessageBox.Show("删除成功");
                 BLL.UsersBLL objU = new BLL.UsersBLL();
                 dataGridView2.DataSource = objU.GetList(x => true);
                 dataGridView2.Refresh();
             }
             else
             {
                 MessageBox.Show("删除失败");
             }
         }
     }
     else
     {
         MessageBox.Show("请先选中要删除的数据");
     }
 }
Ejemplo n.º 4
0
        private void LoadData()
        {
            var savePath = @"d:\";
            var userDAL = new DAL.Users();
            var poiBLL = new PoiBLL();
            var users = userDAL.Select("RegTime > '2005-05-30'", "");
            if (!Directory.Exists(Path.Combine(savePath, "poi")))
                Directory.CreateDirectory(Path.Combine(savePath, "poi"));
            foreach (DataRow row in users.Rows)
            {
                var userid = row["id"].ToInt();
                if (userid <= 0) continue;
                var index = 0;

                while (true)
                {
                    var searchResults = GetGeoSearchResult(userid, index);
                    if (searchResults.IsNull() || searchResults.size <= 0) break;

                    //File.AppendAllText(Path.Combine(savePath, "poi", string.Format("{0}_{1}.txt", userid, index)), JsonConvert.SerializeObject(searchResults));
                    File.WriteAllText(Path.Combine(savePath, "poi", string.Format("{0}_{1}.txt", userid, index)), JsonConvert.SerializeObject(searchResults));
                    index++;

                    Thread.Sleep(100);
                }
            }
        }
Ejemplo n.º 5
0
 public static UserDto ToDtoUser(DAL.Users e)
 {
     Common.DTO.UserDto ev = new Common.DTO.UserDto();
     ev.user_email    = e.user_email;
     ev.user_password = e.user_password;
     return(ev);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 删除子用户
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        public Task <IApiResult> DelUserInfo(P_Users.P_DelUser arg)
        {
            return(Task.Run(() => {
                IApiResult ar = new IApiResult();
                try
                {
                    using (DAL.CarRentEntities db = new DAL.CarRentEntities())
                    {
                        DAL.Users us = new DAL.Users();
                        var res = db.Users.First(u => u.UserID == arg.userid);
                        res.Deleted = true;
                        int count = db.SaveChanges();
                        ar.message = $"delete{count}a data success!";
                        ar.result = new { url = "" };
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(this, ex);
                    ar.code = StatusCode.error;
                    ar.message = ex.Message;
                }

                return ar;
            }));
        }
Ejemplo n.º 7
0
        public static string GetNowUserType()
        {
            string ID = AuthenHelper.GetLoginUserData();

            DBA.DAL.Users dale = new DAL.Users();
            return(dale.GetModel(Convert.ToInt32(ID)).Usertype.Trim());
        }
Ejemplo n.º 8
0
 public static DAL.Users ToDalUser(UserDto e)
 {
     DAL.Users ev = new DAL.Users();
     ev.user_email    = e.user_email;
     ev.user_password = e.user_password;
     return(ev);
 }
Ejemplo n.º 9
0
        private void LoadUsers()
        {
            try
            {
                DAL.Users dalUser = new DAL.Users();
                dalUser.connectionstring = objDAL.connectionstring;


                DataTable dt = dalUser.getRecord(" AND Isnull(IsSuperAdmin,0)=0");

                DataRow dr = dt.NewRow();

                dr["UserID"]   = "0";
                dr["UserName"] = "******";

                dt.Rows.Add(dr);

                if (dt.Rows.Count > 0)
                {
                    cboUsers.DisplayMember = "UserName";
                    cboUsers.ValueMember   = "UserID";
                    cboUsers.DataSource    = dt;
                }

                cboUsers.SelectedValue = 0;
                cboUsers.SelectedText  = "ALL";


                //cboUsers.SelectedIndex = -1;
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message.ToString(), "Error");
            }
        }
Ejemplo n.º 10
0
        //记录注销日志
        protected void HeadLoginStatus_LoggingOut(object sender, LoginCancelEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                DAL.Users userInfo = Session["UserInfo"] as DAL.Users;
                string    userID   = userInfo == null ? "" : (userInfo.UserId == null ? "" : userInfo.UserId);

                Utility.LogHelper.WriteLog(Utility.LogHelper.LogLevel.Info, "用户[" + userID + "]退出系统!");
            }
        }
Ejemplo n.º 11
0
        protected void NavigationMenu_DataBound(object sender, EventArgs e)
        {
            if (Session["UserInfo"] == null)
            {
                return;
            }

            if (this.IsPostBack)
            {
                return;
            }

            DAL.Users userInfo = Session["UserInfo"] as DAL.Users;
            string    userID   = userInfo == null ? "" : userInfo.UserId;

            //获取sitemap中的所有节点
            SiteMapNodeCollection list = SiteMap.RootNode.GetAllNodes();

            //获取该用户下拥有的所有角色
            string[] roleNameList = Roles.GetRolesForUser(userID);
            //该用户各个角色拥有的菜单功能项
            List <string[]> menuItemTitleHas = new List <string[]>();

            //取出拥有的菜单后,将List中各个String[]取并集,显示给页面
            foreach (string role in roleNameList)
            {
                List <string> strTheRoleHasMenu = new List <string>();
                GetItem(NavigationMenu, list, role, out strTheRoleHasMenu);//遍历每个角色下拥有的菜单项
                if (strTheRoleHasMenu.Count > 0)
                {
                    menuItemTitleHas.Add(strTheRoleHasMenu.ToArray());
                }
            }

            //合并权限菜单并集
            List <string> theUserHasMenu = new List <string>();

            foreach (string[] strList in menuItemTitleHas)
            {
                foreach (string str in strList)
                {
                    if (theUserHasMenu.Contains(str) == false)
                    {
                        theUserHasMenu.Add(str);
                    }
                }
            }


            //设置菜单显示
            SetMenuItemShow(ref this.NavigationMenu, theUserHasMenu);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            int er = 0;

            ep.Clear();
            if (txtName.Text == "")
            {
                er++;
                ep.SetError(txtName, "Name is requird");
            }
            if (txtEmail.Text == "")
            {
                er++;
                ep.SetError(txtEmail, "Email  Required");
            }
            if (txtPassword.Text == "")
            {
                er++;
                ep.SetError(txtPassword, "Required");
            }


            if (er == 0)
            {
                DAL.Users usr = new DAL.Users();
                usr.Name  = txtName.Text;
                usr.Email = txtEmail.Text;
                //usr.Password = Cryptography.Encryption.Encrypt(txtPassword.Text, "1234");
                usr.Password = txtPassword.Text;
                usr.Type     = comboBox1.Text;
                usr.CreateIP = "127.0.0.1";
                // usr.CreateDate = DateTime.Now;

                if (usr.Insert())
                {
                    MessageBox.Show("Data Saved");
                    txtName.Text            = "";
                    txtEmail.Text           = "";
                    txtPassword.Text        = "";
                    comboBox1.SelectedIndex = 0;
                    txtName.Focus();
                }
                else
                {
                    MessageBox.Show(usr.Error);
                }
            }
        }
Ejemplo n.º 13
0
        public bool LoginCheck()
        {
            Users usr = new DAL.Users();

            usr.Email    = Email;
            usr.Password = Password;
            if (usr.SelectByOthers())
            {
                this.Email   = usr.Email;
                this.LoginId = usr.Id;
                this.Name    = usr.Name;
                this.Type    = usr.Type;
                return(true);
            }
            return(false);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 根据模型数据,完成表格的插入
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        public int Add(DAL.Users Data)
        {
            try
            {
                //向数据上下文数据表中增加一个 模型对象(实体)
                objDAL.Users.InsertOnSubmit(Data);
                //更新数据上下文改变到数据库
                objDAL.SubmitChanges();
                return(1);
            }
            catch (Exception)
            {
                return(0);
            }

            //return objDAL.Add(Data);
        }
Ejemplo n.º 15
0
        private void frmUserUpdate_Load(object sender, EventArgs e)
        {
            DAL.Users objU = objUB.GetModel(ID);

            txtId.Text     = (objU.uid).ToString();
            txtName.Text   = objU.uname;
            txtPwd.Text    = objU.upwd;
            txtSchool.Text = objU.uschool;
            if (objU.usex == '男'.ToString())
            {
                rbMale.Checked = true;
            }
            else
            {
                rbFemale.Checked = true;
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 根据模型中的uid删除指定行
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 public int Delete(DAL.Users Data)
 {
     try
     {
         //找到数据上下文中,满足条件的记录
         DAL.Users objT = objDAL.Users.First(x => x.uid == Data.uid);
         //删除该记录
         objDAL.Users.DeleteOnSubmit(objT);
         //更新数据上下文改变到数据库
         objDAL.SubmitChanges();
         return(1);
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 17
0
        private void btnUmodify_Click(object sender, EventArgs e)
        {
            DAL.Users objU = new DAL.Users();
            objU.uid     = int.Parse(txtId.Text);
            objU.uname   = txtName.Text;
            objU.upwd    = txtPwd.Text;
            objU.uschool = txtSchool.Text;
            objU.usex    = (rbMale.Checked ? '男' : '女').ToString();

            if (objUB.Update(objU) > 0)
            {
                MessageBox.Show("修改成功");
            }
            else
            {
                MessageBox.Show("修改失败");
            }
        }
Ejemplo n.º 18
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            long uin = ADeeWu.HuoBi3J.Libary.Utility.GetInt(this.txtUIN.Text, 0);
            string notes = ADeeWu.HuoBi3J.Libary.WebUtility.GetTextAreaContent(this.txtNotes.Text).Trim();
            int coins = ADeeWu.HuoBi3J.Libary.Utility.GetInt(this.txtMoney.Text, 0);

            if (uin <= 0)
            {
                ADeeWu.HuoBi3J.Libary.WebUtility.ShowMsg("UIN号码必须为纯数字!");
                return;
            }

            if (coins <= 0)
            {
                ADeeWu.HuoBi3J.Libary.WebUtility.ShowMsg("请填写正确货币数量!");
                return;
            }

            Model.Users user = new DAL.Users().GetEntity(string.Format("uin = '{0}'", uin));
            if (user == null || user.ID == 0)
            {
                WebUtility.ShowMsg("不存在此UIN号码!");
                return;
            }

            db.Parameters.Append("@UserID", user.ID);
            db.Parameters.Append("@Coins", coins);
            db.Parameters.Append("@IsUseCoin", false);
            db.Parameters.Append("@Notes", notes);
            db.Parameters.Append("@ErrorMessage", "", ParameterDirection.Output, DbType.String).Size = 1000;

            db.AutoClearParameters = false;
            if (ADeeWu.HuoBi3J.Libary.Utility.GetInt(db.RunProc("SP_User_DoCoinsTrans"), -1) == 0)
            {
                ADeeWu.HuoBi3J.Libary.WebUtility.ShowPageSelector(this, "操作成功!选择\"是\"继续操作", "Add.aspx", "list.aspx");
            }
            else
            {
                ADeeWu.HuoBi3J.Libary.WebUtility.ShowMsg("操作失败!错误原因:\r\n" + db.Parameters["@ErrorMessage"].Value.ToString());
            }
            db.Parameters.Clear();
            db.AutoClearParameters = true;
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 根据uid指定要删除的行,其余字段用于表示要修改的数据值
 /// </summary>
 /// <param name="Data"></param>
 /// <returns></returns>
 public int Update(DAL.Users Data)
 {
     try
     {
         //找到数据上下文中,满足条件的记录
         DAL.Users objT = objDAL.Users.First(x => x.uid == Data.uid);
         //修改数据记录
         objT.uname   = Data.uname;
         objT.usex    = Data.usex;
         objT.upwd    = Data.upwd;
         objT.uschool = Data.uschool;
         //更新数据上下文改变到数据库
         objDAL.SubmitChanges();
         return(1);
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 添加子用户
 /// </summary>
 /// <param name="arg"></param>
 /// <returns></returns>
 public Task <IApiResult> AddUsers(P_Users.P_AddUsers arg)
 {
     return(Task.Run(() =>
     {
         IApiResult ar = new IApiResult();
         try
         {
             using (DAL.CarRentEntities db = new DAL.CarRentEntities())
             {
                 DAL.Users us = new DAL.Users();
                 us.UserName = arg.username;
                 us.LoginName = arg.account;
                 us.FirstName = arg.contact;
                 us.CellPhone = arg.phone;
                 us.Password = "******";
                 us.Address1 = arg.address;
                 us.Deleted = false;
                 us.PrimaryEmail = arg.email;
                 us.Created = DateTime.Now;
                 us.UpdateTime = DateTime.Now;
                 us.AllDeviceCount = 0;
                 us.ActivationCount = arg.price * 100;
                 us.MoneyCount = 0;
                 us.ParentID = 1;
                 us.SuperAdmin = 0;
                 db.Users.Add(us);
                 db.SaveChanges();
                 ar.message = "Add successfu!";
                 ar.result = new { url = "reload" };
             }
         }
         catch (Exception ex)
         {
             Log.Error(this, ex);
             ar.code = StatusCode.error;
             ar.message = ex.Message;
         }
         return ar;
     }));
 }
Ejemplo n.º 21
0
        /// <summary>
        /// 注册用户信息
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>

        public async Task <IApiResult> Register(Mgoo.CarRent.Models.Parameter.PRegister arg)
        {
            return(await Task.Run(() =>
            {
                var ar = new IApiResult();
                try
                {
                    DAL.Users user = new DAL.Users();
                    user.Created = DateTime.Now;
                    user.UpdateTime = DateTime.Now;
                    user.UserName = arg.username;
                    user.Password = arg.password;
                    user.LoginName = arg.phone;
                    user.UserType = 2;
                    user.ParentID = 1;
                    user.CellPhone = arg.phone;
                    user.TimeZone = "China Standard Time";
                    user.Deleted = false;
                    user.SuperAdmin = 0;
                    user.Gender = false;
                    user.MoneyCount = 0;
                    using (DAL.CarRentEntities db = new DAL.CarRentEntities())
                    {
                        db.Users.Add(user);
                        db.SaveChanges();
                    }
                    ar.message = "success!";
                }
                catch (Exception ex)
                {
                    Log.Error(this, ex);
                    ar.message = ex.Message;
                    ar.code = StatusCode.error;
                }
                return ar;
            }));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 添加新用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            BLL.UsersBLL objRB = new BLL.UsersBLL();

            DAL.Users objR = new DAL.Users();
            objR.uschool = txtSchool.Text;
            objR.uid     = Convert.ToInt32(txtId.Text);
            objR.uname   = txtName.Text;
            objR.upwd    = txtPwd.Text;
            objR.usex    = (rbMale.Checked ? '男' : '女').ToString();

            if (objRB.Add(objR) > 0)
            {
                MessageBox.Show("用户注册成功");
            }
            else
            {
                MessageBox.Show("添加失败,用户ID已存在,已经返回主窗体并请重新进入");
                frmMain frmMain = new frmMain();
                this.Hide();
                frmMain.ShowDialog();
                Application.ExitThread();
            }
        }
Ejemplo n.º 23
0
        private void DeleteData()
        {
            var userDAL = new DAL.Users();
            var poiBLL = new PoiBLL();
            var users = userDAL.Select("RegTime > '2014-05-30'", "");
            foreach (DataRow row in users.Rows)
            {
                var userid = row["id"].ToInt();
                if (userid <= 0) continue;

                while (true)
                {
                    var searchResults = GetGeoSearchResult(userid, 0);
                    if (searchResults.IsNull() || searchResults.size <= 0) break;

                    searchResults.pois.ForEach(poi =>
                    {
                        poiBLL.Delete(new List<string> { poi.id }, ADee.Project.LBS.Common.ConfigHelper.GeoProductTableID);
                    });

                    Thread.Sleep(10);
                }
            }
        }
Ejemplo n.º 24
0
 public Users(DbContext context)
 {
     _dalUsers = new DAL.Users(context);
 }
Ejemplo n.º 25
0
 public void AddNewUser(DAL.Users user)
 {
     BLL.UserLogic.AddNewUser(user);
 }
Ejemplo n.º 26
0
        public async Task<ActionResult> CreateAdmin(CreateAdminModel model)
        {
            if(adminMgt==null)
            {
                adminMgt = new AdministratorManagement(User.Identity.GetUserId<int>());
            }
            if (!adminMgt.CurrentLoginUser.IsSuperAdmin && !adminMgt.CurrentLoginUser.IsWebMaster)
            {
                ViewBag.Message = "只有超级管理员和站长才能新建管理员";
                return View("Error");
            }
            if (ModelState.IsValid)
            {
                KMBit.DAL.Users newUser = new DAL.Users() { Enabled = true, Email = model.Email, Name = model.Name, PasswordHash = "123456789" };
                newUser = await adminMgt.CreateAdministrator(newUser);
                if(newUser.Id>0)
                {
                    return Redirect("/Admin/Administrators");
                }
            }

            return View(model);
        }
Ejemplo n.º 27
0
 public Users()
 {
     dal = new DAL.Users("mb_");
 }
Ejemplo n.º 28
0
        public async Task<ActionResult> UpdateAgency(CreateAgencyModel model)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            bool result = false;
            try
            {
                if (ModelState.IsValid)
                {
                    KMBit.DAL.Users dbUser = new DAL.Users();
                    dbUser.Address = model.Address;
                    dbUser.City_id = model.City ;
                    dbUser.Province_id = model.Province ;
                    dbUser.Description = model.Description;
                    dbUser.Enabled = model.Enabled;
                    dbUser.Pay_type = model.PayType;
                    dbUser.Type = model.Type;
                    dbUser.PhoneNumber = model.Phone;

                    if (model.Id > 0)
                    {
                        dbUser.Id = model.Id;
                        dbUser.Update_time = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                        result = agentAdminMgt.UpdateAgency(dbUser);
                    }
                    else
                    {
                        dbUser.Email = model.Email;
                        dbUser.PasswordHash = "111111";
                        dbUser.Name = model.Name;
                        dbUser.CreatedBy = User.Identity.GetUserId<int>();
                        dbUser.Regtime = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                        result = await agentAdminMgt.CreateAgency(dbUser);
                    }

                    if(result)
                    {
                        return RedirectToAction("Agencies");
                    }else
                    {
                        ViewBag.Exception = new KMBitException("创建失败");
                    }
                }
            }
            catch (KMBitException ex)
            {
                ViewBag.Exception = ex;
            }

            List<KMBit.DAL.User_type> userTypes = agentAdminMgt.GetUserTypes();
            List<KMBit.DAL.Area> provinces = agentAdminMgt.GetAreas(0);
            List<KMBit.DAL.PayType> payTypes = agentAdminMgt.GetPayTypes();

            ViewBag.UserTypes = new SelectList(userTypes, "Id", "Name");
            ViewBag.PayTypes = new SelectList(payTypes, "Id", "Name");
            ViewBag.Provinces = new SelectList(provinces, "Id", "Name");
            if (model.Province >0)
            {
                ViewBag.Cities = new SelectList(agentAdminMgt.GetAreas((int)model.Province), "Id", "Name");
            }
            else
            {
                ViewBag.Cities = new SelectList(new List<KMBit.DAL.Area>(), "Id", "Name");
            }

            return View("CreateAgency",model);
        }
Ejemplo n.º 29
0
 /// <summary>
 /// 判断用户是否存在
 /// </summary>
 /// <param name="username">用户名</param>
 /// <returns></returns>
 public bool JudgePassword(Entity.Users user)
 {
     DAL.Users users = new DAL.Users();
     return(users.JudgePassword(user));
 }
 private void btnSearch_Click(object sender, EventArgs e)
 {
     DAL.Users usr = new DAL.Users();
     grvData.DataSource = usr.Select().Tables[0];
 }
Ejemplo n.º 31
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtName.Text))
            {
                WebUtility.ShowMsg("联系人不能为空!");
                return;
            }

            if (!Utility.IsNumeric(txtPhone.Text))
            {
                WebUtility.ShowMsg("联系方式只能为数字!");
                return;
            }

            if (string.IsNullOrWhiteSpace(txtCompanyName.Text))
            {
                WebUtility.ShowMsg("公司名称不能为空!");
                return;
            }

            if (string.IsNullOrWhiteSpace(txtCompanyAddress.Text))
            {
                WebUtility.ShowMsg("公司地址不能为空!");
                return;
            }

            if (string.IsNullOrWhiteSpace(hfPosition.Value))
            {
                WebUtility.ShowMsg("请在地图中选择准确位置!");
                return;
            }

            bool isAdd = false;
            Model.Key_CircleSaleMan entApplication = circleSaleMan.GetEntity(new string[] { "UserID" }, this.LoginUser.UserID);
            if (entApplication == null)
            {
                entApplication = new ADeeWu.HuoBi3J.Model.Key_CircleSaleMan();
                entApplication.CreateTime = DateTime.Now;
                entApplication.ModifyTime = DateTime.Now;
                isAdd = true;
            }

            entApplication.CheckState = (int)UserSessionCheckState.NotAudit;
            entApplication.ModifyTime = DateTime.Now;
            entApplication.Phone = txtPhone.Text;
            entApplication.UserID = this.LoginUser.UserID;
            entApplication.Memo = txtMemo.Value;
            entApplication.QQ = txtQQ.Text;
            entApplication.CompanyAddress = txtCompanyAddress.Text;
            entApplication.CompanyName = txtCompanyName.Text;
            entApplication.Job = txtJob.Text;
            entApplication.Name = txtName.Text;
            var position = hfPosition.Value.Split(new char[] { '|' });
            entApplication.PositionX = Utility.GetFloat(position[0], 0);
            entApplication.PositionY = Utility.GetFloat(position[1], 0);

            if (isAdd)
            {
                var user = new DAL.Users().GetEntity(LoginUser.UserID);
                if (user.Money <= 50)
                {
                    WebUtility.ShowMsg(string.Format("你的余额为:{0},申请货比三家业务员余额大于50元!", user.Money));
                    return;
                }

                if (circleSaleMan.Add(entApplication) > 0)
                {
                    WebUtility.ShowMsg(this, "提交申请成功!我们将尽快为您处理!");
                }
                else
                {
                    WebUtility.ShowMsg(this, "操作失败!请与我们联系!");
                }
            }
            else
            {
                if (circleSaleMan.Update(entApplication) > 0)
                {
                    WebUtility.ShowMsg(this, "提交申请成功!我们将尽快为您处理!");
                }
                else
                {
                    WebUtility.ShowMsg(this, "操作失败!请与我们联系!");
                }
            }
        }
Ejemplo n.º 32
0
 //בעת רישום הוספת המשתמש לטבלה
 public static void AddNewUser(DAL.Users user)
 {
     db.Users.Add(user);
     db.SaveChanges();
 }