コード例 #1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("magazine", MXEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;                                              //成功数量
            int errorCount = 0;                                              //失败数量

            BLL.wx_mz_img bll     = new BLL.wx_mz_img();
            Repeater      rptList = this.rptList2;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除 条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("mz_img_list.aspx", "keywords={0}&mzid={1}",
                                                                                        this.keywords, mzid.ToString()), "Success");
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BLL.wx_mz_img bll = new BLL.wx_mz_img();
         mid = MXRequest.GetQueryInt("mid");
         showInfo();
         this.rptList.DataSource = bll.GetModelList(" mid=" + mid);
         this.rptList.DataBind();
     }
 }
コード例 #3
0
        private void RptBind(string _strWhere, string _orderby)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            this.page = MXRequest.GetQueryInt("page", 1);

            //图表或列表显示
            BLL.wx_mz_img bll = new BLL.wx_mz_img();
            this.rptList2.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList2.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("mz_img_list.aspx", "page={0}&mzid={1}",
                                              "__id__", mzid.ToString());

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
コード例 #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("magazine", MXEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.wx_mz_img bll     = new BLL.wx_mz_img();
            Repeater      rptList = new Repeater();

            rptList = this.rptList2;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                int sortId;
                if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
                {
                    sortId = 99;
                }
                bll.UpdateField(id, "sort_id=" + sortId.ToString());
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存杂志图片排序"); //记录日志
            JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("mz_img_list.aspx", "keywords={0}&mzid={1}",
                                                    this.keywords, mzid.ToString()), "Success");
        }
コード例 #5
0
ファイル: getdata.ashx.cs プロジェクト: yidane/51wine
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();
            string _action = MyCommFun.QueryString("myact");

            if (_action == "uploadImg")
            {
                #region 图片上传
                try
                {
                    string uploadFileRet             = UpLoadFile(context);
                    Dictionary <string, object> dict = MyCommFun.JsonToDictionary(uploadFileRet);

                    if (dict["status"].ToString() == "0")
                    {
                        //上传失败
                        jsonDict.Add("res", "0");
                        jsonDict.Add("content", dict["msg"].ToString());
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    else if (dict["status"].ToString() == "1")
                    {
                        //上传成功,修改用户的头像url
                        jsonDict.Add("res", "1");
                        jsonDict.Add("thumb", dict["thumb"].ToString());
                        jsonDict.Add("newPhotoUrl", dict["path"].ToString());
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                }
                catch (Exception e)
                {
                    //上传失败
                    jsonDict.Add("res", "0");
                    jsonDict.Add("content", e.Message);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                #endregion
            }

            if (_action == "getAm")
            {
                int iid = MyCommFun.RequestInt("iid");
                BLL.wx_mz_animate amBll = new BLL.wx_mz_animate();
                BLL.wx_mz_img     iBll  = new BLL.wx_mz_img();
                try
                {
                    string  mzimg = iBll.GetModel(iid).url;
                    DataSet ds    = amBll.GetList("iid=" + iid);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        StringBuilder sb = new StringBuilder("{\"res\":1,\"content\":[");
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            DataRow dr = ds.Tables[0].Rows[i];
                            sb.Append("{");
                            sb.Append("\"id\":" + dr["id"] + ",");
                            sb.Append("\"width\":" + dr["width"] + ",");
                            sb.Append("\"height\":" + dr["height"] + ",");
                            sb.Append("\"x_lc\":" + dr["x_loaction"] + ",");
                            sb.Append("\"y_lc\":" + dr["y_location"] + ",");
                            sb.Append("\"img\":\"" + dr["animate_img"] + "\",");
                            sb.Append("\"type\":\"" + dr["animate_type"] + "\",");
                            sb.Append("\"s_sec\":" + dr["start_seconds"] + ",");
                            sb.Append("\"c_sec\":" + dr["continue_seconds"]);
                            sb.Append("},");
                        }
                        sb.Remove(sb.Length - 1, 1);
                        sb.Append("],\"img\":\"" + mzimg + "\"}");
                        context.Response.Write(sb.ToString());
                        return;
                    }
                    else
                    {
                        context.Response.Write("{\"res\":2,\"img\":\"" + mzimg + "\"}");
                        return;
                    }
                }
                catch (Exception)
                {
                    context.Response.Write("{\"res\":0}");
                    return;
                }
            }
        }