public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     string str = Commons.StringHelper.JsonOutString(false, "保存产品信息失败!");
     string strModel = Commons.WebPage.PageRequest.getJsonString();
     JavaScriptSerializer serializer = new JavaScriptSerializer();
     Model.products.productsInfo model = new Model.products.productsInfo();
     model = serializer.Deserialize<Model.products.productsInfo>(strModel);
     string fileName = saveFile(context.Request.Files);
     if (model != null)
     {
         if (model.piID > 0)
         {
             if (editData(model, fileName))
             {
                 str = Commons.StringHelper.JsonOutString(true, "保存产品信息成功!");
             }
         }
         else
         {
             if (addData(model, fileName))
             {
                 str = Commons.StringHelper.JsonOutString(true, "保存产品信息成功!");
             }
         }
     }
     context.Response.Write(str);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     List<Model.products.productsInfo> lists = new List<Model.products.productsInfo>();
     Model.products.productsInfo model = new Model.products.productsInfo();
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     lists = orm.List(model, "").OfType<Model.products.productsInfo>().ToList();
     if (lists.Count > 0)
     {
         model = lists[0];
     }
     ltDetail.Text = model.piDetail;
 }
 private string loadData(int piID)
 {
     Model.products.productsInfo model = new Model.products.productsInfo();
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     model = (Model.products.productsInfo)orm.Load(model, piID);
     string str = "";
     if (model != null)
     {
         str = Newtonsoft.Json.JsonConvert.SerializeObject(model);
     }
     return str;
 }
        private bool editData(Model.products.productsInfo model, string fileName)
        {
            Model.products.productsInfo pi = new Model.products.productsInfo();
            skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
            pi = (Model.products.productsInfo)orm.Load(pi, model.piID);
            if (fileName.Trim() != "")
            {
                model.piMainPhoto = fileName;
            }
            model.createDate = pi.createDate;
            model.piSaleCount = pi.piSaleCount;

            return orm.Update(model);
        }
Beispiel #5
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     int pcID = Commons.WebPage.PageRequest.GetQueryInt("pcID");
     List<Model.products.productsInfo> lists = new List<Model.products.productsInfo>();
     Model.products.productsInfo model = new Model.products.productsInfo();
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     string strWhere = "";
     if (pcID > 0)
     {
         strWhere = "piID in(select piID from TypeProducts where ptID=" + pcID + ")";
     }
     lists = orm.List(model, strWhere).OfType<Model.products.productsInfo>().ToList();
     string str = "[]";
     str = Newtonsoft.Json.JsonConvert.SerializeObject(lists);
     context.Response.Write(str);
 }
Beispiel #6
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     int pageSize = Commons.WebPage.PageRequest.GetFormInt("rows");
     int index = Commons.WebPage.PageRequest.GetFormInt("page");
     int ptID = Commons.WebPage.PageRequest.GetFormInt("ptID");
     List<Model.products.productsInfo> lists = new List<Model.products.productsInfo>();
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     Model.products.productsInfo model = new Model.products.productsInfo();
     string strWhere = "";
     if (ptID > 0)
     {
         strWhere = "ptID=" + ptID;
     }
     lists = orm.ListPage(model, strWhere, "piID", pageSize, index).OfType<Model.products.productsInfo>().ToList();
     string str = Newtonsoft.Json.JsonConvert.SerializeObject(lists);
     context.Response.Write(str);
 }