Ejemplo n.º 1
0
        public void Func_1()
        {
            int thisId = 0;
            int maxId  = 14016623;//Id号最大值

            try
            {
                using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
                {
                    string QuerySql = "select applicant from tm_ictm_copy where id=@id";
                    for (int i = 13630896; i <= maxId; i++)
                    {
                        thisId = i;
                        var a = db.Query <string>(QuerySql, new { id = i });
                        if (a.First() != null)
                        {
                            if (a.First().Length > 83)
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        private void button11_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "选择要转换的文件";
            //dlg.Filter = "Image files (*.jpg;*.bmp;*.gif)|*.jpg*.jpeg;*.gif;*.bmp|AllFiles (*.*)|*.*";
            string Str = "";

            if (DialogResult.OK == dlg.ShowDialog())
            {
                Str = dlg.FileName;
            }
            byte[] buffer = ConvertToBinary(Str);


            using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
            {
                //string sql = "insert into tm_files (fileId,name,contractContent) values (@fileId,@name,@contractContent)";
                //db.Execute(sql, new { fileId = "123456", name = "123456", contractContent = buffer });

                string sql  = "select contractContent from tm_files where id=@id";
                var    feer = db.Query(sql, new { id = 1428 }).First();
                byte[] fe   = feer.contractContent;
                ConvertToPdf(fe);
            }
            ConvertToPdf(buffer);
        }
Ejemplo n.º 3
0
        public void updateApplicant()
        {
            int thisId = 0;
            int maxId  = 14016623;//Id号最大值

            //string currentName = "";
            //string currentSpellCode = "";
            try
            {
                using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
                {
                    //string QuerySql = "select name from tm_ictm_copy where id=@id";
                    string QuerySql = "select regNum,ictm,name_1 from tm_ictm_copy where id=@id";
                    //string UpdateSql = "update tm_ictm_applicant set name_1=@SpellCode where id=@id;";
                    string UpdateSql = "insert into tm_ictm_applicant (regNum,ictm,name_1) values (@regNum,@ictm,@name_1)";
                    //var applicantCount = db.Query<int>().First();
                    //for (int i = 1; i <= maxId; i++)
                    //{
                    //    thisId = i;
                    //    var a = db.Query<string>(QuerySql, new { id = i });
                    //    if (!string.IsNullOrEmpty(a.First()))
                    //    {
                    //        currentName = a.First();
                    //        currentSpellCode = ChineseToSpell.ConvertToAllSpell(currentName);
                    //        db.Execute(UpdateSql, new { SpellCode = currentSpellCode, id = i });
                    //    }
                    //}
                    for (int i = 57980; i <= maxId; i++)
                    {
                        thisId = i;
                        var a = db.Query <tm>(QuerySql, new { id = i });
                        if (a.First() != null)
                        {
                            tm s = a.First();
                            db.Execute(UpdateSql, new { regNum = s.regNum, ictm = s.ictm, name_1 = s.name });
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StreamWriter sw = new StreamWriter(@"D:\商标名称转换拼音日志.txt");
                sw.WriteLine(string.Format("商标名称转换异常:{0}", ex.Message));
                string mesg = string.Format("id {0}", thisId.ToString());
                sw.WriteLine(mesg);
                sw.Close();
                if (ex.Message == "Incorrect key file for table '.\alibb_tm\tm_ictm_copy.MYI'; try to repair it")
                {
                    string repairSql = "repair table tm_ictm_copy;";
                    using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
                    {
                        db.Execute(repairSql);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int    maxId            = 14016623;//Id号最大值
            string currentName      = "";
            string currentSpellCode = "";

            try
            {
                using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
                {
                    string QuerySql  = "select name from tm_ictm_copy where id=@id";
                    string UpdateSql = "update tm_ictm_copy set name_1=@SpellCode where id=@id;";
                    //var applicantCount = db.Query<int>().First();
                    for (int i = 1; i <= maxId; i++)
                    {
                        var a = db.Query <string>(QuerySql, new { id = i });
                        if (a != null)
                        {
                            if (a.Count() > 0 && !string.IsNullOrEmpty(a.First()))
                            {
                                currentName      = a.First();
                                currentSpellCode = ChineseToSpell.ConvertToAllSpell(currentName);
                                var updateName_1 = db.Execute(UpdateSql, new { SpellCode = currentSpellCode, id = i });

                                StreamWriter sw = new StreamWriter(@"D:\商标名称转换拼音日志.txt");
                                sw.Write("");
                                string mesg = string.Format("id号:{0}  商标名称:{1}  拼音:{2}", i.ToString(), currentName, currentSpellCode);
                                sw.WriteLine(mesg);
                                this.textBox1.Text = mesg;
                                sw.Close();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StreamWriter sw = new StreamWriter(@"D:\商标名称转换拼音日志.txt");
                sw.WriteLine(string.Format("商标名称转换异常:{0}", ex.Message));
                sw.Close();
                this.textBox1.Text += ex.Message;
                if (ex.Message == "Incorrect key file for table '.\alibb_tm\tm_ictm_copy.MYI'; try to repair it")
                {
                    string repairSql = "repair table tm_ictm_copy;";
                    using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
                    {
                        db.Execute(repairSql);
                        this.textBox1.Text += "数据库修复成功,请继续";
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void button7_Click(object sender, EventArgs e)
        {
            string base64 = "";

            using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
            {
                string sql = "select content from tm_files where id=1404";
                base64 = db.Query <string>(sql).First().Substring(23);
            }
            //string base64 = this.textBox6.Text;
            long ds = base64.Length;
            BASE64_Image_Convert bic = new BASE64_Image_Convert();

            bic.Base64StringToImage(@"D:\th.jpg", base64);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 将图片数据转换为Base64字符串
        /// </summary>
        private void ToBase64()
        {
            Image           img          = this.pictureBox1.Image;
            BinaryFormatter binFormatter = new BinaryFormatter();
            MemoryStream    memStream    = new MemoryStream();

            binFormatter.Serialize(memStream, img);
            byte[] bytes  = memStream.GetBuffer();
            string base64 = Convert.ToBase64String(bytes);

            //this.textBox2.Text = base64;
            using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
            {
                string sql = "insert into tm_files (fileId,name,content) values (@fileId,@name,@content)";
                db.Execute(sql, new { fileId = "123456", name = "123456", content = base64 });
            }
        }
Ejemplo n.º 7
0
        private void button6_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title  = "选择要转换的图片";
            dlg.Filter = "Image files (*.jpg;*.bmp;*.gif)|*.jpg*.jpeg;*.gif;*.bmp|AllFiles (*.*)|*.*";
            string imgStr = "";

            if (DialogResult.OK == dlg.ShowDialog())
            {
                imgStr = ImgToBase64String(dlg.FileName);
            }
            using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
            {
                string sql = "insert into tm_files (fileId,name,content) values (@fileId,@name,@content)";
                db.Execute(sql, new { fileId = "123456", name = "123456", content = imgStr });
            }
        }
Ejemplo n.º 8
0
        private void button5_Click(object sender, EventArgs e)
        {
            using (var db = DbEntry.MySqlDb(SqlConst.DB_NAME_ALBBWEB))
            {
                string        queryInvalidUser = "******";
                List <string> l = db.Query <string>(queryInvalidUser).ToList();
                File.CreateText(@"D:\无效客户电话.txt");
                string str = "";
                foreach (var item in l)
                {
                    str += item;
                    str += "\n";
                }

                StreamWriter sw = new StreamWriter(@"D:\商标状态.txt");
                sw.Write("");
                sw.Write(str);
            }
        }