Ejemplo n.º 1
0
        /// <summary>
        /// 资源详情页面数据
        /// </summary>
        /// <returns></returns>
        public JsonResult ResDetail()
        {
            string result = "0";
            string html = "";
            try
            {
                ResEntity resInfo = db.Single<ResEntity>(long.Parse(Request["row_key"]));

                if (resInfo == null)
                    resInfo = new ResEntity();

                ViewData["resInfo"] = resInfo;
                html = Utility.RenderPartialViewToString(this, "ResDesignDetail");
                result = "1";
            }
            catch (Exception ex)
            {

            }
            return new JsonResult() { Data = new { result, html } };

        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string data = Encoding.UTF8.GetString(this.Request.BinaryRead(Request.ContentLength));

                if (string.IsNullOrEmpty(data))
                {
                    Response.Write("{\"res\":\"数据为空\"}");
                    return;
                }

                LogHelper.Default.Info(string.Format("From Jensen : {0}", data));

                SourceEntity srcEntity = data.JsonDeserialize <SourceEntity>();

                ResEntity resEntity = new ResEntity();
                resEntity.res = new List <ResEntity.ResItems>();

                StringBuilder objSb = new StringBuilder();

                foreach (SourceEntity.SourceItems item in srcEntity.data)
                {
                    bool result = false;

                    try
                    {
                        switch (item.cID)
                        {
                        case 0: result = false; break;

                        case 11: result = new SourceUrlSyncBLL().UpdateAppInfoThumbPicUrl(item); break;

                        case 12: result = new SourceUrlSyncBLL().UpdateAppInfoMainIconPicUrl(item); break;

                        case 21: result = new SourceUrlSyncBLL().UpdateAppPicListPicUrl(item); break;

                        case 31: result = new SourceUrlSyncBLL().UpdateGroupElemsRecommPicUrl(item); break;

                        case 41: result = new SourceUrlSyncBLL().UpdateGroupInfoGroupPicUrl(item); break;

                        case 51: result = new SourceUrlSyncBLL().UpdateGroupTypeTypePicUrl(item); break;

                        case 61: result = new SourceUrlSyncBLL().UpdateLinkInfoThumbPicUrl(item); break;

                        case 62: result = new SourceUrlSyncBLL().UpdateLinkInfoIconPicUrl(item); break;

                        case 72: result = this.UpDatePackInfo(item); break;
                        }

                        resEntity.res.Add(new ResEntity.ResItems()
                        {
                            resID = item.resID, resCode = 0
                        });


                        objSb.AppendLine(string.Format("OldSourceUrl:{0}\t{1}\t{2}\t{3}", result, item.cID, item.oldResUrl, item.newResUrl));
                    }
                    catch (Exception ex)
                    {
                        Response.Write("{\"res\":\"数据异常\"}");
                        LogHelper.Default.Error(string.Format("OldSourceUrl:{0}\t{1}\t{2}\t{3}", item.cID, item.oldResUrl, item.newResUrl, ex.ToString()));
                        return;
                    }
                }


                LogHelper.Default.Info(objSb.ToString());

                string responseJson = resEntity.JsonSerialize <ResEntity>();

                Response.Write(responseJson);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public JsonResult SaveResInfo()
        {
            string result = "0";
            try
            {

                long row_key = 0;
                long.TryParse(Request["row_key"], out row_key);
                if (row_key == 0)
                {
                    ResEntity addRes = new ResEntity();
                    addRes.RowKey = Utility.CreateRowKey();
                    addRes.Name = Request["name"];
                    addRes.Type = Request["res_type"];
                    addRes.Note = Request["note"];

                    if (Request["res_type"] == ResType.Web.GetDBCode())
                    {
                        addRes.Path = Request["web_path"];
                    }
                    else if (!string.IsNullOrEmpty(Request["upload_infos"]))
                    {
                        addRes.Path = Request["upload_infos"];
                    }

                    addRes.Creator = addRes.Editor = Utility.GetLoginUserKey();
                    addRes.CreateTime = addRes.UpdateTime = DateTime.Now;
                    addRes.Status = true;



                    if (db.InsertEntity<ResEntity>(addRes))
                        result = "1";
                }
                else
                {
                    ResEntity editItem = db.Single<ResEntity>(row_key);
                    editItem.Name = Request["name"];
                    editItem.Type = Request["res_type"];
                    editItem.Note = Request["note"];

                    if (Request["res_type"] == ResType.Web.GetDBCode())
                    {
                        editItem.Path = Request["web_path"];
                    }
                    else if (!string.IsNullOrEmpty(Request["upload_infos"]))
                    {
                        editItem.Path = Request["upload_infos"];
                    }

                    editItem.Editor = Utility.GetLoginUserKey();
                    editItem.UpdateTime = DateTime.Now;

                    foreach (System.Data.Linq.ObjectChangeConflict occ in db.ChangeConflicts)
                    {
                        occ.Resolve(System.Data.Linq.RefreshMode.KeepCurrentValues);
                    }
                    db.SubmitChanges();
                    result = "1";
                }
            }
            catch (Exception ex)
            { }
            return new JsonResult() { Data = new { result } };
        }