Пример #1
0
 public bool new_VIP(string merchant_id, string client_id, string level)
 {
     try
     {
         string sql = "insert into client_VIP(merchant_id,client_id,grade) values('" + merchant_id + "','" + client_id + "'," + level + ")";
         execute.Do(sql);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #2
0
        public bool insertSupplier(string name, string phone_number, string address)
        {
            try
            {
                string sql = "insert into supplier(name,phone_number,address) values('" + name + "','" + phone_number + "','" + address + "')";

                execute.Do(sql);
                MessageBox.Show("插入成功。");
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #3
0
 public bool insertDeliverOrder(string merchant_id, string order_id, string client_id, string time, string amount, string name, string total_price)
 {
     try
     {
         string sql = "insert into deliver_order values('" + merchant_id + "','" + order_id + "','" + client_id + "',to_date('" + time + "','yyyy-mm-dd'),'" + Convert.ToInt32(amount) + "','" + name + "','" + Convert.ToInt32(total_price) + "')";
         execute.Do(sql);
         MessageBox.Show("插入成功。");
     }
     catch
     {
         MessageBox.Show("插入失败。");
         return(false);
     }
     return(true);
 }
Пример #4
0
        public bool insertReceipt(string supplier_id, string batch_number, string merchant_id, string time, string amount, string name, string total_price)
        {
            try
            {
                string sql = "insert into receipt values('" + supplier_id + "','" + batch_number + "','" + merchant_id + "',to_date('" + time + "','yyyy-mm-dd'),'" + Convert.ToInt32(amount) + "','" + name + "','" + Convert.ToInt32(total_price) + "')";

                execute.Do(sql);
                MessageBox.Show("插入成功。");
            }
            catch
            {
                MessageBox.Show("插入失败。");
                return(false);
            }
            return(true);
        }
Пример #5
0
        //修改摊位信息
        public bool updateStall(string stallID, string merchantID, string staffID, string Area, string startTime, string endTime, string rentMoney)
        {
            try
            {
                string sqlmerchant   = "update stall set merchant_id = '" + merchantID + "' where  stall_id = '" + stallID + "'";
                string sqlstaff      = "update stall set staff_id = '" + staffID + "' where  stall_id = '" + stallID + "'";
                string sqlarea       = "update stall set area = '" + Area + "' where  stall_id = '" + stallID + "'";
                string sqlstart_time = "update stall set start_time = to_date('" + startTime + "','yyyy-mm-dd') where  stall_id = '" + stallID + "'";
                string sqlend_time   = "update stall set end_time = to_date('" + endTime + "','yyyy-mm-dd') where  stall_id = '" + stallID + "'";
                string sqlrentMoney  = "update stall set rent_money = '" + rentMoney + "' where  stall_id = '" + stallID + "'";

                execute.Do(sqlmerchant);
                execute.Do(sqlstaff);
                execute.Do(sqlarea);
                execute.Do(sqlstart_time);
                execute.Do(sqlend_time);
                execute.Do(sqlrentMoney);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }
Пример #6
0
        //添加一条新仓库表项
        public bool AddAnEntry(/*string id,*/ double area1, double capacity, string m_id, string s_id)
        {
            try {
                string insert = "insert into warehouse (area, full_capacity, left_capacity, merchant_id, staff_id) values ("
                                + area1.ToString() + ","
                                + capacity.ToString() + ","
                                + capacity.ToString() + ",'"
                                + m_id + "','"
                                + s_id + "')";

                execute.Do(insert);
                MessageBox.Show("Succeed");
                //dbcon.Close();
                return(true);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }
Пример #7
0
 //新增商家
 public bool addMerchant(string staffID, string Name, string Phone_number)
 {
     try
     {
         //插入商家信息
         string sqlmerchant = "insert into merchant(staff_id,name,phone_number) values('" + staffID + "','" + Name + "','" + Phone_number + "')";
         //OracleCommand cmdmerchant = new OracleCommand(sqlmerchant, con);
         //获得自动分配的商家id
         string sql = "select merchant_seq.currval from dual";
         //OracleCommand cmd = new OracleCommand(sql, con);
         execute.Do(sqlmerchant);
         this.merchant_id = select.Do(sql).ToString();
         //插入merchant_login
         string sqlmerchant_login = "******" + this.merchant_id + "',1234,123456789)";
         //插入merchant_VIP
         string sqlmerchant_VIP = "insert into merchant_VIP(merchant_id,grade,discount) values('" + this.merchant_id + "',0,0.99)";
         execute.Do(sqlmerchant_login);
         execute.Do(sqlmerchant_VIP);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return(false);
     }
 }
Пример #8
0
        public bool update(string ID, string newpassword)
        {
            string result = "";

            string esql = "update STAFF_LOGIN set PASSWORD = '******' where STAFF_ID = '" + ID + "'";

            string ssql = "select PASSWORD from STAFF_LOGIN where STAFF_ID = '" + ID + "'";

            Doexecute b = Doexecute.instance;
            Doselect  a = Doselect.instance;

            b.Do(esql);
            result = a.Do(ssql).ToString();
            if (result == newpassword)
            {
                return(true);
            }
            return(false);
        }
        public bool update(string ID, string newpassword)
        {
            string result = "";

            string esql = "update MERCHANT_LOGIN set PASSWORD = '******' where MERCHANT_ID = '" + ID + "'";

            string    ssql = "select PASSWORD from MERCHANT_LOGIN where MERCHANT_ID = '" + ID + "'";
            Doexecute b    = Doexecute.instance;
            //Doexecute b1 = Doexecute.instance;
            //if (b == b1) Console.WriteLine("the same again!!");
            Doselect a = Doselect.instance;

            b.Do(esql);
            result = a.Do(ssql).ToString();


            if (result == newpassword)
            {
                return(true);
            }
            return(false);
        }
Пример #10
0
        public bool addlead(string dept_name, string staff_id)//新增lead表
        {
            try
            {
                string sql2     = "select dept_name from staff where staff_id='" + staff_id + "'";
                string deptname = select.Do(sql2).ToString();
                if (deptname == dept_name)
                {
                    string sql = "update leading set dept_head='" + staff_id + "' where dept_name='" + dept_name + "'";

                    execute.Do(sql);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }
Пример #11
0
        //修改表项时前后仓库ID相同时使用此方法
        public bool UpdateWhenIDSame(string merchant_id, string old_supplier_id, string old_batch_number, string old_id_in_batch, double new_amount)
        {
            //string db = " DATA SOURCE=localhost:1521/orcl2;USER ID=scott; password = 1234";
            //OracleConnection dbcon = new OracleConnection(db);
            //dbcon.Open();

            string selectOldAmount = "select amount from merchandise where merchant_id = '" + merchant_id
                                     + "' and supplier_id = '" + old_supplier_id
                                     + "' and batch_number = '" + old_batch_number
                                     + "' and id_in_batch = '" + old_id_in_batch
                                     + "'";
            //OracleCommand cmd = new OracleCommand(selectOldAmount, dbcon);
            //double old_amount = Convert.ToDouble(cmd.ExecuteScalar());
            double old_amount    = Convert.ToDouble(select.Do(selectOldAmount));
            double change_amount = new_amount - old_amount;

            string selectOldWarehouseID = "select warehouse_id from merchandise where merchant_id = '" + merchant_id
                                          + "' and supplier_id = '" + old_supplier_id
                                          + "' and batch_number = '" + old_batch_number
                                          + "' and id_in_batch = '" + old_id_in_batch
                                          + "'";
            // OracleCommand cmd1 = new OracleCommand(selectOldWarehouseID, dbcon);
            // string old_warehouse_id = cmd1.ExecuteScalar().ToString();
            string old_warehouse_id      = select.Do(selectOldWarehouseID).ToString();
            string selectOldLeftCapacity = "select left_capacity from warehouse where warehouse_id = '" + old_warehouse_id + "'";
            //OracleCommand cmd2 = new OracleCommand(selectOldLeftCapacity, dbcon);
            //double old_left_capacity = Convert.ToDouble(cmd2.ExecuteScalar());
            double old_left_capacity = Convert.ToDouble(select.Do(selectOldLeftCapacity));

            double changed_left_capacity = old_left_capacity - change_amount;

            if (changed_left_capacity >= 0)
            {
                string updateOldLeftCapacity = "update warehouse set left_capacity = " + changed_left_capacity.ToString()
                                               + " where warehouse_id = '" + old_warehouse_id + "'";
                //OracleCommand cmd3 = new OracleCommand(updateOldLeftCapacity, dbcon);
                //cmd3.ExecuteNonQuery();
                execute.Do(updateOldLeftCapacity);
                //dbcon.Close();
                //MessageBox.Show("仓库剩余容量修改成功!");
                return(true);
            }
            else
            {
                //dbcon.Close();
                MessageBox.Show("仓库剩余容量不足!");
                return(false);
            }
        }
Пример #12
0
 //新增员工
 public bool addStaff(string Name, string Age, string Sex, string Phone_number, string Salary, string Dept_name)
 {
     try
     {
         //string s = "DATA SOURCE=localhost:1521/orcl2;USER ID=scott; password = 1234";
         //OracleConnection con = new OracleConnection(s);
         //con.Open();
         //插入商家信息
         string sqlstaff = "insert into staff(name,age,sex,phone_number,salary,dept_name) values('" + Name + "','" + Age + "','" + Sex + "','" + Phone_number + "','" + Salary + "','" + Dept_name + "')";
         //OracleCommand cmdstaff = new OracleCommand(sqlstaff, con);
         //cmdstaff.ExecuteNonQuery();
         execute.Do(sqlstaff);
         //获得自动分配的商家id
         if (Dept_name == "Material_Ctrl_Dept")
         {
             string sql = "select staff_id from staff where phone_number = '" + Phone_number + "'";
             //OracleCommand cmd = new OracleCommand(sql, con);
             //cmdstaff.ExecuteNonQuery();
             //this.staff_id = cmd.ExecuteScalar().ToString();
             this.staff_id = select.Do(sql).ToString();
         }
         else if (Dept_name == "Personal_Adm_Dept")
         {
             string sql = "select staff_id from staff where phone_number = '" + Phone_number + "'";
             //OracleCommand cmd = new OracleCommand(sql, con);
             // cmdstaff.ExecuteNonQuery();
             //this.staff_id = cmd.ExecuteScalar().ToString();
             this.staff_id = select.Do(sql).ToString();
         }
         else if (Dept_name == "Stall_Mgt_Dept")
         {
             string sql = "select staff_id from staff where phone_number = '" + Phone_number + "'";
             //OracleCommand cmd = new OracleCommand(sql, con);
             //cmdstaff.ExecuteNonQuery();
             //this.staff_id = cmd.ExecuteScalar().ToString();
             this.staff_id = select.Do(sql).ToString();
         }
         else if (Dept_name == "Merchant_Mgt_Dept")
         {
             string sql = "select staff_id from staff where phone_number = '" + Phone_number + "'";
             //OracleCommand cmd = new OracleCommand(sql, con);
             //cmdstaff.ExecuteNonQuery();
             //this.staff_id = cmd.ExecuteScalar().ToString();
             this.staff_id = select.Do(sql).ToString();
         }
         //插入merchant_login
         string sqlstaff_login = "******" + this.staff_id + "',2234,223456789)";
         //OracleCommand cmdlogin = new OracleCommand(sqlstaff_login, con);
         //cmdlogin.ExecuteNonQuery();
         //con.Close();
         execute.Do(sqlstaff_login);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return(false);
     }
 }