当前位置: 首页>>代码示例>>C#>>正文


C# User.InsertNewUser方法代码示例

本文整理汇总了C#中User.InsertNewUser方法的典型用法代码示例。如果您正苦于以下问题:C# User.InsertNewUser方法的具体用法?C# User.InsertNewUser怎么用?C# User.InsertNewUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User的用法示例。


在下文中一共展示了User.InsertNewUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateUserButton_Click

    protected void CreateUserButton_Click(object sender, EventArgs e)
    {
        User U1 = new User();
        U1.UserName = UserName.Text;
        U1.UserPassword = Password.Text;
        U1.Fname = FirstName.Text;
        U1.Lname = LastName.Text;
        U1.Age = int.Parse(Age.Text);
        U1.City = City.Text;
        U1.Email = Email.Text;

        if (imageFileUp.FileName != "")
        {
            //save pic
            string path2 = Server.MapPath("." + "/Images/");
            string fname2 = path2 + imageFileUp.FileName;
            imageFileUp.SaveAs(fname2);
            U1.ImageUrl = "Images/" + imageFileUp.FileName;
        }

        int numEfect = U1.InsertNewUser();
        if (numEfect == 0)
        {
            MessageBox.Show("The Email is already taken ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
        }
        else
        {
            MessageBox.Show("the User was added Successfully", "Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Response.Redirect("Login.aspx");
        }
    }
开发者ID:nategot,项目名称:Benny,代码行数:31,代码来源:RegisterNewUser.aspx.cs

示例2: Adduser

    public int Adduser(string UserName, string Password, string FirstName, string LastName, int Age, string City, string Email, string imageUrl)
    {
        User U1 = new User();
        U1.UserName = UserName;
        U1.UserPassword = Password;
        U1.Fname = FirstName;
        U1.Lname = LastName;
        U1.Age = Age;
        U1.City = City;
        if (Email=="undefined")
        {
            Email = FirstName + LastName + "[email protected]";
        }
        U1.Email = Email;
        U1.ImageUrl = imageUrl;

        int numEfect = U1.InsertNewUser();
        DataTable dt = U1.CheckPass();
        if (dt.Rows.Count != 0)
        {
            if (dt.Rows[0]["UserPassword"].ToString() == U1.UserPassword)
            {
                HttpContext.Current.Session["Fname"] = dt.Rows[0]["Fname"].ToString();
                HttpContext.Current.Session["UserDeatail"] = dt;
                HttpContext.Current.Session["UserId"] = dt.Rows[0]["UserId"].ToString();
            }
        }
        return numEfect;
    }
开发者ID:nategot,项目名称:Benny,代码行数:29,代码来源:WebService.cs

示例3: Unnamed_Click

        protected void Unnamed_Click(object sender, EventArgs e)
        {
            User u = new User();
            string firstName = txtFirstName.Text;
            string surname = Surname.Text;
            string email = EmpEmailAddress.Text;
            string contactNumber = EmpContactNumber.Text;
            string address = PhysicalAddress.Text;
            string password = Password.Text;
            //Automatically assign as Client because a Dealer/Employee is added by a manager
            int securityRoleNumber = 2;
            int cityNumber = Convert.ToInt32(CityDDL.SelectedIndex)+1;

            string date = default_datetimepickers.Text;

            if (String.IsNullOrEmpty(date))
            {
                date = "10/10/2010";
            }

            string[] words = date.Split('/');

            DateTime birthday = new DateTime(Convert.ToInt32(words[2]), Convert.ToInt32(words[1]), Convert.ToInt32(words[0]));

            string gender = GenderDDL.Text;
            Boolean active = true;
            string idNumber = ID.Text;
            double salary = Convert.ToDouble(EmployeeSalary.Text);
            int typeNumber = Convert.ToInt32(EmployeeTypeDDL.SelectedIndex)+1;

            User newuser = new User(0, firstName, surname, email, contactNumber, address, password, securityRoleNumber, cityNumber, birthday, gender, active);
            asa.Text =  newuser.InsertNewUser(newuser);
            int newUserNumber = 0;
            foreach (string s in newuser.LastUserNumber())
            {
                newUserNumber = Convert.ToInt32(s);
            }
            TweekPerformance_BT.Employee newEmp = new TweekPerformance_BT.Employee();
            newEmp.InsertNewEmployee(newUserNumber, idNumber, salary, 0, typeNumber, true);
        }
开发者ID:Davidsobey,项目名称:Tweek-Performance,代码行数:40,代码来源:Add_Employee.aspx.cs

示例4: AdduserMobile

    public string AdduserMobile(string UserName, string Password, string FirstName, string LastName, int Age, string City, string Email, string imageUrl)
    {
        User U1 = new User();
        U1.UserName = UserName;
        U1.UserPassword = Password;
        U1.Fname = FirstName;
        U1.Lname = LastName;
        U1.Age = Age;
        U1.City = City;
        U1.Email = Email;
        U1.ImageUrl = imageUrl;
        JavaScriptSerializer js = new JavaScriptSerializer();
        string jsonString = js.Serialize("Wrong Email or Password ");

        int numEfect = U1.InsertNewUser();
        DataTable dtt = U1.CheckPass();
        try
        {
            if (dtt.Rows.Count != 0)
            {

                User u = new User();
                u.Fname = dtt.Rows[0]["Fname"].ToString();
                u.Email = dtt.Rows[0]["Email"].ToString();
                u.ImageUrl = dtt.Rows[0]["Picture"].ToString();
                u.UserName = dtt.Rows[0]["UserName"].ToString();
                u.UserId = int.Parse(dtt.Rows[0]["UserId"].ToString());
                jsonString = js.Serialize(u);

            }
        }
        catch (Exception ex)
        {
            jsonString = js.Serialize("Error in: " + ex.Message);
        }
        return jsonString;
    }
开发者ID:nategot,项目名称:Benny,代码行数:37,代码来源:WebService.cs


注:本文中的User.InsertNewUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。