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


C# Item.Show方法代码示例

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


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

示例1: Create_Click

        private void Create_Click(object sender, RoutedEventArgs e)
        {
            if (!String.IsNullOrEmpty(CatagoryIdTxt.Text) && !String.IsNullOrEmpty(FoodNameTxt.Text) && !String.IsNullOrEmpty(PriceTxt.Text))
            {
                int sr = 0;
                SqlConnection sqlConFill = new SqlConnection(conn);
                SqlCommand cmdFill = new SqlCommand();
                cmdFill.CommandText = "SELECT MAX(Food_Id) FROM Foods";
                cmdFill.Connection = sqlConFill;
                sqlConFill.Open();
                SqlDataReader rd1 = cmdFill.ExecuteReader();
                if (rd1.HasRows)
                {
                    rd1.Read();
                    var outputParam = rd1[0];
                    if (!(outputParam is DBNull))
                    {
                        sr = Convert.ToInt32(rd1[0]);
                    }
                    else
                    {
                        sr = 0;
                    }
                    rd1.Close();
                }
                sqlConFill.Close();
                sr = sr + 1;

                cmdFill.CommandText = "SELECT Food_Id FROM Foods WHERE [email protected] AND [email protected]";
                cmdFill.Parameters.AddWithValue("@Id", CatagoryIdTxt.Text);
                cmdFill.Parameters.AddWithValue("@Name", FoodNameTxt.Text);
                cmdFill.Connection = sqlConFill;
                sqlConFill.Open();
                SqlDataReader rd = cmdFill.ExecuteReader();
                String cat = "";
                if (rd.HasRows)
                {
                    rd.Read();
                    cat = cat + rd[0].ToString();
                    rd.Close();
                    sqlConFill.Close();
                    MessageBox.Show("Item Already Exist at Id " + cat);
                }
                else
                {
                    sqlConFill.Close();
                    cmdFill.CommandText = "SELECT Cat_Name FROM catagory_list WHERE [email protected]";
                    cmdFill.Parameters.AddWithValue("@catagoryId4", CatagoryIdTxt.Text);
                    cmdFill.Connection = sqlConFill;
                    sqlConFill.Open();
                    rd = cmdFill.ExecuteReader();
                    if (rd.HasRows)
                    {
                        rd.Read();
                        cat = cat + rd[0].ToString();
                        rd.Close();
                    }
                    sqlConFill.Close();
                    sqlConFill.Close();
                    sqlConFill = new SqlConnection(conn);
                    cmdFill = new SqlCommand();
                    cmdFill.CommandText = "INSERT INTO Foods(Food_Id,Catagory_Id,CatagoryName,FoodName,Price,Description)VALUES (@foodId,@Catagory_Id,@CatagoryName,@FoodName,@Price,@Description)";
                    cmdFill.Parameters.AddWithValue("@foodId", sr.ToString());
                    cmdFill.Parameters.AddWithValue("@Catagory_Id", CatagoryIdTxt.Text);
                    cmdFill.Parameters.AddWithValue("@CatagoryName", cat);
                    cmdFill.Parameters.AddWithValue("@FoodName", FoodNameTxt.Text);
                    cmdFill.Parameters.AddWithValue("@Price", PriceTxt.Text);
                    cmdFill.Parameters.AddWithValue("@Description", DescriptionTxt.Text);
                    cmdFill.Connection = sqlConFill;
                    sqlConFill.Open();
                    cmdFill.ExecuteNonQuery();
                    sqlConFill.Close();
                    Item win2 = new Item();
                    win2.Show();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Food Name, Catagory Id or Price Cann't be Empty");
            }
        }
开发者ID:anirban93,项目名称:taxo,代码行数:82,代码来源:Item.xaml.cs

示例2: Delete_Click

        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            if (!String.IsNullOrEmpty(FoodIdTxt.Text))
            {
                SqlConnection sqlConFill = new SqlConnection(conn);
                SqlCommand cmdFill = new SqlCommand();
                cmdFill.CommandText = "DELETE FROM Foods WHERE [email protected]_Id";
                cmdFill.Parameters.AddWithValue("@Food_Id", FoodIdTxt.Text);
                cmdFill.Connection = sqlConFill;
                sqlConFill.Open();
                cmdFill.ExecuteNonQuery();
                sqlConFill.Close();

                cmdFill.CommandText = "UPDATE Foods SET Food_Id=Food_Id-1 WHERE Food_Id>@Food_Id2";
                cmdFill.Parameters.AddWithValue("@Food_Id2", FoodIdTxt.Text);
                cmdFill.Connection = sqlConFill;
                sqlConFill.Open();
                cmdFill.ExecuteNonQuery();
                sqlConFill.Close();
                Item win2 = new Item();
                win2.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Food Id Cann't be Empty");
            }
        }
开发者ID:anirban93,项目名称:taxo,代码行数:28,代码来源:Item.xaml.cs

示例3: Update_Click

        private void Update_Click(object sender, RoutedEventArgs e)
        {
            if (!String.IsNullOrEmpty(FoodIdTxt.Text) && !String.IsNullOrEmpty(CatagoryIdTxt.Text) && !String.IsNullOrEmpty(FoodNameTxt.Text) && !String.IsNullOrEmpty(PriceTxt.Text))
            {
                SqlConnection sqlConFill = new SqlConnection(conn);
                SqlCommand cmdFill = new SqlCommand();
                sqlConFill = new SqlConnection(conn);
                cmdFill = new SqlCommand();
                cmdFill.CommandText = "SELECT Cat_Name FROM catagory_list WHERE [email protected]";
                cmdFill.Parameters.AddWithValue("@id", CatagoryIdTxt.Text);
                cmdFill.Connection = sqlConFill;
                sqlConFill.Open();
                SqlDataReader rd = cmdFill.ExecuteReader();

                if (rd.HasRows)
                {
                    rd.Read();
                    cat = cat + rd[0].ToString();
                    rd.Close();
                }
                sqlConFill.Close();
                sqlConFill.Close();
                cmdFill.CommandText = "UPDATE Foods SET [email protected]_Id,[email protected],[email protected],[email protected],[email protected] WHERE [email protected]_Id";
                cmdFill.Parameters.AddWithValue("@Food_Id", FoodIdTxt.Text);
                cmdFill.Parameters.AddWithValue("@Catagory_Id", CatagoryIdTxt.Text);
                cmdFill.Parameters.AddWithValue("@CatagoryName", cat);
                cmdFill.Parameters.AddWithValue("@FoodName", FoodNameTxt.Text);
                cmdFill.Parameters.AddWithValue("@Price", PriceTxt.Text);
                cmdFill.Parameters.AddWithValue("@Description", DescriptionTxt.Text);
                cmdFill.Connection = sqlConFill;
                sqlConFill.Open();
                cmdFill.ExecuteNonQuery();
                sqlConFill.Close();
                Item win2 = new Item();
                win2.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Food Name, Catagory Id or Price Cann't be Empty");
            }
        }
开发者ID:anirban93,项目名称:taxo,代码行数:42,代码来源:Item.xaml.cs

示例4: items_Click

 private void items_Click(object sender, RoutedEventArgs e)
 {
     Item win2 = new Item();
     win2.Show();
     this.Close();
 }
开发者ID:anirban93,项目名称:taxo,代码行数:6,代码来源:Manager.xaml.cs


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