Exemplo n.º 1
0
        /// <summary>
        /// delete
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            string temp = listBox1.SelectedItem.ToString();

            DBUtility.ExecuteSQL($"DELETE FROM STAFF_TYPE where staff_type_name ='{temp}'");
            listBox1.Items.Remove(temp);
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region stock out
            string freeStaff = DBUtility.GetData("  select a.staff_id ,isnull(innumber + outnumber,0) 处理数量 " +
                                                 " from Staff a left join (select Staff_id, isnull(count(*), 0) innumber from stock_in where stock_in_Checked = 0 group by staff_ID) b on a.staff_ID = b.staff_ID " +
                                                 " left join(select Staff_id, count(*) outnumber from Stock_out where stock_out_Checked = 0 group by staff_ID ) c on a.staff_ID = c.staff_ID " +
                                                 "order by 处理数量").Rows[0][0].ToString();
            DBUtility.ExecuteSQL($"insert into stock_out select  right('00000000000000000000'+cast(isnull(max(stock_in_id2),0)+1 as varchar),20),'{freeStaff}','{Customer_ID}',{dateTimePicker1.Value.ToShortDateString()},0,0,0,0 from stock_out   "); // pay price need to modi todo
            #endregion

            #region stock out detail
            string stock_out_id = DBUtility.GetData("select right('00000000000000000000'+cast(max(stock_in_id2) as varchar),20) from stock_out ").Rows[0][0].ToString();
            int    sn           = 1;
            for (int i = 0; i < data.Rows.Count; i++)
            {
                if ((bool)data.Rows[i][0]) // need to stock out
                {
                    DBUtility.ExecuteSQL($"insert into stock_out_detail VALUES('{stock_out_id}','{data.Rows[i][1].ToString()}','{sn++}','{data.Rows[i][4].ToString()}')");
                }
            }
            #endregion
            MessageBox.Show("提交成功");
            this.Close();
            this.Dispose();
        }
Exemplo n.º 3
0
        /// <summary>
        /// mod
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            //获取 combobox 的值
            string warehouse_id = DBUtility.GetData($"select warehouse_ID from dbo.warehouse where warehouse_name = '{comboBox1.SelectedItem.ToString()}'").Rows[0][0].ToString();
            string waretype_id  = DBUtility.GetData($"select waretype_ID from dbo.wareAreatype where waretype_name = '{comboBox2.SelectedItem.ToString()}'").Rows[0][0].ToString();

            DBUtility.ExecuteSQL($"UPDATE [WMS].[dbo].[WareArea] set  Warehouse_ID = '{warehouse_id}', waretype_id = '{waretype_id}',WareArea_Floor = '{textBox2.Text}', WareArea_High = '{textBox3.Text}',WareArea_Wide = '{textBox4.Text}',WareArea_Long = '{textBox5.Text}',WareArea_MaxWeight = '{textBox6.Text}',WareArea_Cost = '{textBox7.Text}',WareArea_NowTem = '{textBox8.Text}',WareArea_NowHum = '{textBox9.Text}' where WareArea_ID = '{textBox1.Text}' ");
            ShowData();
        }
Exemplo n.º 4
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            string Product_Temperature = textBox11.Text.Equals(string.Empty) ? "NULL" : $"'{textBox11.Text}'";
            string Product_humidity    = textBox10.Text.Equals(string.Empty) ? "NULL" : $"'{textBox10.Text}'";

            DBUtility.ExecuteSQL($"UPDATE [WMS].[dbo].[Product] SET Product_Name = '{textBox17.Text}',Product_tally = '{textBox16.Text}',Product_Weight ='{textBox15.Text}',Product_Long ='{textBox14.Text}',Product_Hgih='{textBox13.Text}',Product_Wide = '{textBox12.Text}',Product_Temperature= {Product_Temperature} ,Product_humidity = {Product_humidity}  where Product_ID ='{textBox18.Text}' ");
            data = DBUtility.GetData("SELECT Product_ID 编号,Product_Name 名称,Product_tally 单位 , Product_Weight 重量 , Product_Long 长度 ,Product_Hgih 高度 , Product_Wide 宽度 , Product_Temperature 保存温度 , Product_humidity 保存湿度 FROM [WMS].[dbo].[Product]");
            dataGridView1.DataSource = data;
        }
Exemplo n.º 5
0
        /// <summary>
        /// insert
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            string Product_Temperature = textBox11.Text.Equals(string.Empty)?"NULL": $"'{textBox11.Text}'";
            string Product_humidity    = textBox10.Text.Equals(string.Empty) ? "NULL" : $"'{textBox10.Text}'";

            DBUtility.ExecuteSQL($"INSERT INTO [WMS].[dbo].[Product] select right('00000000000000000000'+cast(max(Product_ID)+1 as varchar),20),'{textBox17.Text}','{textBox16.Text}','{textBox15.Text}','{textBox14.Text}','{textBox13.Text}','{textBox12.Text}',{Product_Temperature},{Product_humidity} from [WMS].[dbo].[Product]");
            data = DBUtility.GetData("SELECT Product_ID 编号,Product_Name 名称,Product_tally 单位 , Product_Weight 重量 , Product_Long 长度 ,Product_Hgih 高度 , Product_Wide 宽度 , Product_Temperature 保存温度 , Product_humidity 保存湿度 FROM [WMS].[dbo].[Product]");
            dataGridView1.DataSource = data;
        }
Exemplo n.º 6
0
        /// <summary>
        /// add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            //获取 combobox 的值
            string warehouse_id = DBUtility.GetData($"select warehouse_ID from dbo.warehouse where warehouse_name = '{comboBox1.SelectedItem.ToString()}'").Rows[0][0].ToString();
            string waretype_id  = DBUtility.GetData($"select waretype_ID from dbo.wareAreatype where waretype_name = '{comboBox2.SelectedItem.ToString()}'").Rows[0][0].ToString();

            DBUtility.ExecuteSQL($"insert into [dbo].[WareArea] select right('00000000000000000000'+cast(max([WareArea_ID])+1 as varchar),10),'{warehouse_id}','{waretype_id}','{textBox2.Text}','{textBox3.Text}','{textBox4.Text}','{textBox5.Text}','{textBox6.Text}','{textBox7.Text}','{textBox8.Text}','{textBox9}',NULL from  [WMS].[dbo].[WareArea] ");
            ShowData();
        }
Exemplo n.º 7
0
        /// <summary>
        /// mod
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            string Waretype_Max_tem = checkBox1.Checked ? $"'{textBox3.Text}'" : "NULL";
            string Waretype_Min_tem = checkBox1.Checked ? $"'{textBox4.Text}'" : "NULL";
            string Waretype_Max_hum = checkBox2.Checked ? $"'{textBox5.Text}'" : "NULL";
            string Waretype_Min_hum = checkBox2.Checked ? $"'{textBox6.Text}'" : "NULL";

            DBUtility.ExecuteSQL($"update  [WMS].[dbo].[WareAreaType] set Waretype_Name = '{textBox2.Text}', Waretype_Tem_controlable ={checkBox1.Checked},Waretype_Hum_controlable = {checkBox2.Checked},Waretype_Max_tem = {Waretype_Max_tem},Waretype_Min_tem = {Waretype_Min_tem},Waretype_Max_hum = {Waretype_Max_hum},Waretype_Min_hum = {Waretype_Min_hum} where WareType_ID = '{textBox1.Text}'");
            ShowData();
        }
Exemplo n.º 8
0
        /// <summary>
        /// add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            // slove the null value
            string Waretype_Max_tem = checkBox1.Checked ? $"'{textBox3.Text}'" : "NULL";
            string Waretype_Min_tem = checkBox1.Checked ? $"'{textBox4.Text}'" : "NULL";
            string Waretype_Max_hum = checkBox2.Checked ? $"'{textBox5.Text}'" : "NULL";
            string Waretype_Min_hum = checkBox2.Checked ? $"'{textBox6.Text}'" : "NULL";

            DBUtility.ExecuteSQL($"INSERT INTO [WMS].[dbo].[WareAreaType] select right('00000000000000000000'+cast(max([WareType_ID])+1 as varchar),10),'{textBox2.Text}',{checkBox1.Checked},{checkBox2.Checked},{Waretype_Max_tem},{Waretype_Min_tem},{Waretype_Max_hum},{Waretype_Min_hum} from [WMS].[dbo].[WareType_ID]");
            ShowData();
        }
Exemplo n.º 9
0
 /// <summary>
 /// delete
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         DBUtility.ExecuteSQL($"delete From [WMS].[dbo].[WareArea] where  WareArea_ID = '{textBox1.Text}'");
         ShowData();
     }
     catch (Exception)
     {
         MessageBox.Show("当前区域仍有货物不可删除。");
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// delete
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         DBUtility.ExecuteSQL($"delete from  [WMS].[dbo].[WareAreaType]  where WareType_ID = '{textBox1.Text}'");
         ShowData();
     }
     catch (Exception)
     {
         MessageBox.Show("有存储区域正使用此分类,不能删除。");
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// delete
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         DBUtility.ExecuteSQL($"delete from  [WMS].[dbo].[Product] where Product_ID ='{textBox18.Text}' ");
         data = DBUtility.GetData("SELECT Product_ID 编号,Product_Name 名称,Product_tally 单位 , Product_Weight 重量 , Product_Long 长度 ,Product_Hgih 高度 , Product_Wide 宽度 , Product_Temperature 保存温度 , Product_humidity 保存湿度 FROM [WMS].[dbo].[Product]");
         dataGridView1.DataSource = data;
     }
     catch (Exception)
     {
         MessageBox.Show("该物品还在库存中存在不能删除");
     }
 }
Exemplo n.º 12
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (type)
            {
            case 1:
            {
                string oldPsd = DBUtility.GetData($"select customer_psd from customer where customer_email = '{ID}'").Rows[0][0].ToString();
                if (oldPsd != textBox1.Text)
                {
                    MessageBox.Show("原密码错误");
                    return;
                }
                if (textBox2.Text != textBox3.Text)
                {
                    MessageBox.Show("两次密码不同");
                    return;
                }
                DBUtility.ExecuteSQL($"update  customer set customer_psd ='{textBox2.Text}' ");
                break;
            }

            case 2:
            {
                string oldPsd = DBUtility.GetData($"select staff_psd from staff where staff_id = '{ID}'").Rows[0][0].ToString();
                if (oldPsd != textBox1.Text)
                {
                    MessageBox.Show("原密码错误");
                    return;
                }
                if (textBox2.Text != textBox3.Text)
                {
                    MessageBox.Show("两次密码不同");
                    return;
                }
                DBUtility.ExecuteSQL($"update  staff set staff_psd ='{textBox2.Text}' ");
                break;
            }

            default:
                break;
            }
            MessageBox.Show("修改密码成功。");
            this.Close();
            this.Dispose();
        }
Exemplo n.º 13
0
 public Boolean SignUp()
 {
     //check the email is unique
     if (DBUtility.GetData($"select * from dbo.customer where customer_email  ='{Email}'").Rows.Count != 0)
     {
         System.Windows.Forms.MessageBox.Show("该邮箱已被注册,请更换邮箱");
         return(false);
     }
     try
     {
         DBUtility.ExecuteSQL($"Insert into dbo.customer select right('000000000'+cast(max(customer_id)+1 as varchar),10),'{Name}','{PSD}','{Email}' from dbo.customer");
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 14
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         DBUtility.ExecuteSQL($"update stock_in set stock_in_payed = 1 where stock_in_id = '{comboBox1.SelectedItem.ToString()}'");
         MessageBox.Show("缴费成功");
         UpdateInfo();
         return;
     }
     catch (Exception)
     {
     }
     try
     {
         DBUtility.ExecuteSQL($"update stock_out set stock_out_payed = 1 where stock_in_id2 = '{comboBox1.SelectedItem.ToString()}'");
         MessageBox.Show("缴费成功");
         UpdateInfo();
         return;
     }
     catch (Exception)
     {
     }
     MessageBox.Show("缴费失败");
 }
Exemplo n.º 15
0
 /// <summary>
 /// insert
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     DBUtility.ExecuteSQL($"insert into  [WMS].[dbo].[WareHouse] select  right('0000000000'+cast(max(Warehouse_ID)+1 as varchar),10),'{textBox2.Text}' from [WMS].[dbo].[WareHouse] ");
     ShowData();
 }
Exemplo n.º 16
0
 /// <summary>
 /// Add
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     DBUtility.ExecuteSQL($"insert into STAFF_TYPE select  right('0'+cast(max([Staff_type_id])+1 as varchar),2),'{textBox1.Text}' from STAFF_TYPE ");
     ShowData();
 }
Exemplo n.º 17
0
 private void button2_Click(object sender, EventArgs e)
 {
     DBUtility.ExecuteSQL($"update stock_out set stock_out_checked = 1,stock_out_pay = {double.Parse(textBox3.Text) * double.Parse(textBox4.Text)} where stock_in_id2 = '{comboBox2.SelectedItem.ToString()}'");
     MessageBox.Show("确认成功");
     UpdateInfo();
 }
Exemplo n.º 18
0
 /// <summary>
 /// update
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button2_Click(object sender, EventArgs e)
 {
     DBUtility.ExecuteSQL($"update [WMS].[dbo].[WareHouse] set Warehouse_Name = '{textBox2.Text}'  where Warehouse_ID = '{textBox1.Text}'  ");
     ShowData();
 }
Exemplo n.º 19
0
 private void button1_Click(object sender, EventArgs e)
 {
     DBUtility.ExecuteSQL($"Update warearea set last_check_date = getdate() where wareArea_id ='{comboBox1.SelectedItem.ToString()}' ");
     MessageBox.Show("巡检成功");
 }