public void Bind(YiFuPriceType yifuPrice) { Result =yifuPrice; this.txtPrice.Text = Result.Price; this.txtName.Text = Result.YiFuName; this.txtDanWei.Text = Result.DanWei; this.cbxIsZheKou.SelectedIndex = Result.IsZheKou; }
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(); }
private void btnOK_Click(object sender, EventArgs e) { Result = new YiFuPriceType(); foreach(var item in this.flowLayoutPanel1.Controls) { var button = item as RadioButton; if (button.Checked) { var list = UccRuntime.Dop.Select<YiFuPriceType>(); for (int i = 0; i < list.Count; i++) { if (button.Text == list[i].YiFuName) { Result = list[i]; } } } } this.Close(); }
public double GetMoney(ShouYi ticket, List<YiFu> yiFuList) { double sum = 0; double dazhe = 0; foreach (var item in yiFuList) { YiFuPriceType pinpai = new YiFuPriceType(); pinpai.YiFuName = item.ClotheType; pinpai = UccRuntime.Dop.SelectSingle(pinpai) as YiFuPriceType; if (pinpai != null) { if (pinpai.IsZheKou > 0) dazhe += double.Parse(item.Price); else sum += double.Parse(item.Price); } else { sum += double.Parse(item.Price); } } return sum + dazhe * 0.1 * ticket.ZheKou; }
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("操作成功!"); }
void yifuTypeList_DoubleClick(object sender, EventArgs e) { this.txtClotheType.Text = this.yifuTypeList.SelectedItem.ToString(); this.yifuTypeList.Hide(); YiFuPriceType type=new YiFuPriceType(); type.YiFuName=this.txtClotheType.Text; type = UccRuntime.Dop.SelectSingle(type) as YiFuPriceType; this.txtPrice.Text = type.Price; }