Esempio n. 1
0
        /// <summary>
        /// 线程,链接数据库,并初始化
        /// </summary>
        private static void InitConnect()
        {
            string ConStr = string.Format("server={0};port={1};uid={2};pwd={3};database={4};charset={5};Connection Timeout=15;AllowUserVariables=true;Compress=true", ServerSet.FileObj.host, ServerSet.FileObj.port, ServerSet.FileObj.id, ServerSet.FileObj.psw, ServerSet.FileObj.data, ServerSet.FileObj.coding);
            try
            {
                lia.ConnectionString = ConStr;
                lia.Open();
            }
            catch (Exception ce)
            {
                error = "\r\n错误信息:" + ce.Message;
                Comdata.WriteLog(ConStr + "\r\n" + ce.Message);
                return;
            }

            if (Comdata.AllColor == null)
            {
                washmange.sql.Color GetC = new washmange.sql.Color();
                washmange.sql.Xiaci GetX = new washmange.sql.Xiaci();
                washmange.sql.Brand GetB = new washmange.sql.Brand();
                washmange.sql.YangShi GetY = new washmange.sql.YangShi();
                //获取所有颜色
                Comdata.AllColor = GetC.GetAll();
                //瑕疵
                Comdata.AllXiaci = GetX.GetAll();
                //品牌
                Comdata.AllBrand = GetB.GetAll();
                //样式
                Comdata.AllYs = sql.YangShi.GetAllList();
            }

            #if !ALONE

            int newVer = Mysqlcom.es("select vVerId from wa_version order by vid desc limit 1");
            if (newVer > 0)
            {
                if (newVer > Comdata.VersionId)
                {
                    try
                    {
                        if (!DownFile.DownExe())
                            return;
                    }
                    catch (Exception ce)
                    {
                        Comdata.WriteLog("DownExe failed!\r\n" + ce.Message);
                        return;
                    }

                    System.Diagnostics.Process.Start(Application.StartupPath + "\\洗衣更新.exe");
                    Application.Exit();
                }
            }
            #endif
        }
Esempio n. 2
0
        private void 添加瑕疵ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            washmange.sql.Xiaci xia = new washmange.sql.Xiaci();
            washmange.sql.Brand bran = new washmange.sql.Brand();
            this.Activate();

            if (listBox4.Focused)
            {
                input insert = new input("添加瑕疵", "请输入瑕疵:", false);
                insert.openIME();
                insert.ShowDialog();
                if (insert.value == "" || insert.value == "-1")
                    return;

                xia.Xname = insert.value;
                if (!xia.Insert())
                {
                    MessageBox.Show("添加失败:" + Mysqlcom.error);
                    return;
                }
                Comdata.AllXiaci = xia.GetAll();
                listBox4.Items.Add(insert.value);
            }

            else if (listBox5.Focused)
            {
                input insert = new input("添加品牌", "请输入品牌:", false);
                insert.openIME();
                insert.ShowDialog();
                if (insert.value == "" || insert.value == "-1")
                    return;

                bran.Bname = insert.value;
                if (!bran.Insert())
                {
                    MessageBox.Show("添加失败:" + Mysqlcom.error);
                    return;
                }
                Comdata.AllBrand = bran.GetAll();
                listBox5.Items.Add(insert.value);
            }
        }