예제 #1
0
 public captionCtrl(Form ParentForm)
 {
     CSoftInfo.getInstance().OnDefaultSiteNameEvent += new AsyncRainMapCaption(captionCtrl_OnDefaultSiteNameEvent);
     m_pDadForm    = ParentForm;
     m_pSoftUpdate = new SoftUpdate();
     InitializeComponent();
 }
예제 #2
0
파일: Program.cs 프로젝트: dovanduy/wlxm
        public static bool checkUpdateLoad()
        {
            bool       result = false;
            SoftUpdate app    = new SoftUpdate(Application.ExecutablePath, "ExceTransforCsv");

            try
            {
                if (app.IsUpdate && MessageBox.Show("检查到新版本,是否更新?", "版本检查", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    string path = Application.StartupPath.Replace("program", "");
                    System.Diagnostics.Process process = new System.Diagnostics.Process();
                    process.StartInfo.FileName         = "AutoUpdate.exe";
                    process.StartInfo.WorkingDirectory = path;//要掉用得exe路径例如:"C:\windows";
                    process.StartInfo.CreateNoWindow   = true;
                    process.Start();
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                result = false;
            }
            return(result);
        }
예제 #3
0
        private SoftUpdate MakeSoftUpdate(DataRow row)
        {
            SoftUpdate record = new SoftUpdate();

            if (row != null)
            {
                record.SetProperty(row);
            }
            return(record);
        }
예제 #4
0
        private void btn_th_Click(object sender, EventArgs e)
        {
            if (!SoftUpdate.PermissionsBalidation())
            {
                return;
            }
            THMainForm frm = new THMainForm();

            frm.ShowDialog();
        }
예제 #5
0
        private void lbl_sys_msg_Click(object sender, EventArgs e)
        {
            if (!SoftUpdate.PermissionsBalidation())
            {
                return;
            }
            frmDownload frm = new frmDownload(2);

            frm.ShowDialog();
        }
예제 #6
0
        private void btn_change_pwd_Click(object sender, EventArgs e)
        {
            if (!SoftUpdate.PermissionsBalidation())
            {
                return;
            }
            frmChangePwd frm = new frmChangePwd();

            frm.ShowDialog();
        }
예제 #7
0
        private void btn_pay_flow_Click(object sender, EventArgs e)
        {
            if (!SoftUpdate.PermissionsBalidation())
            {
                return;
            }
            frmSaleSum frm = new frmSaleSum();

            frm.ShowDialog();
        }
예제 #8
0
        private void btn_xsth_Click(object sender, EventArgs e)
        {
            if (!SoftUpdate.PermissionsBalidation())
            {
                return;
            }
            frmTHOrder frm = new frmTHOrder();

            frm.ShowDialog();
        }
예제 #9
0
        private void btn_item_cls_Click(object sender, EventArgs e)
        {
            if (!SoftUpdate.PermissionsBalidation())
            {
                return;
            }

            frmGoodsCls frm = new frmGoodsCls();

            frm.ShowDialog();
        }
예제 #10
0
 public int DeleteSoftUpdate(SoftUpdate data)
 {
     lock (lockObject)
     {
         if (data == null)
         {
             return(DataTypeModel.RESULT_NG);
         }
         StringBuilder sql = new StringBuilder();
         sql.Append(" DELETE FROM tb_softupdate  ");
         sql.Append("  WHERE SoftUpdateID = " + DatabaseUtility.Escape(data.SoftUpdateID));
         return(baseDAO.DoUpdate(sql.ToString()));
     }
 }
예제 #11
0
        private void btn_upload_Click(object sender, EventArgs e)
        {
            if (!SoftUpdate.PermissionsBalidation())
            {
                return;
            }
            if (!Program.is_connect)
            {
                (new MsgForm("网络异常")).ShowDialog();
                return;
            }
            frmUpload frm = new frmUpload();

            frm.ShowDialog();
        }
예제 #12
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="url">升级Url</param>
        public UpdateForm(SoftUpdate app)
        {
            InitializeComponent();
            this.Text = "更新中";

            //app = new SoftUpdate(url, Application.ExecutablePath, "zha7idle");
            app.UpdateFinish        += new UpdateState(app_UpdateFinish);
            app.UpdateProgressChage += App_UpdateProgressChage;
            try
            {
                if (app.IsUpdate)
                {
                    Thread update = new Thread(new ThreadStart(app.Update));
                    update.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #13
0
        private void checkUpdate()
        {
            CallbackMsg runMsg = this.setLableInfo;

            Invoke(runMsg, "正在检查更新...");
            SoftUpdate update = new SoftUpdate();

            update.UpdateStatusCallback = this.setLableInfo;
            long build = update.check(SoftBuild);

            if (build > SoftBuild)
            {
                //修改SoftBuild值
                AppConfigHelper.RootPath = Application.ExecutablePath;
                AppConfigHelper.SetAppSettingsValue("SoftBuild", build.ToString());
            }
            Invoke(runMsg, "hidden");

            //更新完成进入系统
            Invoke(runMsg, "正在加载资源...");
            Invoke(runMsg, "BootMain");
        }
예제 #14
0
        public int UpdateSoftUpdate(IDbConnection connection, IDbTransaction trans, SoftUpdate data)
        {
            lock (lockObject)
            {
                if (data == null)
                {
                    return(DataTypeModel.RESULT_NG);
                }

                StringBuilder sql = new StringBuilder();
                sql.Append(" UPDATE tb_softupdate ");
                sql.Append("  SET  ");
                sql.Append("      SoftUpdateVersion = " + data.SoftUpdateVersion.Escape()).Append(", ");
                sql.Append("      SoftUpdateSQL = " + data.SoftUpdateSQL.Escape()).Append(", ");
                sql.Append("      SoftUpdateData = " + data.SoftUpdateData.Escape()).Append(", ");
                sql.Append("      SoftUpdateSize = " + data.SoftUpdateSize.Escape()).Append(", ");
                sql.Append("      SoftUpdateUser = "******", ");
                sql.Append("      SoftUpdateTime = " + data.SoftUpdateTime.Escape()).Append(", ");
                sql.Append("      SoftUpdateKey = " + data.SoftUpdateKey.Escape());
                sql.Append("  WHERE SoftUpdateID = " + data.SoftUpdateID);
                return(baseDAO.DoUpdate(connection, trans, sql.ToString()));
            }
        }
예제 #15
0
 public int InsertSoftUpdate(IDbConnection connection, IDbTransaction trans, SoftUpdate data)
 {
     lock (lockObject)
     {
         if (data == null)
         {
             return(DataTypeModel.RESULT_NG);
         }
         StringBuilder sql = new StringBuilder();
         sql.Append(" INSERT INTO tb_softupdate (");
         sql.Append("            SoftUpdateVersion,");
         sql.Append("            SoftUpdateSQL,");
         sql.Append("            SoftUpdateData,");
         sql.Append("            SoftUpdateSize,");
         sql.Append("            SoftUpdateUser,");
         sql.Append("            SoftUpdateTime,");
         sql.Append("            SoftUpdateKey)");
         sql.Append("  VALUES( ");
         sql.Append("          " + data.SoftUpdateVersion.Escape()).Append(", ");
         sql.Append("          " + data.SoftUpdateSQL.Escape()).Append(", ");
         sql.Append("          " + data.SoftUpdateData.Escape()).Append(", ");
         sql.Append("          " + data.SoftUpdateSize.Escape()).Append(", ");
         sql.Append("          " + data.SoftUpdateUser.Escape()).Append(", ");
         sql.Append("          " + data.SoftUpdateTime.Escape()).Append(", ");
         sql.Append("          " + data.SoftUpdateKey.Escape()).Append(") ");
         int newId = baseDAO.DoInsert(connection, trans, sql.ToString());
         data.SoftUpdateID = newId;
         if (newId > 0)
         {
             return(newId);
         }
         else
         {
             return(DataTypeModel.RESULT_NG);
         }
     }
 }
예제 #16
0
        public void checkUpdate()
        {
            if (string.IsNullOrEmpty(config.UpdateUrl))
            {
                config.UpdateUrl = updateUrl;
            }

            SoftUpdate app = new SoftUpdate(config.UpdateUrl, Application.ExecutablePath, "zha7idle");

            try
            {
                MyMessageForm mMsgForm = new MyMessageForm();
                if (app.IsUpdate && mMsgForm.Show(string.Format("检查到新版本{0},是否更新?\r\n更新说明:\r\n{1}", app.NewVerson, app.UpdateHelp), "更新日志", MyMessageForm.MessageButton.YesNo) == DialogResult.Yes)
                {
                    upform = new UpdateForm(app);
                    upform.ShowDialog();
                }
                tmpnotice = app.Notice;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #17
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //
            path = Application.StartupPath;
            //注册表
            Registry();

            //
            Helper.Appsetting.path = Application.StartupPath;
            Helper.Appsetting.app_ini();
            //处理未捕获的异常
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            //处理UI线程异常
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            //处理非UI线程异常
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            try
            {
                //验证程序
                //if (SoftUpdate.VerifySoft() != 1)
                //{
                //    MessageBox.Show("没有找到加密狗!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //    System.Environment.Exit(0);
                //}


                //检查服务器
                IBLL.ICommonBLL bll = new BLL.CommonBLL();
                if ("0".Equals(bll.IsServer()))
                {
                    //var frmFindServer = new MainForm.frmFindServer();
                    //frmFindServer.ShowDialog();
                    MsgForm.ShowFrom("无法连接到服务器,请检查服务器连接");
                    return;
                }

                //更新中间件 手动验证
                if (!Debugger.IsAttached)
                {
                    SoftUpdate.Upadte();
                }

                //检查机号
                frmRegister frmreg = new frmRegister();
                if (frmreg.RegisterJH() == DialogResult.Yes)
                {
                    InitB2B();

                    frmLogin frm = new frmLogin();
                    if (frm.GoLogin() == DialogResult.Yes)
                    {
                        b2bclient.Program.oper_id = oper.oper_id;
                        b2bclient.Program.pwd     = oper.oper_pw;
                        b2bclient.Program.op_type = oper.oper_type;
                        Application.Run(new frmMain());
                    }
                }
            }
            catch (Exception e)
            {
                string str         = "";
                string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now + "\r\n";

                if (e != null)
                {
                    str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息:{1}\r\n异常信息:{2}\r\n",
                                        e.GetType().Name, e.Message, e.StackTrace);
                }
                else
                {
                    str = string.Format("应用程序线程错误:{0}", e);
                }
                LogHelper.writeLog("Main", str);

                MessageBox.Show("系统错误!Message:" + e.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            System.Environment.Exit(0);
        }
예제 #18
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //
            path = Application.StartupPath;
            //注册表
            Registry();

            /*
             * IBLL.IPayBLL pbll = new BLL.PayBLL();
             * string sheet_no = "";
             * Program.jh = "001";
             * pbll.MicroPay("81231000525321", "W", 0.01M, "135495986333499595", out sheet_no);
             */

            //处理未捕获的异常
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            //处理UI线程异常
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            //处理非UI线程异常
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            try
            {
                //更新软件
                if (!Debugger.IsAttached)
                {
                    SoftUpdate.Update();
                }


                //验证程序
                //if (SoftUpdate.VerifySoft() != 1)
                //{
                //    MessageBox.Show("没有找到加密狗!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //    System.Environment.Exit(0);
                //}

                //创建数据库文件
                try
                {
                    if (!System.IO.Directory.Exists(path + "\\logs"))
                    {
                        System.IO.Directory.CreateDirectory(path + "\\logs");
                    }
                    if (!System.IO.Directory.Exists(path + "\\setting"))
                    {
                        System.IO.Directory.CreateDirectory(path + "\\setting");
                    }
                    if (System.IO.Directory.Exists(path + "\\data") == false)
                    {
                        System.IO.Directory.CreateDirectory(path + "\\data");
                    }
                    string db_file = Application.StartupPath + "\\data\\data";
                    if (System.IO.File.Exists(db_file) == false)
                    {
                        SQLiteByHandClose.CreateFile(db_file);
                    }
                    conn = "Data Source=" + db_file + ";Version=3;Pooling=False;Max Pool Size=100;";
                    var db = new DB.SQLiteByHandClose(conn);
                    db.Open();
                    Program.db = db;
                    Program.db.ExecuteScalar("PRAGMA synchronous = OFF;", null);
                    create_table.bt_sysn_info.Upgrade(db);
                    create_table.bt_par_setting.Upgrade(db);
                    create_table.bi_t_item_cls.Upgrade(db);
                    create_table.bi_t_item_info.Upgrade(db);
                    create_table.bi_t_supcust_info.Upgrade(db);
                    create_table.ic_t_branch_stock.Upgrade(db);
                    create_table.ot_pay_flow.Upgrade(db);
                    create_table.ic_t_inout_store_detail.Upgrade(db);
                    create_table.ic_t_inout_store_master.Upgrade(db);
                    create_table.sa_t_operator_i.Upgrade(db);
                    create_table.sm_t_salesheet.Upgrade(db);
                    create_table.sm_t_salesheet_detail.Upgrade(db);
                    create_table.t_order_detail.Upgrade(db);
                    create_table.bi_t_branch_info.Upgrade(db);
                    create_table.sys_t_sheet_no.Upgrade(db);
                    create_table.bi_t_cust_price.Upgrade(db);
                    create_table.bi_t_sup_item.Upgrade(db);
                    create_table.sys_t_system.Upgrade(db);
                    create_table.t_print_log.Upgrade(db);
                    create_table.t_clear_db_log.Upgrade(db);
                    create_table.t_click_log.Upgrade(db);
                }
                catch (Exception ex)
                {
                    Log.writeLog("创建数据库失败", ex.ToString(), null);
                    var frm = new Forms.MsgForm(ex.GetMessage());
                    frm.ShowDialog();
                    return;
                    //throw ex;
                }

                //检测打印机参数设置
                if (Appsetting.is_print == "1" && Appsetting.print_name == "")
                {
                    var frm = new Forms.MsgForm("请先设置打印机");
                    frm.ShowDialog();
                    return;
                }

                //删除过期数据
                IBLL.ISysBLL bll = new BLL.SysBLL();
                if (1 == 1)
                {
                    try
                    {
                        bll.DeleteOldData();
                    }
                    catch (Exception ex)
                    {
                        Log.writeLog("删除过期数据失败", ex.ToString(), null);
                        var frm = new Forms.MsgForm(ex.GetMessage());
                        frm.ShowDialog();
                    }
                }

                //
                ReadWeight = new BLL.ReadWeight_Common();
                is_run     = true;
                try
                {
                    Thread t = new Thread(() => {
                        while (true)
                        {
                            try
                            {
                                IBLL.IClientBLL bll2 = new BLL.ClientBLL();
                                //判断网络连接状态
                                is_connect = bll2.CheckConnect();

                                for (var i = 0; i < 30; i++)
                                {
                                    Thread.Sleep(1000);
                                    if (!is_run)
                                    {
                                        System.Environment.Exit(0);
                                        break;
                                    }
                                }

                                //30秒自动上传销售和采购数据
                                if (is_connect && is_login)
                                {
                                    int errId     = 0;
                                    string errMsg = "";
                                    bll2.UpLoadSale(out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.UpLoadInOut(out errId, out errMsg);
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("网络异常[2001]:" + ex.GetMessage());
                            }
                        }
                    });
                    t.Start();
                }
                catch (Exception ex)
                {
                    Log.writeLog("连接服务器异常", ex.ToString(), null);
                    var frm = new Forms.MsgForm(ex.GetMessage());
                    frm.ShowDialog();
                }
                //判断基础档案更新
                try
                {
                    Thread t = new Thread(() =>
                    {
                        while (true)
                        {
                            try
                            {
                                IBLL.IClientBLL bll2 = new BLL.ClientBLL();
                                int errId            = 0;
                                string errMsg        = "";
                                item_count           = bll2.GetItemCount(out errId, out errMsg);
                                sup_count            = bll2.GetSupCusCount(out errId, out errMsg);
                                cus_price_count      = bll2.GetCusPriceCount("", "", out errId, out errMsg);
                                sup_price_count      = bll2.GetSupPriceCount("", "", out errId, out errMsg);


                                if (is_connect && is_login)
                                {
                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadItemCls(out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadItem(out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadSupCus(out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadCusPrice("", "", out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadSupPrice("", "", out errId, out errMsg);
                                }

                                Thread.Sleep(5 * 60 * 1000);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("网络异常[2002]:" + ex.GetMessage());
                            }
                        }
                    });
                    t.Start();
                }
                catch (Exception ex)
                {
                    Log.writeLog("判断基础档案更新异常", ex.ToString(), null);
                }
                //
                try
                {
                    var lst = bll.GetParSettingList();
                    foreach (Model.bt_par_setting item in lst)
                    {
                        if (item.par_id == "mo_ling")
                        {
                            mo_ling = item.par_val;
                        }
                        else if (item.par_id == "weight_model")
                        {
                            weight_model = item.par_val;
                        }
                        else if (item.par_id == "branch_no")
                        {
                            branch_no = item.par_val;
                        }
                        else if (item.par_id == "jh")
                        {
                            jh = item.par_val;
                        }
                        else if (item.par_id == "input_cus_model")
                        {
                            input_cus_model = item.par_val;
                        }
                        else if (item.par_id == "print_count")
                        {
                            print_count = Conv.ToInt(item.par_val);
                        }
                        else if (item.par_id == "can_input_qty")
                        {
                            can_input_qty = item.par_val;
                        }
                        else if (item.par_id == "is_continue_weight")
                        {
                            is_continue_weight = item.par_val;
                        }
                    }
                    if (branch_no.Length == 0)
                    {
                        if (new Forms.frmInitSetting().ShowDialog() == DialogResult.OK)
                        {
                            if (new Forms.WaitForm("正在加载数据,请稍候", "1").ShowWait())
                            {
                                if (new Forms.NewLoginForm().Login())
                                {
                                    Application.Run(new Forms.frmMenu());
                                }
                            }
                        }
                        else
                        {
                            System.Environment.Exit(0);
                        }
                    }
                    else
                    {
                        if (new Forms.WaitForm("正在加载数据,请稍候", "1").ShowWait())
                        {
                            if (new Forms.NewLoginForm().Login())
                            {
                                Application.Run(new Forms.frmMenu());
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.writeLog("系统异常", ex.ToString(), null);
                    var frm = new Forms.MsgForm(ex.GetMessage());
                    frm.ShowDialog();
                }
            }
            catch (Exception e)
            {
                string str         = "";
                string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";

                if (e != null)
                {
                    str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息:{1}\r\n异常信息:{2}\r\n",
                                        e.GetType().Name, e.Message, e.StackTrace);
                }
                else
                {
                    str = string.Format("应用程序线程错误:{0}", e);
                }
                Log.writeLog("Main", str);

                MessageBox.Show("系统错误!Message:" + e.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #19
0
        public static void DoUpdateDatabaseSQL()
        {
            SanitaLog.d(TAG, "DoUpdateDatabaseSQL--START");

            try
            {
                IBaseDao baseDAO = MediboxDatabaseUtility.GetDatabaseDAO();

                //Get connection
                using (IDbConnection connection = baseDAO.GetConnection())
                {
                    //Open connection
                    connection.Open();

                    //Begin transtation
                    using (IDbTransaction trans = connection.BeginTransaction())
                    {
                        //Check sql
                        SoftUpdate mSoftUpdate = SoftUpdateDB.mInstance.GetSoftUpdate_Simple(connection, trans);
                        SanitaLog.d(TAG, "Database sql = " + mSoftUpdate.SoftUpdateSQL);
                        SanitaLog.d(TAG, "Software sql = " + MediboxDatabaseUtility.GetDatabaseVersion());

                        if (MediboxDatabaseUtility.GetDatabaseVersion().GetDouble() > mSoftUpdate.SoftUpdateSQL.GetDouble())
                        {
                            SanitaLog.d(TAG, "BEGIN UPDATE SQL");
                            int hosobenhan_partion = 0;

                            if (mLocalDatabase.SynchDatabase(connection, trans, null, hosobenhan_partion, false))
                            {
                                SanitaLog.d(TAG, "UPDATE SUCCESS !");
                                mSoftUpdate.SoftUpdateSQL = MediboxDatabaseUtility.GetDatabaseVersion();
                                if (mSoftUpdate.SoftUpdateID > 0)
                                {
                                    if (SoftUpdateDB.mInstance.UpdateSoftUpdate_SQL(connection, trans, mSoftUpdate) < 0)
                                    {
                                        SanitaLog.d(TAG, "UPDATE SQL VERSION TO DATABASE NG !");

                                        //Rollback
                                        trans.Rollback();
                                        connection.Close();
                                        return;
                                    }
                                }
                                else
                                {
                                    if (SoftUpdateDB.mInstance.InsertSoftUpdate(connection, trans, mSoftUpdate) < 0)
                                    {
                                        SanitaLog.d(TAG, "INSERT SQL VERSION TO DATABASE NG !");

                                        //Rollback
                                        trans.Rollback();
                                        connection.Close();
                                        return;
                                    }
                                }
                            }

                            SanitaLog.d(TAG, "END UPDATE SQL");
                        }

                        //-----------------------------------------------------------------------------
                        //Commit transtation
                        trans.Commit();

                        //Close connection
                        connection.Close();
                    }
                }

                SanitaLog.d(TAG, "DoUpdateDatabaseSQL--END");
            }
            catch (Exception ex)
            {
                SanitaLog.e(TAG, ex);
            }
        }
예제 #20
0
        static void Main(string[] args)
        {
            try
            {
                path = Application.StartupPath;
                if (Directory.Exists(path + "\\images") == false)
                {
                    Directory.CreateDirectory(path + "\\images");
                }
                if (Directory.Exists(path + "\\log") == false)
                {
                    Directory.CreateDirectory(path + "\\log");
                }
                if (Directory.Exists(path + "\\db") == false)
                {
                    Directory.CreateDirectory(path + "\\db");
                }
                if (System.IO.Directory.Exists(path + "\\setting") == false)
                {
                    System.IO.Directory.CreateDirectory(path + "\\setting");
                }
                //
                System.Threading.ThreadPool.SetMinThreads(100, 100);
                System.Threading.ThreadPool.SetMaxThreads(1000, 1000);
                //
                Console.WriteLine("开始");
                string str = Appsetting.conn;
                //更新
                if (!Debugger.IsAttached)
                {
                    SoftUpdate.Upadte();
                }

                //
                if (1 == 1)
                {
                    Register(typeof(svr.IServiceBase), typeof(svr.ServiceBase), Appsetting.port, "/servicebase");
                    Register(typeof(svr.IServiceBase), typeof(svr.item_cls), Appsetting.port, "/item_cls");
                    Register(typeof(svr.IServiceBase), typeof(svr.region), Appsetting.port, "/region");
                    Register(typeof(svr.IServiceBase), typeof(svr.sup), Appsetting.port, "/sup");
                    Register(typeof(svr.IServiceBase), typeof(svr.cus), Appsetting.port, "/cus");
                    Register(typeof(svr.IServiceBase), typeof(svr.item), Appsetting.port, "/item");
                    Register(typeof(svr.IServiceBase), typeof(svr.dep), Appsetting.port, "/dep");
                    Register(typeof(svr.IServiceBase), typeof(svr.people), Appsetting.port, "/people");
                    Register(typeof(svr.IServiceBase), typeof(svr.payment), Appsetting.port, "/payment");
                    Register(typeof(svr.IServiceBase), typeof(svr.bank), Appsetting.port, "/bank");
                    Register(typeof(svr.IServiceBase), typeof(svr.branch), Appsetting.port, "/branch");
                    Register(typeof(svr.IServiceBase), typeof(svr.oper), Appsetting.port, "/oper");
                    //
                    Register(typeof(svr.IServiceBase), typeof(svr.settle), Appsetting.port, "/settle");
                    Register(typeof(svr.IServiceBase), typeof(svr.common), Appsetting.port, "/common");
                    Register(typeof(svr.IServiceBase), typeof(svr.sys), Appsetting.port, "/sys");
                    //
                    Register(typeof(svr.IServiceBase), typeof(svr.price), Appsetting.port, "/price");
                    Register(typeof(svr.IServiceBase), typeof(svr.finance), Appsetting.port, "/finance");
                    Register(typeof(svr.IServiceBase), typeof(svr.inout), Appsetting.port, "/inout");
                    Register(typeof(svr.IServiceBase), typeof(svr.check), Appsetting.port, "/check");
                    //
                    Register(typeof(svr.IServiceBase), typeof(svr.cur_price_order), Appsetting.port, "/cus_price_order");
                    Register(typeof(svr.IServiceBase), typeof(svr.cus_fy), Appsetting.port, "/cus_fy");
                    Register(typeof(svr.IServiceBase), typeof(svr.sup_fy), Appsetting.port, "/sup_fy");
                    Register(typeof(svr.IServiceBase), typeof(svr.fy_order), Appsetting.port, "/fy_order");
                    Register(typeof(svr.IServiceBase), typeof(svr.cash_order), Appsetting.port, "/cash_order");
                    //
                    Register(typeof(svr.IServiceBase), typeof(svr.sup_settle), Appsetting.port, "/sup_settle");
                    Register(typeof(svr.IServiceBase), typeof(svr.cus_settle), Appsetting.port, "/cus_settle");
                    //
                    Register(typeof(svr.IServiceBase), typeof(svr.report), Appsetting.port, "/report");
                    Register(typeof(svr.IServiceBase), typeof(svr.mydestop), Appsetting.port, "/mydestop");
                    Register(typeof(svr.IServiceBase), typeof(svr.print), Appsetting.port, "/print");

                    Register(typeof(svr.IServiceBase), typeof(svr.update), Appsetting.port, "/update");
                }

                while (true)
                {
                    string val = Console.ReadLine();
                    if (val == "exit")
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.writeLog(ex);
            }
        }
예제 #21
0
        //C:\Program Files\YCRO\Digital 更新路径
        public static void Runmain()
        {
            bool  bCreatedNew;
            Mutex m = new Mutex(false, "myUniqueName", out bCreatedNew);



            RegistryKey YCRO = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Autodesk\AutoCAD\R16.2\ACAD-4001:409\Applications\YRO_Digital");

            object path = YCRO.GetValue("LOADER");

            SoftUpdate app = new SoftUpdate(path.ToString(), "UpdateProgram.zip");

            app.UpdateFinish += new UpdateState(app_UpdateFinish);

            if (app.IsUpdate)
            {
                System.Diagnostics.Process.Start(Path.GetDirectoryName(path.ToString()) + "\\" + "UpdateSoftProgram.exe");
                Application.Exit();
                closeapp();
            }

            else
            {
                if (bCreatedNew)
                {
                    //try
                    //{
                    //    ////处理未捕获的异常
                    //    //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                    //    ////处理UI线程异常
                    //    //Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                    //    ////处理非UI线程异常
                    //    //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                    //    Application.EnableVisualStyles();
                    //    Application.SetCompatibleTextRenderingDefault(false);
                    //    //LoginForm lform = new LoginForm();
                    //    //if (lform.ShowDialog() == DialogResult.OK)
                    //    //{
                    //    //    string sqlStr = string.Empty;
                    //    //    string user_name = lform.LoginUserName;
                    //    //    User.Get_CurrentUser(user_name);
                    //    //    Application.Run(new MDIForm());
                    //    //}
                    //}
                    //catch (System.Exception ex)
                    //{
                    //    string str = "";
                    //    string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";

                    //    if (ex != null)
                    //    {
                    //        str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息:{1}\r\n异常信息:{2}\r\n",
                    //             ex.GetType().Name, ex.Message, ex.StackTrace);
                    //    }
                    //    else
                    //    {
                    //        str = string.Format("应用程序线程错误:{0}", ex);
                    //    }


                    //    writeLog(str);
                    //    MessageBox.Show(str);
                    //    //MessageBox.Show("发生致命错误,请及时联系作者!", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //    Application.Exit();

                    //}
                }
            }
        }
예제 #22
0
        static void Main()
        {
            bool       bCreatedNew;
            Mutex      m   = new Mutex(false, "myUniqueName", out bCreatedNew);
            SoftUpdate app = new SoftUpdate(Application.ExecutablePath, "UpdateProgram.zip");

            app.UpdateFinish += new UpdateState(app_UpdateFinish);

            if (app.IsUpdate)
            {
                Application.Exit();
                System.Diagnostics.Process.Start(Application.StartupPath + "\\" + "UpdateSoftProgram.exe");
            }

            else
            {
                if (bCreatedNew)
                {
                    try
                    {
                        //处理未捕获的异常
                        Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                        //处理UI线程异常
                        Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                        //处理非UI线程异常
                        AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        LoginForm lform = new LoginForm();
                        if (lform.ShowDialog() == DialogResult.OK)
                        {
                            string sqlStr    = string.Empty;
                            string user_name = lform.LoginUserName;
                            User.Get_CurrentUser(user_name);
                            Application.Run(new MDIForm());
                        }
                    }
                    catch (Exception ex)
                    {
                        string str         = "";
                        string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";

                        if (ex != null)
                        {
                            str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息:{1}\r\n异常信息:{2}\r\n",
                                                ex.GetType().Name, ex.Message, ex.StackTrace);
                        }
                        else
                        {
                            str = string.Format("应用程序线程错误:{0}", ex);
                        }


                        writeLog(str);
                        MessageBox.Show(str);
                        //MessageBox.Show("发生致命错误,请及时联系作者!", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Application.Exit();
                    }
                }
            }
        }
예제 #23
0
        private void label14_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                if (txt_branch_no.Text.Trim().Length == 0)
                {
                    new MsgForm("机构编码不能为空").ShowDialog();
                    return;
                }
                string mo_ling         = "0";
                string weight_model    = "1";
                string input_cus_model = "1";
                if (radioButton2.Checked)
                {
                    mo_ling = "1";
                }
                else if (radioButton3.Checked)
                {
                    mo_ling = "2";
                }
                else if (radioButton4.Checked)
                {
                    mo_ling = "3";
                }

                if (radioButton6.Checked)
                {
                    weight_model = "2";
                }

                if (radioButton8.Checked)
                {
                    input_cus_model = "2";
                }

                var can_input_qty = "1";
                if (!chk_input_qty.Checked)
                {
                    can_input_qty = "0";
                }

                var is_continue_weight = "0";
                if (chk_continue_weight.Checked)
                {
                    is_continue_weight = "1";
                }

                IBLL.ISysBLL bll = new BLL.SysBLL();
                var          lst = new List <Model.bt_par_setting>();
                lst.Add(new Model.bt_par_setting {
                    par_id = "mo_ling", par_val = mo_ling
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "weight_model", par_val = weight_model
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "branch_no", par_val = txt_branch_no.Text
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "jh", par_val = txt_jh.Text
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "input_cus_model", par_val = input_cus_model
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "print_count", par_val = txt_print_count.Text
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "can_input_qty", par_val = can_input_qty
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "is_continue_weight", par_val = is_continue_weight
                });
                bll.UpdateParSetting(lst);
                Program.mo_ling            = mo_ling;
                Program.weight_model       = weight_model;
                Program.branch_no          = txt_branch_no.Text;
                Program.jh                 = txt_jh.Text;
                Program.input_cus_model    = input_cus_model;
                Program.print_count        = Conv.ToInt(txt_print_count.Text);
                Program.can_input_qty      = can_input_qty;
                Program.is_continue_weight = is_continue_weight;
                if (!SoftUpdate.PermissionsBalidation())
                {
                    IBLL.IClientBLL bll2   = new BLL.ClientBLL();
                    int             errId  = 0;
                    string          errMsg = "";
                    bll2.DownLoadOper(out errId, out errMsg);
                }

                var frm = new MsgForm("修改参数设置成功");
                frm.ShowDialog();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                new MsgForm(ex.GetMessage()).ShowDialog();
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }