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(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(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 ActionResult Action(int id, string guid, string modell1, string modell2) { Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart = new Orm.Orm_conf_all_shopcart(); orm_Conf_All_Shopcart.id = id; orm_Conf_All_Shopcart.guid = guid; orm_Conf_All_Shopcart.modell1 = modell1; orm_Conf_All_Shopcart.modell2 = modell2; string query = "delete from conf_all_shopcart where id=@id 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)); }
public ActionResult Action(int proid, string guid, string modell1, string modell2) { string query = "select * from conf_all_shopcart where proid=" + proid + " and guid='" + guid + "' and modell1='" + modell1 + "' and modell2='" + modell2 + "'"; Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart_Selected = dbConnection.Query <Orm.Orm_conf_all_shopcart>(query).FirstOrDefault(); if (orm_Conf_All_Shopcart_Selected != null) { Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart = new Orm.Orm_conf_all_shopcart(); orm_Conf_All_Shopcart.proid = proid; orm_Conf_All_Shopcart.guid = guid; orm_Conf_All_Shopcart.count = orm_Conf_All_Shopcart_Selected.count + 1; orm_Conf_All_Shopcart.udt = DateTime.Now.ToString(); orm_Conf_All_Shopcart.modell1 = modell1; orm_Conf_All_Shopcart.modell2 = modell2; 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)); } else { Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart = new Orm.Orm_conf_all_shopcart(); orm_Conf_All_Shopcart.proid = proid; orm_Conf_All_Shopcart.guid = guid; orm_Conf_All_Shopcart.count = 1; orm_Conf_All_Shopcart.cdt = DateTime.Now.ToString(); orm_Conf_All_Shopcart.udt = DateTime.Now.ToString(); orm_Conf_All_Shopcart.modell1 = modell1; orm_Conf_All_Shopcart.modell2 = modell2; query = "insert into conf_all_shopcart(guid,proid,count,cdt,udt,modell1,modell2) values(@guid,@proid,@count,@cdt,@udt,@modell1,@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)); } }
public ActionResult Action(string postdata) { JC_ShopingCartItemIDList jC_ShopingCartItemIDList = (JC_ShopingCartItemIDList)JsonConvert.DeserializeObject(postdata); foreach (JC_ShopingCartItemIDList_Item activeid in jC_ShopingCartItemIDList.idlist) { Orm.Orm_conf_all_shopcart orm_Conf_All_Shopcart = new Orm.Orm_conf_all_shopcart(); orm_Conf_All_Shopcart.id = activeid.id; orm_Conf_All_Shopcart.guid = jC_ShopingCartItemIDList.guid; orm_Conf_All_Shopcart.modell1 = activeid.modell1; orm_Conf_All_Shopcart.modell2 = activeid.modell2; string query = "delete from conf_all_shopcart where id=@id 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)); }