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("操作成功!"); }
public ActionResult DoAdd(Category category) { DataOperator dop = new DataOperator(Runtime.SqlConfig); dop.Insert(category); dop.Commit(); TemplateDataHelper.Categories = null; return Redirect("/Admin/Success.do"); }
public ActionResult DoAdd(Article article) { DataOperator dop = new DataOperator(Runtime.SqlConfig); article.ArticleID = Guid.NewGuid().ToString(); article.ATime = DateTime.Now; article.AR = 0; dop.Insert(article); dop.Commit(); return Redirect("/Admin/Success.do"); }
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 Backup(string store, string name) { DataOperator dop = new DataOperator(config); BackUpInfo info = new BackUpInfo(); info.BackUpID = Roo.Utils.StringBuilderHelper.GenerateStringID(); info.BackUpTime = DateTime.Now; info.FileName = name; info.StoreName = store; dop.Insert(info); dop.Commit(); OperateMessage m = new OperateMessage(true, "操作成功!"); return Json(m, JsonRequestBehavior.AllowGet); }
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(); }
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("操作成功!"); }
private void btnKaiDan_Click(object sender, EventArgs e) { try { foreach(var item in GetYiFuList()) { foreach(var tempItem in GetYiFuList()) { if (tempItem != item && item.ClotheID == tempItem.ClotheID) { MessageBox.Show("衣服里面有重复的衣服单号!请检查一下!衣服单号:" + item.ClotheID); return; } } } DataOperator dop = new DataOperator(UccRuntime.SqlConfig); if (Ticket == null) Ticket = new ShouYi(); Ticket.TicketID = this.txtTicketID.Text; var temp = dop.SelectSingle(Ticket) as ShouYi; if (temp != null) { MessageBox.Show("此单号已经开过!请重新开单!"); return; } Ticket.UserID = this.txtUserID.Text; Ticket.UserName = this.txtUserName.Text; Ticket.PhoneNo = this.txtPhone.Text; Ticket.Address = this.txtAddress.Text; Ticket.PutWay = this.cbxPutWay.SelectedItem.ToString(); Ticket.Price = this.txtThisMoney.Text; Ticket.State = "未洗"; Ticket.MoneyState = this.cbxMoneyState.Text; Ticket.ShouYiDateTime = DateTime.Parse(this.datePutIn.Text); Ticket.QuYiDateTime = DateTime.Parse(this.datePutOut.Text); Ticket.ZheKou = double.Parse(this.cbxZheKou.Text); dop.Insert(Ticket); for (int i = 0; i < this.YiFuList.Count; i++) { var item = this.YiFuList[i]; item.ClotheID = item.TicketID + "-" + (i + 1); dop.Insert(item); } dop.Commit(); MessageBox.Show("操作成功!"); } catch (Exception ex) { MessageBox.Show("操作失败!" + ex.Message + ex.StackTrace); } }