public ActionResult Shoppingcart(string freceiver, string femail, string faddress) { string fuserid = (Session["member"] as tmember).fuserid; string guid = Guid.NewGuid().ToString(); torder order = new torder(); order.forderguid = guid; order.fuserid = fuserid; order.freceiver = freceiver; order.femail = femail; order.faddress = faddress; order.fdate = DateTime.Now; shopping.torders.Add(order); var carlist = shopping.torderdetails.Where(m => m.fisapproved == "否" && m.fuserid == fuserid).ToList(); foreach (var item in carlist) { item.forderguid = guid; item.fisapproved = "是"; } shopping.SaveChanges(); return(RedirectToAction("OrderList")); }
public t f_calc_order_atonet_fast_kvl(t args) { DataSet ds = this["ds"].f_val<DataSet>(); DataRow o_dr = args["o_dr"].f_val<DataRow>(); //DataGrid dg_ds = args["dg_ds"].f_def(new DataGrid()).f_val<DataGrid>(); /* foreach (DataColumn c in o_dr.Table.Columns) { MessageBox.Show(c.ColumnName + " " + o_dr[c.ColumnName]); } */ //расчет изделий nerocalc torder order = new torder(dbconn._db, o_dr, true);//, pb); t_d_f_calc d_f_calc = new t_d_f_calc(delegate(torder ord) { ord.f_calc_atonet_fast_33_99(new t() { { "clear_mc", true } }); }); d_f_calc.BeginInvoke(order, new AsyncCallback(delegate(IAsyncResult ar) { MessageBox.Show(ds.Tables["modelcalc"].Rows.Count.ToString()); AsyncResult result = (AsyncResult)ar; //t_f<t, t> caller = (t_f<t, t>)result.AsyncDelegate; /* if (dg_ds.InvokeRequired) { dg_ds.Invoke(new t_f<t, t>(delegate(t args_1) { dg_ds.DataSource = order.args.ds; return new t(); }), new object[] { new t() }); } dg_ds.DataSource = order.args.ds; */ // Retrieve the format string that was passed as state // information. //t args = (t)ar.AsyncState; MessageBox.Show("f_calc_done"); }), null); return new t(); }
public t f_load_wd_order_ds(t args) { t_wd wd = new t_wd(); //инициализация соединения с базой wd.f_init(new t()); //получение строки заказа DataTable tab_order = wd.f_tab_order(new t() { {"idorder","100489"} })["tab_order"].f_val<DataTable>(); //инициализация расчета заказа //при этом будет сформирован dataset заказа //это наша цель torder order = new torder(dbconn._db, tab_order.Rows[0]);//, pb); //забираем сформированный dataset this["ds"].f_set(order.args.ds); return new t(); }
public t f_init(t args) { DataRow o_dr = args["o_dr"].f_val<DataRow>(); this["ds"] = args["ds"]; this["dbconn"] = args["dbconn"]; //если это внешний расчет //инициализируем подключение к базе if (args["is_out_calc"].f_bool()) { f_init_out(args); } //если строка заказа не передана if (o_dr == null&&1==0) { //строка заказа DataTable tab_order = f_tab_order(new t() { {"tab_name", "orders"}, {"idorder", "4671"} //{"idorder", "97785"} //{"idorder","95740"} //{"idorder","96785"} })["orders"].f_val<DataTable>(); if (tab_order.Rows.Count > 0) { o_dr = tab_order.Rows[0]; } } //если сеть еще не загружена загружаем ее if (this["calc_atonet"].f_val() == null&&1==0) { DataSet ds = args["ds"].f_def(this["ds"].f_val<DataSet>()).f_val<DataSet>(); this["ds"].f_set(ds); atonet_fast.tatonet good_calc_atonet = new atonet_fast.tatonet(); //расчет изделий nerocalc torder order = new torder(dbconn._db, o_dr);//, pb); //загружаем kvl конфигурацию матераилов в сеть order.f_inject_good_kvl_conf(new t() { {"atonet",good_calc_atonet}, {"ds",ds}, }); this["calc_atonet"].f_set(good_calc_atonet); } return this; }