public ActionResult Action(int proid, string guid) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("ShopingCartUpdate"); try { string query = "select * from conf_all_shopcart where proid=" + proid + " and guid='" + guid + "' and selected='1'"; Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart_selected = dbConnection.Query <Orm.Orm_conf_all_shopcart>(query).FirstOrDefault(); Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart = new Orm.Orm_conf_all_shopcart(); orm_Conf_All_Shopcart.guid = guid; orm_Conf_All_Shopcart.proid = proid; if (orm_Conf_All_Shopcart_selected != null) { orm_Conf_All_Shopcart.selected = "0"; } else { orm_Conf_All_Shopcart.selected = "1"; } orm_Conf_All_Shopcart.udt = DateTime.Now.ToString(); query = "update conf_all_shopcart set selected=@selected where proid=@proid and guid=@guid"; dbConnection.Execute(query, orm_Conf_All_Shopcart); Conf_ResponseMessage conf_ResponseMessageObj = new Conf_ResponseMessage(); conf_ResponseMessageObj.code = "200"; conf_ResponseMessageObj.status = "ok"; conf_ResponseMessageObj.message = "Executed"; HttpContext.Response.StatusCode = 200; return(Json(conf_ResponseMessageObj)); } catch (Exception err) { globalTestingLog.AddRecord("stace", err.StackTrace); globalTestingLog.AddRecord("msg", err.Message); return(Content("")); } }
public ActionResult Action(int proid, string guid, int count, string modell1, string modell2) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("ShopingCartUpdate"); try { Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart = new Orm.Orm_conf_all_shopcart(); orm_Conf_All_Shopcart.guid = guid; orm_Conf_All_Shopcart.proid = proid; orm_Conf_All_Shopcart.count = count; orm_Conf_All_Shopcart.modell1 = modell1; orm_Conf_All_Shopcart.modell2 = modell2; orm_Conf_All_Shopcart.udt = DateTime.Now.ToString(); string query = "update conf_all_shopcart set count=@count,udt=@udt where proid=@proid and guid=@guid and modell1=@modell1 and modell2=@modell2"; dbConnection.Execute(query, orm_Conf_All_Shopcart); Conf_ResponseMessage conf_ResponseMessageObj = new Conf_ResponseMessage(); conf_ResponseMessageObj.code = "200"; conf_ResponseMessageObj.status = "ok"; conf_ResponseMessageObj.message = "Executed"; HttpContext.Response.StatusCode = 200; return(Json(conf_ResponseMessageObj)); } catch (Exception err) { globalTestingLog.AddRecord("stace", err.StackTrace); globalTestingLog.AddRecord("msg", err.Message); return(Content("")); } }
public ActionResult Action(string imgkey) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("GetImg"); try { FileStream fs = new FileStream("images\\" + imgkey, FileMode.Open); globalTestingLog.AddRecord("Step", "1"); BinaryReader binaryReader = new BinaryReader(fs); globalTestingLog.AddRecord("Step", "2"); byte[] buffer = binaryReader.ReadBytes((int)fs.Length); globalTestingLog.AddRecord("Step", "3"); string base64 = Convert.ToBase64String(buffer); globalTestingLog.AddRecord("Step", "4"); binaryReader.Close(); fs.Close(); string[] filenameAttrs = imgkey.Split("."); globalTestingLog.AddRecord("Step", "5"); string entendType = filenameAttrs[filenameAttrs.Length - 1]; globalTestingLog.AddRecord("Step", "6"); string result = "data:image/"; result = result + entendType + ";base64,"; return(Content(result + base64)); } catch (Exception err) { globalTestingLog.AddRecord("Msg", err.Message); globalTestingLog.AddRecord("Stace", err.StackTrace); return(Content("")); } }
public ActionResult Action(string orderid) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("AllOrderDetail"); try { string query = "select * from conf_all_orders where orderid='" + orderid + "'"; Orm.Orm_conf_all_orders orm_Conf_All_Orders = dbConnection.Query <Orm.Orm_conf_all_orders>(query).FirstOrDefault(); JC_OrderOutput newItem = new JC_OrderOutput(); newItem.orderid = orm_Conf_All_Orders.orderid; newItem.disorderid = orm_Conf_All_Orders.cdt + "_" + orm_Conf_All_Orders.id; newItem.totalprice = orm_Conf_All_Orders.totalprice; newItem.shiped = orm_Conf_All_Orders.shipped; newItem.payed = orm_Conf_All_Orders.payed; newItem.cdt = orm_Conf_All_Orders.cdt; newItem.items = new List <JC_OrderOutput_ProItem>(); newItem.status = orm_Conf_All_Orders.status; Orm.Orm_conf_all_address orm_Conf_All_Address = new Orm.Orm_conf_all_address(); query = "select * from conf_all_address where id=" + orm_Conf_All_Orders.addressid; orm_Conf_All_Address = dbConnection.Query <Orm.Orm_conf_all_address>(query).FirstOrDefault(); if (orm_Conf_All_Address != null) { newItem.name = orm_Conf_All_Address.name; newItem.address = orm_Conf_All_Address.address; newItem.phone = orm_Conf_All_Address.phone; } query = "select * from conf_all_orders_proitems where orderid='" + newItem.orderid + "'"; List <Orm.Orm_conf_all_orders_proitems> orm_Conf_All_Orders_Proitem_lst = dbConnection.Query <Orm.Orm_conf_all_orders_proitems>(query).ToList(); foreach (Orm.Orm_conf_all_orders_proitems orm_Conf_All_Orders_Proitems_Tmp in orm_Conf_All_Orders_Proitem_lst) { JC_OrderOutput_ProItem newProItem = new JC_OrderOutput_ProItem(); newProItem.proid = orm_Conf_All_Orders_Proitems_Tmp.proid; query = "select * from conf_all_proitems where id=" + orm_Conf_All_Orders_Proitems_Tmp.proid; Orm.Orm_conf_all_proitems orm_Conf_All_Proitems = dbConnection.Query <Orm.Orm_conf_all_proitems>(query).FirstOrDefault(); newProItem.title = orm_Conf_All_Proitems.title; query = "select * from conf_all_proitems_imgs where proid=" + orm_Conf_All_Orders_Proitems_Tmp.proid + " and titleimg='1'"; Orm.Orm_conf_all_proitems_imgs orm_conf_all_proitems_imgs = dbConnection.Query <Orm.Orm_conf_all_proitems_imgs>(query).FirstOrDefault(); newProItem.img = orm_conf_all_proitems_imgs.imgpath; query = "select * from conf_all_proitems_price where proid=" + orm_Conf_All_Orders_Proitems_Tmp.proid + " and modell1='" + orm_Conf_All_Orders_Proitems_Tmp.modell1 + "' and modell2='" + orm_Conf_All_Orders_Proitems_Tmp.modell2 + "'"; Orm.Orm_conf_all_proitems_price orm_Conf_All_Proitems_Price = dbConnection.Query <Orm.Orm_conf_all_proitems_price>(query).FirstOrDefault(); newProItem.price = orm_Conf_All_Proitems_Price.discount > 0 ? orm_Conf_All_Proitems_Price.basic * (orm_Conf_All_Proitems_Price.discount / 100.0) : orm_Conf_All_Proitems_Price.basic; newProItem.count = orm_Conf_All_Orders_Proitems_Tmp.count; newProItem.modell1 = orm_Conf_All_Orders_Proitems_Tmp.modell1; newProItem.modell2 = orm_Conf_All_Orders_Proitems_Tmp.modell2; newItem.items.Add(newProItem); } return(Json(newItem)); } catch (Exception err) { globalTestingLog.AddRecord("stace", err.StackTrace); globalTestingLog.AddRecord("msg", err.Message); Conf_ResponseMessage conf_ResponseMessageObj = new Conf_ResponseMessage(); conf_ResponseMessageObj.code = "500"; conf_ResponseMessageObj.status = "error"; conf_ResponseMessageObj.message = "Faild to execute"; HttpContext.Response.StatusCode = 500; return(Json(conf_ResponseMessageObj)); } }
public ActionResult Action(string code) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("GetOpenOD"); Global.GlobalFunctions globalFunctions = new Global.GlobalFunctions(); JC_OpenIDDefined obj = new JC_OpenIDDefined(); obj.openid = globalFunctions.GetOpenIDFromWX(code); globalTestingLog.AddRecord("OPENID", obj.openid); return(Json(obj)); }
public ActionResult Action(int topicid) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("MainSelectedProducts"); try { List <JC_TopicProducts> result = new List <JC_TopicProducts>(); string query = "select * from conf_all_proitems where id in ( select proid from conf_main_topics_products where topicsid = " + topicid + ") "; List <Orm.Orm_conf_all_proitems> lst_Orm_conf_all_proitems = dbConnection.Query <Orm.Orm_conf_all_proitems>(query).ToList(); foreach (Orm.Orm_conf_all_proitems orm_Conf_All_Proitems_tmp in lst_Orm_conf_all_proitems) { //Code JC_TopicProducts newitem = new JC_TopicProducts(); newitem.proid = orm_Conf_All_Proitems_tmp.id; newitem.title = orm_Conf_All_Proitems_tmp.title; newitem.des = orm_Conf_All_Proitems_tmp.des; query = "select * from conf_all_proitems_price where proid=" + orm_Conf_All_Proitems_tmp.id; List <Orm.Orm_conf_all_proitems_price> orm_Conf_All_Proitems_Price = dbConnection.Query <Orm.Orm_conf_all_proitems_price>(query).ToList(); if (orm_Conf_All_Proitems_Price != null && orm_Conf_All_Proitems_Price.Count > 0) { newitem.basicprice = orm_Conf_All_Proitems_Price[0].basic; newitem.price = orm_Conf_All_Proitems_Price[0].discount > 0 ? orm_Conf_All_Proitems_Price[0].basic * (orm_Conf_All_Proitems_Price[0].discount / 100.0) : orm_Conf_All_Proitems_Price[0].basic; } else { newitem.basicprice = 0; newitem.price = 0; } query = "select * from conf_all_proitems_imgs where proid=" + newitem.proid; Orm.Orm_conf_all_proitems_imgs orm_Conf_All_Proitems_Imgs = dbConnection.Query <Orm.Orm_conf_all_proitems_imgs>(query).First(); if (orm_Conf_All_Proitems_Imgs != null) { newitem.img = orm_Conf_All_Proitems_Imgs.imgpath; } newitem.type_topics = topicid.ToString(); globalTestingLog.AddRecord("Step", "2"); globalTestingLog.AddRecord("proid", newitem.proid.ToString()); result.Add(newitem); } return(Json(result)); } catch (Exception err) { globalTestingLog.AddRecord("stack:", err.StackTrace); globalTestingLog.AddRecord("msg:", err.Message); Conf_ResponseMessage conf_ResponseMessageObj = new Conf_ResponseMessage(); conf_ResponseMessageObj.code = "500"; conf_ResponseMessageObj.status = "Error"; conf_ResponseMessageObj.message = err.Message; HttpContext.Response.StatusCode = 500; return(Json(conf_ResponseMessageObj)); } }
public ActionResult Action(string guid) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("GetShopingCart"); try { Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart = new Orm.Orm_conf_all_shopcart(); orm_Conf_All_Shopcart.guid = guid; string query = "select * from conf_all_shopcart where guid=@guid"; List <Orm.Orm_conf_all_shopcart> lst_orm_Conf_All_Shopcarts = dbConnection.Query <Orm.Orm_conf_all_shopcart>(query, orm_Conf_All_Shopcart).ToList(); List <JC_ShopCartItem> lst_result = new List <JC_ShopCartItem>(); foreach (Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart_tmp_obj in lst_orm_Conf_All_Shopcarts) { JC_ShopCartItem tmpItemObj = new JC_ShopCartItem(); tmpItemObj.shopingcartid = orm_Conf_All_Shopcart_tmp_obj.id; tmpItemObj.proid = orm_Conf_All_Shopcart_tmp_obj.proid; tmpItemObj.count = orm_Conf_All_Shopcart_tmp_obj.count; tmpItemObj.selected = orm_Conf_All_Shopcart_tmp_obj.selected; tmpItemObj.modell1 = orm_Conf_All_Shopcart_tmp_obj.modell1; tmpItemObj.modell2 = orm_Conf_All_Shopcart_tmp_obj.modell2; Orm.Orm_conf_all_proitems orm_Conf_All_Proitems = new Orm.Orm_conf_all_proitems(); orm_Conf_All_Proitems.id = tmpItemObj.proid; string tmpQuery = "select * from conf_all_proitems where id = @id"; Orm.Orm_conf_all_proitems orm_Conf_All_Proitems_Selected = dbConnection.Query <Orm.Orm_conf_all_proitems>(tmpQuery, orm_Conf_All_Proitems).First(); tmpItemObj.title = orm_Conf_All_Proitems_Selected.title; Orm.Orm_conf_all_proitems_imgs orm_Conf_All_Proitems_Imgs = new Orm.Orm_conf_all_proitems_imgs(); orm_Conf_All_Proitems_Imgs.proid = orm_Conf_All_Shopcart_tmp_obj.proid; tmpQuery = "select * from conf_all_proitems_imgs where proid=@proid and titleimg='1'"; Orm.Orm_conf_all_proitems_imgs orm_Conf_All_Proitems_Imgs_Selected = dbConnection.Query <Orm.Orm_conf_all_proitems_imgs>(tmpQuery, orm_Conf_All_Proitems_Imgs).First(); tmpItemObj.img = orm_Conf_All_Proitems_Imgs_Selected.imgpath; Orm.Orm_conf_all_proitems_price orm_Conf_All_Proitems_Price = new Orm.Orm_conf_all_proitems_price(); orm_Conf_All_Proitems_Price.proid = orm_Conf_All_Shopcart_tmp_obj.proid; tmpQuery = "select * from conf_all_proitems_price where proid=@proid and modell1='" + orm_Conf_All_Shopcart_tmp_obj.modell1 + "' and modell2='" + orm_Conf_All_Shopcart_tmp_obj.modell2 + "'"; List <Orm.Orm_conf_all_proitems_price> orm_Conf_All_Proitems_Price_Selected = dbConnection.Query <Orm.Orm_conf_all_proitems_price>(tmpQuery, orm_Conf_All_Proitems_Price).ToList(); tmpItemObj.basicprice = orm_Conf_All_Proitems_Price_Selected[0].basic; tmpItemObj.discount = orm_Conf_All_Proitems_Price_Selected[0].discount; tmpItemObj.price = tmpItemObj.discount > 0 ? tmpItemObj.basicprice * (tmpItemObj.discount / 100.0) : tmpItemObj.basicprice; lst_result.Add(tmpItemObj); } return(Json(lst_result)); } catch (Exception err) { globalTestingLog.AddRecord("Stace:", err.StackTrace); globalTestingLog.AddRecord("Msg:", err.Message); return(Content(" ")); } }
public FileContentResult Action(string imgkey) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("GetBinImg"); try { FileStream fs = new FileStream("images\\" + imgkey, FileMode.Open); BinaryReader binaryReader = new BinaryReader(fs); byte[] buffer = binaryReader.ReadBytes((int)fs.Length); binaryReader.Close(); fs.Close(); return(File(buffer, "image/png")); } catch (Exception err) { globalTestingLog.AddRecord("Msg", err.Message); globalTestingLog.AddRecord("Stace", err.StackTrace); return(null); } }
public ActionResult Action(string data) { Global.GlobalTestingLog globalTestingLog = new Global.GlobalTestingLog("SetConfAllOrdersNew"); try { if (string.IsNullOrEmpty(data)) { Conf_ResponseMessage conf_ResponseMessageObj = new Conf_ResponseMessage(); conf_ResponseMessageObj.code = "500"; conf_ResponseMessageObj.status = "error"; conf_ResponseMessageObj.message = "faild to execute"; HttpContext.Response.StatusCode = 500; return(Json(conf_ResponseMessageObj)); } else { JC_ConfAllOrders jC_ConfAllOrders = (JC_ConfAllOrders)JsonConvert.DeserializeObject(data, typeof(JC_ConfAllOrders)); string query = ""; double totalprice = 0.0; string orderid = Guid.NewGuid().ToString(); foreach (JC_ConfAllOrders_Item shopingcartitem in jC_ConfAllOrders.items) { totalprice = totalprice + shopingcartitem.price; if (shopingcartitem.shopcartid != null && shopingcartitem.shopcartid > 0) { query = "delete from conf_all_shopcart where id=" + shopingcartitem.shopcartid; dbConnection.Execute(query); } query = "insert into conf_all_orders_proitems(proid,orderid,count,modell1,modell2) values(" + shopingcartitem.proid + ",'" + orderid + "'," + shopingcartitem.count + ",'" + shopingcartitem.modell1 + "','" + shopingcartitem.modell2 + "')"; dbConnection.Execute(query); } string cdt = DateTime.Now.ToString("yyyyMMdd"); query = "insert into conf_all_orders(orderid,payed,cdt,returned,addressid,guid,totalprice,shiped,status) values('" + orderid + "','0','" + cdt + "','0','" + jC_ConfAllOrders.addressid + "','" + jC_ConfAllOrders.guid + "'," + totalprice + ",'0','1')"; dbConnection.Execute(query); Orm.Orm_conf_all_address orm_Conf_All_Address = new Orm.Orm_conf_all_address(); query = "select * from conf_all_address where id=" + jC_ConfAllOrders.addressid; orm_Conf_All_Address = dbConnection.Query <Orm.Orm_conf_all_address>(query).FirstOrDefault(); if (orm_Conf_All_Address != null) { Orm.Orm_conf_all_orders_address orm_conf_all_orders_address = new Orm.Orm_conf_all_orders_address(); orm_conf_all_orders_address.guid = orm_Conf_All_Address.guid; orm_conf_all_orders_address.name = orm_Conf_All_Address.name; orm_conf_all_orders_address.country = orm_Conf_All_Address.country; orm_conf_all_orders_address.city = orm_Conf_All_Address.city; orm_conf_all_orders_address.state = orm_Conf_All_Address.state; orm_conf_all_orders_address.district = orm_Conf_All_Address.district; orm_conf_all_orders_address.address = orm_Conf_All_Address.address; orm_conf_all_orders_address.phone = orm_Conf_All_Address.phone; orm_conf_all_orders_address.orderid = orderid; query = "insert into conf_all_orders_address(orderid,guid,name,country,state,city,district,address,phone) values(@orderid,@guid,@name,@country,@state,@city,@district,@address,@phone)"; dbConnection.Execute(query, orm_conf_all_orders_address); } Conf_ResponseMessage conf_ResponseMessageObj = new Conf_ResponseMessage(); conf_ResponseMessageObj.code = "200"; conf_ResponseMessageObj.status = "OK"; conf_ResponseMessageObj.message = orderid; HttpContext.Response.StatusCode = 200; return(Json(conf_ResponseMessageObj)); } } catch (Exception err) { globalTestingLog.AddRecord("stace", err.StackTrace); globalTestingLog.AddRecord("msg", err.Message); Conf_ResponseMessage conf_ResponseMessageObj = new Conf_ResponseMessage(); conf_ResponseMessageObj.code = "500"; conf_ResponseMessageObj.status = "error"; conf_ResponseMessageObj.message = "User existed."; HttpContext.Response.StatusCode = 500; return(Json(conf_ResponseMessageObj)); } }