Esempio n. 1
0
        private void btnChongZhi_Click(object sender, EventArgs e)
        {
            DataOperator dop = new DataOperator(UccRuntime.SqlConfig);
            User user = new User();
            user.UserID = this.txtUserID.Text;
            user = dop.SelectSingle(user) as User;

            double shishou = 0;
            if (double.TryParse(this.txtShiShou.Text, out shishou))
                user.Money += shishou;
            double zengsong = 0;
            if (double.TryParse(this.txtZengSong.Text, out zengsong))
                user.Money += zengsong;
            //user.Money = double.Parse(this.txtMoney.Text) + double.Parse(this.txtShiShou.Text) + int.Parse(this.txtZengSong.Text);
            dop.Update(user);

            MoneyHistory history = new MoneyHistory();
            history.UserID = this.txtUserID.Text;
            history.UserName = this.txtUserName.Text;
            history.MoneyID = "M" + DateTime.Now.ToString("yyyyMMdd") + dop.Count<MoneyHistory>();
            history.MoneyTime = DateTime.Now;
            history.ShiShouMoney = shishou;
            history.ZengSongMoney = zengsong;
            dop.Insert(history);
            dop.Commit();

            MessageBox.Show("操作成功!");
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string excelPath = AppDomain.CurrentDomain.BaseDirectory + "abc.xlsx";
            var conn = ExcelHelper.CreateConnection("abc.xlsx", ExcelHelper.ExcelVerion.Excel2007);
            conn.Open();
            var dt = ExcelHelper.GetWorkBookName(conn);

            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    for(int j=0;j<dt.Columns.Count;j++)
            //    {
            //        Console.Write("  " + dt.Rows[i][j].ToString() + "  ");
            //    }
            //}

            int lines = 0;
            var ds = ExcelHelper.ExecuteDataSet(conn, "SELECT * FROM  [Sheet2$]", null);
            for (int main = 0; main < ds.Tables.Count;main++ )
            {
                for (int i = 0; i < ds.Tables[main].Rows.Count; i++)
                {
                    for (int j = 0; j < ds.Tables[main].Columns.Count; j++)
                    {
                        Console.Write("  " + ds.Tables[main].Rows[i][j].ToString() + "  ");
                    }
                    Console.WriteLine("test:"+ds.Tables[main].Rows[i][1].ToString());
                    YiFuPriceType data = new YiFuPriceType();
                    data.YiFuName = ds.Tables[main].Rows[i][0].ToString();
                    data.Price = ds.Tables[main].Rows[i][1].ToString();
                    SqlConfig config = new SqlConfig(DataDriverType.Sqlite, "UCC_", "", "~db.db");
                    DataOperator dop = new DataOperator(config);
                    //var tmp = dop.SelectSingle(data) as YiFuPriceType;
                    YiFuPriceType tmp = null;
                    if (tmp == null)
                    {
                        data.YiFuPriceID = dop.Count<YiFuPriceType>().ToString();
                        data.YiFuName = ds.Tables[main].Rows[i][0].ToString();
                        data.Cat = ds.Tables[main].Rows[i][2].ToString();
                        data.IsZheKou = int.Parse(ds.Tables[main].Rows[i][3].ToString());
                        data.Price = ds.Tables[main].Rows[i][1].ToString();
                        dop.Insert<YiFuPriceType>(data);
                        dop.Commit();
                    }

                    lines++;
                    Console.WriteLine();

                }
            }

            Console.WriteLine("lines:" + lines);
            Console.ReadKey();
        }
        public ActionResult Message(ContactMessage m)
        {
            SqlConfig config = new SqlConfig(DataDriverType.Sqlite, "SoftWare_", "", "~/App_Data/db.db");
            DataOperator dop = new DataOperator(config);

            try
            {
                m.CMID = DateTime.Now.ToString("yyyyMMdd") + dop.Count<ContactMessage>();
                dop.Insert(m);
                dop.Commit();
                ViewBag.Message = "操作成功!我们的业务员会及时的联系您!";
            }
            catch
            {
                ViewBag.Message = "操作失败!试试换种方式和我们联系吧!";
            }
            return View();
        }
Esempio n. 4
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string path = UccRuntime.SqlConfig.DataBasePath.Replace("~", AppDomain.CurrentDomain.BaseDirectory);
            if (File.Exists(path))
                File.Delete(path);
            DataOperator dop = new DataOperator(UccRuntime.SqlConfig);

            dop.CreateTable<User>();
            dop.CreateTable<YiFu>();
            dop.CreateTable<ShouYi>();
            dop.CreateTable<MoneyHistory>();

            dop.CreateTable<XiaCi>();
            dop.CreateTable<YanSe>();
            dop.CreateTable<PinPai>();
            dop.CreateTable<YiFuPriceType>();
            dop.CreateTable<ChongZhiType>();

            dop.Commit();

            //xiace
            var table= SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/clothes_error.txt");
            for(int i=0;i<table.Rows.Count;i++)
            {
                XiaCi item = new XiaCi();
                item.XiaCiID = dop.Count<XiaCi>().ToString();
                item.XiaCiContent = table.Rows[i][1].ToString();
                dop.Insert(item);
                dop.Commit();
            }
            table = SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/clothes_color.txt");
            for(int i=0;i<table.Rows.Count;i++)
            {
                YanSe item = new YanSe();
                item.YanSeID = dop.Count<YanSe>().ToString();
                item.YanSeName = table.Rows[i][1].ToString();
                dop.Insert(item);
                dop.Commit();
            }
            table = SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/clothes_pinpai.txt");
            for(int i=0;i<table.Rows.Count;i++)
            {
                PinPai item = new PinPai();
                item.PinPaiID = dop.Count<PinPai>().ToString();
                item.PinPaiName = table.Rows[i][0].ToString();
                dop.Insert(item);
                dop.Commit();
            }
            table = SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/clothes.txt");
            for (int i = 0; i < table.Rows.Count; i++)
            {
                YiFuPriceType item = new YiFuPriceType();
                item.YiFuPriceID = dop.Count<YiFuPriceType>().ToString();
                item.YiFuName = table.Rows[i][1].ToString();
                item.DanWei = table.Rows[i][2].ToString();
                item.Price = table.Rows[i][3].ToString();
                dop.Insert(item);
                dop.Commit();
            }
            table = SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/register_money.txt");
            for (int i = 0; i < table.Rows.Count; i++)
            {
                ChongZhiType item = new ChongZhiType();
                item.ChonZhiMoney = double.Parse(table.Rows[i][0].ToString());
                item.ZengSongMoney = double.Parse(table.Rows[i][1].ToString());
                dop.Insert(item);
                dop.Commit();
            }
            dop.Commit();
            MessageBox.Show("操作成功!");
        }