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


C# City.SetCenterID方法代码示例

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


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

示例1: ButtonSend_Click

    protected void ButtonSend_Click(object sender, EventArgs e)
    {
        if (this.CheckBoxAgreement.Checked)
        {
            string ID = this.TextBoxID.Text;
            string userName = this.TextBoxUserName.Text;
            string pass = this.TextBoxPass.Text;
            string passVerification = this.TextBoxPass2.Text;
            string email = this.TextBoxEmail.Text;
            string phone = this.DropDownList1.SelectedItem + this.TextBoxPhone.Text;
            string city = this.DropDownListCities.Text;
            string address = this.TextBoxAddress.Text;
            int cityID = Convert.ToInt32(this.DropDownListCities.SelectedValue);
            string fName = this.TextBoxFirstName.Text;
            string lName = this.TextBoxLastName.Text;

            City userCity = new City();
            userCity.SetCityID(cityID);
            userCity.SetCityName(city);
            CityService cs = new CityService();
            userCity.SetCenterID(cs.GetCenterIDByCityID(cityID));

            OleDbConnection myCon = new OleDbConnection(Connect.getConnectionString());
            OleDbCommand cmd = new OleDbCommand("SELECT * FROM Clients WHERE UserName='" + userName + "';", myCon);
            myCon.Open();
            if (cmd.ExecuteScalar() == null)
            {
                string sqlCommand = "INSERT INTO Clients (CityID,UserName,Pass,Phone,Email,Address,FirstName,LastName,ID,Activity) VALUES(" + cityID + ",'" + userName + "','" + pass + "','" + phone + "','" + email + "','" + address + "','" + fName + "','" + lName + "','"+ID+"','UnActive');";
                cmd.CommandText = sqlCommand;
                cmd.ExecuteNonQuery();
            }
            myCon.Close();
        }
        else
        {
            Response.Write("<script type=\"text/javascript\">alert('אנא אשר את תנאי האתר')</script>");
        }
    }
开发者ID:N1vS,项目名称:School-Project,代码行数:38,代码来源:Register.aspx.cs


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