Beispiel #1
0
        private void frmDataProcessing_Load(object sender, EventArgs e)
        {
            AccessHelper ah     = new AccessHelper();
            string       strSQL = "select * from (select CtrlID,count(CtrlID) as num from applicationdetail where isdelete=0 group by CtrlID) a where a.num>20";

            dtStaDetail = ah.SelectToDataTable(strSQL);
            ah.Close();
            if (dtStaDetail.Rows.Count > 0)
            {
                labDataCount.Text      = dtStaDetail.Rows.Count.ToString();
                btnDataProcess.Enabled = true;
            }
            else
            {
                labDataCount.Text      = "0";
                btnDataProcess.Enabled = false;
            }
        }
        private Boolean CheckSpecial(string itemID)
        {
            Boolean boolResult = false;

            try
            {
                string       strSQL = "select * from Items where itemID = '" + itemID + "'";
                AccessHelper ah     = new AccessHelper();
                DataTable    dt     = ah.SelectToDataTable(strSQL);
                ah.Close();
                if (dt.Rows[0]["IsSpecial"].ToString() == "1")
                {
                    boolResult = true;
                }
            }
            catch
            {
                boolResult = false;
            }
            return(boolResult);
        }
Beispiel #3
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     strConnstring = XMLHelper.strGetConnectString().Split(';')[1].ToString().Split('=')[1].ToString();
     strlock       = strConnstring.Substring(0, strConnstring.LastIndexOf("\\") + 1) + "TransferLock";
     if (!File.Exists(strlock))
     {
         try
         {
             string       strTSQL = "select * from SetupConfig";
             AccessHelper ahTSQL  = new AccessHelper();
             DataTable    dtTSQL  = ahTSQL.SelectToDataTable(strTSQL);
             ahTSQL.Close();
             if (txtName.Text.ToLower() == "administrator" || GetComputerName().Substring(0, 3) == "OC1")
             {
                 UpdateDataBase();
             }
             if (strVersion == Application.ProductVersion)
             {
                 LoginProcess();
             }
             else if (strVersion == "" || CompareVersion(Application.ProductVersion, strVersion))
             {
                 if (GetComputerName().Substring(0, 3) == "OC1")
                 {
                     string       strSQL = "update SetupConfig set Version='" + Application.ProductVersion + "' ";
                     AccessHelper ah     = new AccessHelper();
                     ah.ExecuteSQLNonquery(strSQL);
                     ah.Close();
                 }
                 LoginProcess();
             }
             else
             {
                 MessageBox.Show("系统版本过低,请先升级后再重新登录使用!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         catch (Exception ex)
         {
             if (txtName.Text.ToLower() == "administrator" || GetComputerName().Substring(0, 3) == "OC1")
             {
                 MessageBox.Show("数据库损坏,点击确定后,系统将尝试自动修复,期间请勿操作!::" + ex.Message, "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 string strResult = RepairAccess(strConnstring);
                 if (strResult.Substring(0, 5) != "Error")
                 {
                     MessageBox.Show("数据库修复完成,请关闭系统,并重新登录!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("数据库修复失败::" + strResult, "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
             else
             {
                 MessageBox.Show("数据库损坏,稍后将由上海办公室修复,请稍后重新登录!::" + ex.Message, "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
     else
     {
         string strRepairUser = File.ReadAllText(strlock);
         MessageBox.Show("登陆失败::数据库正在计算机: " + strRepairUser + " 启用自动修复中,请稍后重新登录!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Beispiel #4
0
 public void UpdateDataBase()
 {
     //增加SetupConfig表的Version字段
     try
     {
         AccessHelper ah     = new AccessHelper();
         string       strSQL = "select top 1 * from SetupConfig";
         DataTable    dtSQL  = ah.SelectToDataTable(strSQL);
         ah.Close();
         if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["Version"].ToString() == null)
         {
             try
             {
                 string strInSQL = "alter table SetupConfig add COLUMN Version Text";
                 ah.ExecuteNonQuery(strInSQL);
             }
             catch (Exception ex1)
             {
                 ah.Close();
             }
         }
         else if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["Version"].ToString() != null)
         {
             if (dtSQL.Rows[0]["Version"].ToString() != "")
             {
                 strVersion = dtSQL.Rows[0]["Version"].ToString();
             }
             else
             {
                 strVersion = "";
             }
         }
         ah.Close();
     }
     catch (Exception ex)
     {
         if (ex.HResult.ToString() == "-2147024809")
         {
             AccessHelper ah = new AccessHelper();
             try
             {
                 string strInSQL = "alter table SetupConfig add COLUMN Version text";
                 ah.ExecuteNonQuery(strInSQL);
             }
             catch (Exception ex1)
             {
                 ah.Close();
             }
             string    strSQL = "select top 1 * from SetupConfig";
             DataTable dtSQL  = ah.SelectToDataTable(strSQL);
             if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["Version"].ToString() != null)
             {
                 if (dtSQL.Rows[0]["Version"].ToString() != "")
                 {
                     strVersion = dtSQL.Rows[0]["Version"].ToString();
                 }
                 else
                 {
                     strVersion = "";
                 }
             }
             ah.Close();
         }
     }
 }
Beispiel #5
0
        private void btnDataProcess_Click(object sender, EventArgs e)
        {
            AccessHelper ah = new AccessHelper();

            foreach (DataRow dr in dtStaDetail.Rows)
            {
                string    strCtrlID     = "";
                int       intNum        = int.Parse(dr["num"].ToString());
                int       intCI         = 1;
                int       intCurrentNum = 1;
                int       intTotalCount = 0;
                double    douTotalPrice = 0.00;
                string    strSQL        = "select * from applicationdetail where CtrlID='" + dr["CtrlID"].ToString() + "' ";
                DataTable dtDataDetail  = ah.SelectToDataTable(strSQL);
                strSQL = "select * from ApplicationInfo where CtrlID='" + dr["CtrlID"].ToString() + "' ";
                DataTable dtDataInfo   = ah.SelectToDataTable(strSQL);
                string    strOriCtrlID = "Auto" + DateTime.Now.ToString("HHmmssfff") + dtDataInfo.Rows[0]["Applicants"].ToString().Substring(0, 1);
                strCtrlID = strOriCtrlID;
                DataTable AddAppInfoDT   = applicationInfo.SelectApplicationByCtrlID("0");
                DataTable AddAppDetailDT = applicationDetail.SelectAppDetailByCtrlID("0");
                DataRow   drInfo         = AddAppInfoDT.NewRow();
                DataRow   drDetail       = AddAppDetailDT.NewRow();
                drInfo = dtDataInfo.Rows[0];

                foreach (DataRow drIN in dtDataDetail.Rows)
                {
                    drDetail = drIN;
                    if (intCurrentNum <= 20)
                    {
                        intCurrentNum++;
                        drInfo["CtrlID"]   = strCtrlID;
                        drDetail["CtrlID"] = strCtrlID;
                        intTotalCount     += (int)drDetail["App_Count"];
                        douTotalPrice     += ((int)drDetail["App_Count"]) * ((double.Parse(drDetail["Price"].ToString())));
                        AddAppDetailDT.Rows.Add(drDetail.ItemArray);
                    }
                    else
                    {
                        drInfo["TotalCount"] = intTotalCount;
                        drInfo["TotalPrice"] = douTotalPrice;
                        AddAppInfoDT.Rows.Add(drInfo.ItemArray);
                        applicationInfo.SubmitApplicationInfo(AddAppInfoDT);
                        applicationDetail.SubmitApplicationDetail(AddAppDetailDT);

                        intCurrentNum = 1;
                        intTotalCount = 0;
                        douTotalPrice = 0.00;
                        strCtrlID     = strOriCtrlID + intCI.ToString();
                        intCI++;
                        AddAppInfoDT.Clear();
                        AddAppDetailDT.Clear();
                        //drInfo = AddAppInfoDT.NewRow();
                        //drDetail = AddAppDetailDT.NewRow();
                        //drInfo = dtDataInfo.Rows[0];

                        intCurrentNum++;
                        drInfo["CtrlID"]   = strCtrlID;
                        drDetail["CtrlID"] = strCtrlID;
                        intTotalCount     += (int)drDetail["App_Count"];
                        douTotalPrice     += ((int)drDetail["App_Count"]) * ((double.Parse(drDetail["Price"].ToString())));
                        AddAppDetailDT.Rows.Add(drDetail.ItemArray);
                    }
                }
                if (AddAppDetailDT.Rows.Count > 0)
                {
                    drInfo["TotalCount"] = intTotalCount;
                    drInfo["TotalPrice"] = douTotalPrice;
                    AddAppInfoDT.Rows.Add(drInfo.ItemArray);
                    applicationInfo.SubmitApplicationInfo(AddAppInfoDT);
                    applicationDetail.SubmitApplicationDetail(AddAppDetailDT);

                    intCurrentNum = 1;
                    intTotalCount = 0;
                    douTotalPrice = 0.00;
                    //strCtrlID = strOriCtrlID + intCI.ToString();
                    //intCI++;
                    AddAppInfoDT.Clear();
                    AddAppDetailDT.Clear();
                }
                strSQL = "update applicationdetail set isdelete=1 where CtrlID='" + dr["CtrlID"].ToString() + "' ";
                ah.ExecuteSQLNonquery(strSQL);
                strSQL = "update ApplicationInfo set isdelete=1 where CtrlID='" + dr["CtrlID"].ToString() + "' ";
                ah.ExecuteSQLNonquery(strSQL);
            }
            ah.Close();
            MessageBox.Show("处理完成!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            frmDataProcessing_Load(null, null);
        }
Beispiel #6
0
 public void ExecuteSqlQuery(DataRow dr)
 {
     //string sqlString = string.Format("select * from AccessQueue order by [ID] asc");
     //DataTable SqlQuery = SelectToDataTable(sqlString);
     try
     {
         AccessHelper ah = new AccessHelper();
         //foreach (DataRow dr in SqlQuery.Rows)
         //{
         if (dr["operation"].ToString() == "确认唯一码")
         {
             try
             {
                 string    str    = string.Format("select * from ApplicationInfo where IsDelete = 0 and AppState>5 and [TransNo]='{0}'  ", dr["TransNo"].ToString());
                 DataTable Result = ah.SelectToDataTable(str);
                 if (Result.Rows.Count > 0)
                 {
                     if (dr["Buy"].ToString() == "1")//重复购买
                     {
                         bool      successed = false;
                         string    selectSql = string.Format("select * from ApplicationDetail where  [ID] = {0}", dr["DetailID"]);
                         DataTable dt        = ah.SelectToDataTable(selectSql);
                         if (dt.Rows.Count > 0)
                         {
                             dt.Rows[0]["ID"]           = DBNull.Value;
                             dt.Rows[0]["IsRepetition"] = 1;
                             StringBuilder insertSql = new StringBuilder();
                             insertSql.Append("Insert into [ApplicationDetail]");
                             insertSql.Append(" ([CodeID],[TransNo],[ItemID],[Detail],[Price],[MoneyUnit],[Count],[IsDelete],[SelforGift],[ApprovalCount],[ApprovalDiscount],[FinalPrice],[Recipient],[Relationship],[Reason],[IsSuccess],[IsRepetition]) ");
                             insertSql.Append("values");
                             insertSql.AppendFormat(" ('{0}','{1}','{2}','{3}',{4},{5},{6},{7},{8},{9},{10},{11},'{12}','{13}','{14}',{15},{16})", dt.Rows[0]["CodeID"], dt.Rows[0]["TransNo"], dt.Rows[0]["ItemID"], dt.Rows[0]["Detail"], dt.Rows[0]["Price"], dt.Rows[0]["MoneyUnit"], dt.Rows[0]["Count"], dt.Rows[0]["IsDelete"], dt.Rows[0]["SelforGift"], dt.Rows[0]["ApprovalCount"], dt.Rows[0]["ApprovalDiscount"], dt.Rows[0]["FinalPrice"], dt.Rows[0]["Recipient"], dt.Rows[0]["Relationship"], dt.Rows[0]["Reason"], dt.Rows[0]["IsSuccess"], dt.Rows[0]["IsRepetition"]);
                             successed = ah.ExecuteSQLNonquery(insertSql.ToString());
                             if (successed)
                             {
                                 string delSql = string.Format("delete from AccessQueue where [ID]={0}", dr["ID"]);//执行成功后删除队列
                                 ExecuteSQLNonquery(delSql);
                             }
                         }
                         string excString = string.Format("Update ApplicationInfo Set FinalException=1 where IsDelete = 0 and TransNo='{0}'", dr["TransNo"].ToString());
                         ah.ExecuteSQLNonquery(excString);
                     }
                     else
                     {
                         bool   successed = false;
                         string exeSql    = dr["SqlStr"].ToString();
                         successed = ah.ExecuteSQLNonquery(exeSql);//执行sql
                         if (successed)
                         {
                             string delSql = string.Format("delete from AccessQueue where [ID]={0}", dr["ID"]);//执行成功后删除队列
                             ExecuteSQLNonquery(delSql);
                         }
                     }
                 }
                 else
                 {
                     bool   successed = false;
                     string exeSql    = dr["SqlStr"].ToString();
                     successed = ah.ExecuteSQLNonquery(exeSql);//执行sql
                     if (successed)
                     {
                         string delSql = string.Format("delete from AccessQueue where [ID]={0}", dr["ID"]);//执行成功后删除队列
                         ExecuteSQLNonquery(delSql);
                     }
                 }
             }
             catch
             {
             }
         }
         else
         {
             bool   successed = false;
             string exeSql    = dr["SqlStr"].ToString();
             successed = ah.ExecuteSQLNonquery(exeSql);//执行sql
             if (successed)
             {
                 string delSql = string.Format("delete from AccessQueue where [ID]={0}", dr["ID"]);//执行成功后删除队列
                 ExecuteSQLNonquery(delSql);
             }
         }
         //}
         ah.Close();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #7
0
        public void UpdateDataBase()
        {
            //增加item表新price字段
            try
            {
                AccessHelper ah     = new AccessHelper();
                string       strSQL = "select top 1 * from Items";
                DataTable    dtSQL  = ah.SelectToDataTable(strSQL);
                if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["Price4"].ToString() == null)
                {
                    try
                    {
                        string strInSQL = "alter table Items add COLUMN Price4 text";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price5 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price6 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price7 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price8 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price9 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price10 float";
                        ah.ExecuteNonQuery(strInSQL);
                    }
                    catch (Exception)
                    {
                        ah.Close();
                        MessageBox.Show("数据库更新失败!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                ah.Close();
            }
            catch (Exception ex)
            {
                if (ex.HResult.ToString() == "-2147024809")
                {
                    AccessHelper ah = new AccessHelper();
                    try
                    {
                        string strInSQL = "alter table Items add COLUMN Price4 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price5 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price6 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price7 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price8 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price9 float";
                        ah.ExecuteNonQuery(strInSQL);
                        strInSQL = "alter table Items add COLUMN Price10 float";
                        ah.ExecuteNonQuery(strInSQL);
                    }
                    catch (Exception)
                    {
                        ah.Close();
                        MessageBox.Show("数据库更新失败!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    ah.Close();
                }
            }

            //增加SetupConfig表的LoginNum字段
            try
            {
                AccessHelper ah     = new AccessHelper();
                string       strSQL = "select top 1 * from SetupConfig";
                DataTable    dtSQL  = ah.SelectToDataTable(strSQL);
                if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["LoginNum"].ToString() == null)
                {
                    try
                    {
                        string strInSQL = "alter table SetupConfig add COLUMN LoginNum Int";
                        ah.ExecuteNonQuery(strInSQL);
                    }
                    catch (Exception)
                    {
                        ah.Close();
                        MessageBox.Show("数据库更新失败!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["LoginNum"].ToString() != null)
                {
                    if (dtSQL.Rows[0]["LoginNum"].ToString() != "")
                    {
                        intLoginNum = int.Parse(dtSQL.Rows[0]["LoginNum"].ToString());
                    }
                    else
                    {
                        intLoginNum = 0;
                    }
                }
                ah.Close();
            }
            catch (Exception ex)
            {
                if (ex.HResult.ToString() == "-2147024809")
                {
                    AccessHelper ah = new AccessHelper();
                    try
                    {
                        string strInSQL = "alter table SetupConfig add COLUMN LoginNum Int";
                        ah.ExecuteNonQuery(strInSQL);
                    }
                    catch (Exception)
                    {
                        ah.Close();
                        MessageBox.Show("数据库更新失败!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    string    strSQL = "select top 1 * from SetupConfig";
                    DataTable dtSQL  = ah.SelectToDataTable(strSQL);
                    if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["LoginNum"].ToString() != null)
                    {
                        if (dtSQL.Rows[0]["LoginNum"].ToString() != "")
                        {
                            intLoginNum = int.Parse(dtSQL.Rows[0]["LoginNum"].ToString());
                        }
                        else
                        {
                            intLoginNum = 0;
                        }
                    }
                    ah.Close();
                }
            }

            //增加SetupConfig表的Version字段
            try
            {
                AccessHelper ah     = new AccessHelper();
                string       strSQL = "select top 1 * from SetupConfig";
                DataTable    dtSQL  = ah.SelectToDataTable(strSQL);
                if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["Version"].ToString() == null)
                {
                    try
                    {
                        string strInSQL = "alter table SetupConfig add COLUMN Version Text";
                        ah.ExecuteNonQuery(strInSQL);
                    }
                    catch (Exception)
                    {
                        ah.Close();
                        MessageBox.Show("数据库更新失败!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["Version"].ToString() != null)
                {
                    if (dtSQL.Rows[0]["Version"].ToString() != "")
                    {
                        strVersion = dtSQL.Rows[0]["Version"].ToString();
                    }
                    else
                    {
                        strVersion = "";
                    }
                }
                ah.Close();
            }
            catch (Exception ex)
            {
                if (ex.HResult.ToString() == "-2147024809")
                {
                    AccessHelper ah = new AccessHelper();
                    try
                    {
                        string strInSQL = "alter table SetupConfig add COLUMN Version text";
                        ah.ExecuteNonQuery(strInSQL);
                    }
                    catch (Exception)
                    {
                        ah.Close();
                        MessageBox.Show("数据库更新失败!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    string    strSQL = "select top 1 * from SetupConfig";
                    DataTable dtSQL  = ah.SelectToDataTable(strSQL);
                    if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["Version"].ToString() != null)
                    {
                        if (dtSQL.Rows[0]["Version"].ToString() != "")
                        {
                            strVersion = dtSQL.Rows[0]["Version"].ToString();
                        }
                        else
                        {
                            strVersion = "";
                        }
                    }
                    ah.Close();
                }
            }

            //增加Users表的EmpDate字段
            try
            {
                AccessHelper ah     = new AccessHelper();
                string       strSQL = "select top 1 * from Users";
                DataTable    dtSQL  = ah.SelectToDataTable(strSQL);
                if (dtSQL.Rows.Count > 0 && dtSQL.Rows[0]["EmpDate"].ToString() == null)
                {
                    try
                    {
                        string strInSQL = "alter table Users add COLUMN EmpDate Datetime";
                        ah.ExecuteNonQuery(strInSQL);
                    }
                    catch (Exception)
                    {
                        ah.Close();
                        MessageBox.Show("数据库更新失败!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                ah.Close();
            }
            catch (Exception ex)
            {
                if (ex.HResult.ToString() == "-2147024809")
                {
                    AccessHelper ah = new AccessHelper();
                    try
                    {
                        string strInSQL = "alter table Users add COLUMN EmpDate Datetime";
                        ah.ExecuteNonQuery(strInSQL);
                    }
                    catch (Exception)
                    {
                        ah.Close();
                        MessageBox.Show("数据库更新失败!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    ah.Close();
                }
            }
        }
Beispiel #8
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            strConnstring = XMLHelper.strGetConnectString().Split(';')[1].ToString().Split('=')[1].ToString();
            strlock       = strConnstring.Substring(0, strConnstring.LastIndexOf("\\") + 1) + "PurchaseLock";
            string url = strConnstring.Substring(0, strConnstring.LastIndexOf("\\") + 1) + "DBCache\\";

            if (!Directory.Exists(url))         //如果不存在就创建file文件夹                 
            {
                Directory.CreateDirectory(url); //创建该文件夹 
            }
            strTempDB = url + GetASCII(txtName.Text) + ".accdb";
            CacheHelper.ConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strTempDB;
            if (!File.Exists(strTempDB))
            {
                string strNullDB = ".\\null.accdb";
                if (File.Exists(strNullDB))
                {
                    try
                    {
                        File.Copy(strNullDB, strTempDB, true);
                    }
                    catch
                    {
                        MessageBox.Show("临时文件夹创建失败!数据库目录权限不足!系统运行异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("系统文件null.accdb丢失!请重新安装!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            if (!File.Exists(".\\内购SQLQueue.accdb"))
            {
                MessageBox.Show("系统文件内购SQLQueue.accdb丢失!请重新安装!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                try
                {
                    //SqlQueue sq = new SqlQueue();
                    //sq.InsertQuery("select * from ")
                }
                catch
                {
                }
            }
            if (!File.Exists(strlock) && File.Exists(strTempDB))
            {
                try
                {
                    string       strTSQL = "select * from SetupConfig";
                    AccessHelper ahTSQL  = new AccessHelper();
                    DataTable    dtTSQL  = ahTSQL.SelectToDataTable(strTSQL);
                    ahTSQL.Close();
                    if (GetComputerName().Substring(0, 3) == "OC1" || txtName.Text.ToLower() == "administrator")
                    {
                        UpdateDataBase();
                    }
                    if (strVersion == Application.ProductVersion)
                    {
                        LoginProcess();
                    }
                    else if (strVersion == "" || CompareVersion(Application.ProductVersion, strVersion))
                    {
                        if (GetComputerName().Substring(0, 3) == "OC1" || txtName.Text.ToLower() == "administrator")
                        {
                            string       strSQL = "update SetupConfig set Version='" + Application.ProductVersion + "' ";
                            AccessHelper ah     = new AccessHelper();
                            ah.ExecuteSQLNonquery(strSQL);
                            ah.Close();
                        }
                        LoginProcess();
                    }
                    else
                    {
                        MessageBox.Show("系统版本过低,请先升级后再重新登录使用!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (Exception ex)
                {
                    if (txtName.Text.ToLower() == "administrator" || GetComputerName().Substring(0, 3) == "OC1")
                    {
                        MessageBox.Show("数据库损坏,点击确定后,系统将尝试自动修复,期间请勿操作!::" + ex.Message, "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        string strResult = RepairAccess(strConnstring);
                        if (strResult.Substring(0, 5) != "Error")
                        {
                            MessageBox.Show("数据库修复完成,请关闭系统,并重新登录!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("数据库修复失败::" + strResult, "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBox.Show("数据库损坏,稍后将由上海办公室修复,请稍后重新登录!::" + ex.Message, "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            else
            {
                if (File.Exists(strTempDB))
                {
                    string strRepairUser = File.ReadAllText(strlock);
                    MessageBox.Show("登陆失败::数据库正在计算机: " + strRepairUser + " 启用自动修复中,请稍后重新登录!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    MessageBox.Show("登陆失败::远端缓存库联络失败,请联系管理员!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }