Exemple #1
0
 public bool UpdateProductItem(
     string DOCUMENT_ID, string DEPARTMENT_ID
     , string YEAR, string PROJECT_ID
     , string RPOJECT_SERIAL, string CREATE_DATE, string ROOM_ID, string CABINET_ID, string FLOOR, string TAG_ID, string COMMENT)
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlUpdate
                                                             , new object[11]
         {
             DEPARTMENT_ID
             , YEAR
             , PROJECT_ID
             , RPOJECT_SERIAL
             , CREATE_DATE
             , ROOM_ID
             , CABINET_ID
             , FLOOR
             , TAG_ID
             , COMMENT
             , DOCUMENT_ID
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("更新数据时出现错误:" + ex.Message);
     }
     return(false);
 }
Exemple #2
0
        public bool CheckExists(string DOCUMENT_ID)
        {
            DataSet ds = null;

            try
            {
                ds = SQLiteHelper.ExecuteDataSet(
                    ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                    sqlSelectExist, new object[1] {
                    DOCUMENT_ID
                });
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            return(true);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("查询数据库时出现错误:" + ex.Message);
            }
            return(false);
        }
 public bool AddBorrowInfo(
     string DOCUMENT_ID, string CREATE_DATE, string TAG_ID, string BORROWER_ID, string COMMENT)
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlInsertAddBorrowInfo
                                                             , new object[5]
         {
             DOCUMENT_ID
             , CREATE_DATE
             , TAG_ID
             , BORROWER_ID
             , COMMENT
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("添加数据时出现错误:" + ex.Message);
     }
     return(false);
 }
Exemple #4
0
        public DataTable GetInStorageProductInventoryMore(string productIDs)
        {
            DataSet ds = null;

            try
            {
                ds = SQLiteHelper.ExecuteDataSet(
                    ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                    sqlSelectGetProductByID, new object[1] {
                    productIDs
                });
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        return(ds.Tables[0]);
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("查询数据库时出现错误:" + ex.Message);
            }
            return(null);
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (this.comboBox1.SelectedIndex)
            {
            case 0:
                ConfigManager.SaveCurrentDBType(DBType.sqlserver);
                this.txtConnString.Text = ConfigManager.GetDBConnectString(DBType.sqlserver);
                break;

            case 1:
                ConfigManager.SaveCurrentDBType(DBType.sqlite);
                this.txtConnString.Text = ConfigManager.GetDBConnectString(DBType.sqlite);
                break;
            }
        }
        private void initialForm()
        {
            DBType type = ConfigManager.GetCurrentDBType();

            if (type == DBType.sqlserver)
            {
                this.comboBox1.SelectedIndex = 0;
            }
            else if (type == DBType.sqlite)
            {
                this.comboBox1.SelectedIndex = 1;
            }
            string connStr = ConfigManager.GetDBConnectString(type);

            this.txtConnString.Text = connStr;
        }
        public bool testConnection()
        {
            string connStr = string.Empty;

            switch ((int)ConfigManager.GetCurrentDBType())
            {
            case (int)DBType.sqlite:
                connStr = ConfigManager.GetDBConnectString(DBType.sqlite);
                if (connStr != string.Empty)
                {
                    SQLiteConnection cn = new SQLiteConnection(connStr);
                    try
                    {
                        cn.Open();
                        return(true);
                    }
                    catch
                    {
                        return(false);
                    }
                    finally
                    {
                        cn.Close();
                    }
                }
                break;

            case (int)DBType.sqlserver:
                SqlConnection conn = new SqlConnection();
                try
                {
                    conn.ConnectionString = connStr;
                    conn.Open();
                    return(true);
                }
                catch
                {
                    return(false);
                }
                finally
                {
                    conn.Close();
                }
                break;
            }
            return(false);
        }
 public bool DeleteOrderInfo()
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlDeleteRemoveOrderInfo
                                                             , null).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("删除数据时出现错误:" + ex.Message);
     }
     return(false);
 }
Exemple #9
0
        public DocumentInfo GetSpecifiedDocumentInfo(string DOCUMENT_ID)
        {
            DocumentInfo info = new DocumentInfo();

            DataSet ds = null;

            try
            {
                ds = SQLiteHelper.ExecuteDataSet(
                    ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                    sqlSelectExist, new object[1] {
                    DOCUMENT_ID
                });
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            DataRow dr = ds.Tables[0].Rows[0];
                            info.DOCUMENT_ID    = dr["DOCUMENT_ID"].ToString();
                            info.TAG_ID         = dr["TAG_ID"].ToString();
                            info.CABINET_ID     = dr["CABINET_ID"].ToString();
                            info.COMMENT        = dr["COMMENT"].ToString();
                            info.CREATE_DATE    = dr["CREATE_DATE"].ToString();
                            info.DEPARTMENT_ID  = dr["DEPARTMENT_ID"].ToString();
                            info.FLOOR          = dr["FLOOR"].ToString();
                            info.PROJECT_ID     = dr["PROJECT_ID"].ToString();
                            info.ROOM_ID        = dr["ROOM_ID"].ToString();
                            info.RPOJECT_SERIAL = dr["RPOJECT_SERIAL"].ToString();
                            info.YEAR           = dr["YEAR"].ToString();
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("查询数据库时出现错误:" + ex.Message);
            }
            return(info);
        }
Exemple #10
0
 public bool DeleteProductItem(string DEPARTMENT_ID)
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlDelete
                                                             , new object[1]
         {
             DEPARTMENT_ID
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("删除数据时出现错误:" + ex.Message);
     }
     return(false);
 }
Exemple #11
0
 public bool DeleteOrderItem(string productName)
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlDeleteDeleteOrderItem
                                                             , new object[1]
         {
             productName
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("删除订单项时出现错误:" + ex.Message);
     }
     return(false);
 }
 public bool CheckEpcExist(string epc)
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlSelectGetEpc
                                                             , new object[1]
         {
             epc
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("查询数据时出现错误:" + ex.Message);
     }
     return(false);
 }
 public bool SetProductInStorage(string productID)
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlUpdateChangeStorageStatusToInStorage
                                                             , new object[1]
         {
             productID
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("入库时出现错误:" + ex.Message);
     }
     return(false);
 }
Exemple #14
0
 public bool AddOrderItem(string productName, int productQuantity)
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlInsertAddOrderItem
                                                             , new object[2]
         {
             productName
             , productQuantity
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("添加订单项时出现错误:" + ex.Message);
     }
     return(false);
 }
 public bool InsertProductInfoIntoOutInventory(string productID, string datetime)
 {
     try
     {
         int result = int.Parse(SQLiteHelper.ExecuteNonQuery(ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                                                             sqlInsertOutInventory
                                                             , new object[2]
         {
             datetime
             , productID
         }).ToString());
         if (result > 0)
         {
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("插入数据时出现错误:" + ex.Message);
     }
     return(false);
 }
Exemple #16
0
        public DataTable GetOrderTable()
        {
            DataSet ds = null;

            try
            {
                ds = SQLiteHelper.ExecuteDataSet(
                    ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                    sqlSelectOrderItems, null);
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        return(ds.Tables[0]);
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("查询数据库时出现错误:" + ex.Message);
            }
            return(null);
        }
        public DocumentBorrowInfo GetDocumentBorrowInfo(string DOCUMENT_ID)
        {
            DocumentBorrowInfo info = new DocumentBorrowInfo();

            DataSet ds = null;

            try
            {
                ds = SQLiteHelper.ExecuteDataSet(
                    ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()),
                    sqlSelectGetBorrowInfo, new object[1] {
                    DOCUMENT_ID
                });
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            DataRow dr = ds.Tables[0].Rows[0];
                            info.DOCUMENT_ID = dr["DOCUMENT_ID"].ToString();
                            info.TAG_ID      = dr["TAG_ID"].ToString();
                            info.COMMENT     = dr["COMMENT"].ToString();
                            info.CREATE_DATE = dr["CREATE_DATE"].ToString();
                            info.BORROWER_ID = dr["BORROWER_ID"].ToString();
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("查询数据库时出现错误:" + ex.Message);
            }

            return(info);
        }