Example #1
0
        //按stall_id显示摊位信息
        public bool showStall(string stallID)
        {
            try
            {
                string merchantID = "select merchant_id from stall where stall_id='" + stallID + "'";
                string staffID    = "select staff_id from stall where stall_id='" + stallID + "'";
                string Area       = "select area from stall where stall_id='" + stallID + "'";
                string startTime  = "select to_char(start_time,'yyyy-mm-dd') from stall where stall_id='" + stallID + "'";
                string endTime    = "select to_char(end_time,'yyyy-mm-dd') from stall where stall_id='" + stallID + "'";
                string rentMoney  = "select rent_money from stall where stall_id='" + stallID + "'";
                string Price      = "select price from stall natural join quotation where stall_id='" + stallID + "'";

                this.staff_id   = select.Do(staffID).ToString();
                this.area       = select.Do(Area).ToString();
                this.start_time = select.Do(startTime).ToString();
                this.end_time   = select.Do(endTime).ToString();
                this.rent_money = select.Do(rentMoney).ToString();
                this.price      = select.Do(Price).ToString();
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }
Example #2
0
        public string checkClient(string name, string phone_number)
        {
            string str = null;
            string sql = "select client_id from client where name = '" + name + "'and phone_number = '" + phone_number + "'";

            str = select.Do(sql).ToString();
            return(str);
        }
 //新增商家
 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);
     }
 }
Example #4
0
        public bool showReceipt(string supplier_id, string batch_number)
        {
            try
            {
                string Supplier_ID  = "select supplier_id from receipt where supplier_id='" + supplier_id + "' and batch_number = '" + batch_number + "'";
                string Batch_number = "select batch_number from receipt where supplier_id='" + supplier_id + "' and batch_number = '" + batch_number + "'";
                string Time         = "select to_char(time,'yyyy-mm-dd') from receipt where supplier_id='" + supplier_id + "' and batch_number = '" + batch_number + "'";
                string Amount       = "select amount from receipt where supplier_id='" + supplier_id + "' and batch_number = '" + batch_number + "'";
                string Name         = "select name from receipt where supplier_id='" + supplier_id + "' and batch_number = '" + batch_number + "'";
                string Total_price  = "select total_price from receipt where supplier_id='" + supplier_id + "' and batch_number = '" + batch_number + "'";

                this.supplier_id  = select.Do(Supplier_ID).ToString();
                this.name         = select.Do(name).ToString();
                this.time         = select.Do(time).ToString();
                this.batch_number = select.Do(Batch_number).ToString();
                this.amount       = select.Do(Amount).ToString();
                this.total_price  = select.Do(Total_price).ToString();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public string find(string ID, string verification_code)
        {
            string   result = "";
            string   sql    = "select PASSWORD from STAFF_LOGIN where STAFF_ID = '" + ID + "' and verification_code = '" + verification_code + "'";
            Doselect a      = Doselect.instance;

            result = a.Do(sql).ToString();
            return(result);
        }
        public string selectSupplier(string name, string phone_number)
        {
            try
            {
                string sql = "select supplier_id from supplier where name = '" + name + "'and phone_number = '" + phone_number + "'";

                string supplier_id = select.Do(sql).ToString();
                return(supplier_id);
            }
            catch
            {
                MessageBox.Show("查询失败。");
                return(null);
            }
        }
Example #7
0
 public bool update_discount(string merchant_id, string grade, string newdiscount)
 {
     try
     {
         string sql = "update merchant_VIP set discount = " + newdiscount + " where merchant_ID = '" + merchant_id + "' and grade = " + grade;
         execute.Do(sql);
         sql = "select discount from merchant_VIP where merchant_ID = '" + merchant_id + "' and grade = " + grade;
         string client_id = "";
         client_id = select.Do(sql).ToString();
         if (client_id == "")
         {
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
        public bool check(string ID, string password)
        {
            string   result = "";
            string   sql    = "select PASSWORD from STAFF_LOGIN where STAFF_ID = " + "'" + ID + "'";
            Doselect a      = Doselect.instance;

            result = a.Do(sql).ToString();
            if (result == password)
            {
                return(true);
            }
            return(false);
        }
        public bool check(string ID, string password)
        {
            string   result = "";
            string   sql    = "select PASSWORD from MERCHANT_LOGIN where MERCHANT_ID = " + "'" + ID + "'";
            Doselect a      = Doselect.instance;

            //Doselect a1 = Doselect.instance;
            //if (a == a1) Console.WriteLine("the same!!!!");
            result = a.Do(sql).ToString();
            if (result == password)
            {
                return(true);
            }
            return(false);
        }
        public bool exist(string staff_id)//检查员工id是否存在
        {
            object   result = null;
            string   sql    = "select * from staff where staff_id='" + staff_id + "'";
            Doselect a      = Doselect.instance;

            result = a.Do(sql);
            if (result == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        //判断修改表项时前后仓库ID是否一致
        public bool IsWarehouseIDSame(string old_merchant_id, string old_supplier_id, string old_batch_number, string old_id_in_batch, string new_warehouse_id)
        {
            // string db = " DATA SOURCE=localhost:1521/orcl2;USER ID=scott; password = 1234";
            //OracleConnection dbcon = new OracleConnection(db);
            //dbcon.Open();

            string selectOldWarehouseID = "select warehouse_id from merchandise where merchant_id = '" + old_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(selectOldWarehouseID, dbcon);
            //string old_warehouse_id = cmd.ExecuteScalar().ToString();
            string old_warehouse_id = select.Do(selectOldWarehouseID).ToString();

            //dbcon.Close();
            if (old_warehouse_id == new_warehouse_id)
            {
                return(true);
            }
            return(false);
        }
        public bool exist(string merchantID)
        {
            object result = null;

            string   sql = "select * from merchant where merchant_id='" + merchantID + "'";
            Doselect a   = Doselect.instance;

            result = a.Do(sql);
            if (result == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        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);
        }
Example #15
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);
            }
        }
Example #16
0
 public string checkDeliverOrder(string merchant_id, string order_id, string client_id)
 {
     try
     {
         //string s = "DATA SOURCE=localhost:1521/orcl2;USER ID=scott; password = 1234 ";
         //OracleConnection con = new OracleConnection(s);
         //con.Open();
         string sql = "select amount from deliver_order where client_id = '" + client_id + "' and order_id = '" + order_id + "' and merchant_id = '" + merchant_id + "'";
         //OracleCommand cmd = new OracleCommand(sql, con);
         string str = "";
         str = select.Do(sql).ToString();
         //OracleDataAdapter da = new OracleDataAdapter(cmd);
         DataSet ds = select.Data(sql, "deliver_order");
         //da.Fill(ds, "deliver_order");
         //con.Close();
         return(str);
     }
     catch
     {
         return("");
     }
 }
Example #17
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);
     }
 }