Example #1
0
 public static string Empowers(string userlist, string relist)
 {
     try
     {
         BLL_UserBuyResources          bll       = new BLL_UserBuyResources();
         List <Model_UserBuyResources> listModel = new List <Model_UserBuyResources>();
         userlist = userlist.TrimEnd(',');
         relist   = relist.TrimEnd(',');
         string _dSql = "delete UserBuyResources where BuyType = 'NBSQ' and UserId in ('" + userlist.Replace(",", "','") + "') and book_id in ('" + relist.Replace(",", "','") + "');";
         foreach (string item in userlist.Split(','))
         {
             if (!string.IsNullOrEmpty(item))
             {
                 foreach (string itemR in relist.Split(','))
                 {
                     if (!string.IsNullOrEmpty(itemR))
                     {
                         if (new BLL_UserBuyResources().GetRecordCount("UserId='" + item + "' and Book_id='" + itemR + "'") > 0)
                         {
                         }
                         else
                         {
                             Model_UserBuyResources model = new Model_UserBuyResources();
                             model.UserBuyResources_ID = Guid.NewGuid().ToString();
                             model.UserId     = item;
                             model.Book_id    = itemR;
                             model.BuyType    = "NBSQ";//内部授权
                             model.CreateTime = DateTime.Now;
                             listModel.Add(model);
                         }
                     }
                 }
             }
         }
         if (listModel.Count > 0)
         {
             //Rc.Common.DBUtility.DbHelperSQL.Query(_dSql);
             if (bll.AddUserBuyResources(listModel))
             {
                 return("1");
             }
             else
             {
                 return("");
             }
         }
         else
         {
             return("1");
         }
     }
     catch (Exception ex)
     {
         return("2");
     }
 }
        protected void btnBePower_Click(object sender, EventArgs e)
        {
            BLL_UserBuyResources          bll       = new BLL_UserBuyResources();
            List <Model_UserBuyResources> listModel = new List <Model_UserBuyResources>();
            string _bid   = Request["bid"];
            string _IDs   = hidUserIDs.Value.TrimEnd(',');
            string _dSql  = "delete UserBuyResources where UserId in ('" + _IDs.Replace(",", "','") + "') and book_id ='" + _bid + "';";
            int    result = 0;

            foreach (string item in _IDs.Split(','))
            {
                if (!string.IsNullOrEmpty(item))
                {
                    Model_UserBuyResources model = new Model_UserBuyResources();
                    model.UserBuyResources_ID = Guid.NewGuid().ToString();
                    model.UserId     = item;
                    model.Book_id    = _bid;
                    model.BuyType    = UserOrder_PaytoolEnum.NBSQ.ToString();//内部授权
                    model.CreateTime = DateTime.Now;
                    model.CreateUser = loginUser.SysUser_ID;
                    listModel.Add(model);
                }
            }
            try
            {
                Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(_dSql);
                foreach (var item in listModel)
                {
                    bool flag = bll.Add(item);
                    if (flag)
                    {
                        new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS(Module_Id, string.Format("给老师授权成功,操作人:{0},资源标识:{1},老师标识:{2}"
                                                                                             , loginUser.SysUser_ID, item.Book_id, item.UserId));
                    }
                    else
                    {
                        new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS(Module_Id, string.Format("给老师授权失败,操作人:{0},资源标识:{1},老师标识:{2}"
                                                                                                  , loginUser.SysUser_ID, item.Book_id, item.UserId));
                    }
                    result += flag == true ? 1 : 0;
                }
                if (result > 0)
                {
                    ShowMsg(true, "操作成功!");
                }
                else
                {
                    ShowMsg(false, "操作失败!");
                }
            }
            catch (Exception ex)
            {
                //记录错误日志
                new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS(Module_Id, string.Format("给老师授权失败,操作人:{0},类:{1},方法{2},错误信息:{3}"
                                                                                          , loginUser.SysUser_ID
                                                                                          , ex.TargetSite.DeclaringType.ToString()
                                                                                          , ex.TargetSite.Name.ToString()
                                                                                          , ex.Message));
                ShowMsg(false, "操作失败!");
                return;
            }
        }
Example #3
0
        protected void LaodData()
        {
            BLL_UserBuyResources bllubr = new BLL_UserBuyResources();
            DataTable            dtubr  = bllubr.GetList(" Book_id='" + ResourceFolder_ID + "' and UserId='" + FloginUser.UserId + "'").Tables[0];

            if (dtubr.Rows.Count > 0)
            {
                Vbtn           = true;
                btnBuy.Visible = false;
            }
            BLL_Bookshelves bll = new BLL_Bookshelves();
            DataTable       dt  = bll.GetList("ResourceFolder_Id='" + ResourceFolder_ID + "'").Tables[0];

            if (dt.Rows.Count > 0)
            {
                #region 处理图片显示宽高
                int    imgHeight   = 0;
                int    imgWidth    = 0;
                string imgFilePath = Server.MapPath(dt.Rows[0]["BookImg_Url"].ToString());
                if (System.IO.File.Exists(imgFilePath))
                {
                    System.Drawing.Image img = System.Drawing.Image.FromFile(imgFilePath);
                    imgHeight = img.Height;
                    imgWidth  = img.Width;
                    if (imgHeight / 300.0 > imgWidth / 220.0)
                    {
                        imgWidth = 0;
                        if (imgHeight > 300)
                        {
                            imgHeight = 300;
                        }
                    }
                    else
                    {
                        imgHeight = 0;
                        if (imgWidth > 220)
                        {
                            imgWidth = 220;
                        }
                    }
                    img.Dispose();
                }
                #endregion
                //ltlImg.Text = string.Format("<img src='{0}' {1} {2} onerror=\"this.src='../images/re_nopic.jpg'\" width='186' height='239' />"
                //    , dt.Rows[0]["BookImg_Url"].ToString()
                //    , imgHeight > 0 ? string.Format("height='{0}'", imgHeight) : ""
                //    , imgWidth > 0 ? string.Format("width='{0}'", imgWidth) : "");
                ltlImg.Text = string.Format("<img src='{0}' onerror=\"this.src='../images/re_nopic.jpg'\" width='175' height='240' />"
                                            , dt.Rows[0]["BookImg_Url"].ToString());
                ltlMaskImg.Text = string.Format("<img class='blur-item-hook' src='{0}' />"
                                                , dt.Rows[0]["BookImg_Url"].ToString());
                ltlBookName.Text = dt.Rows[0]["Book_Name"].ToString();
                btnBuy.Text      = "购买 ¥" + dt.Rows[0]["BookPrice"].ToString();
                ltlBookBif.Text  = dt.Rows[0]["BookBrief"].ToString();
            }
            string strsql = @"select ResourceFolder_Id,ResourceFolder_Name,Resource_Type,Resource_Class,File_Suffix,ResourceFolder_Level,ResourceFolder_ParentId from VW_ResourceAndResourceFolder where Book_ID='" + ResourceFolder_ID + "'  order by ResourceFolder_Order";

            DataTable dtre = Rc.Common.DBUtility.DbHelperSQL.Query(strsql).Tables[0];
            if (dtre.Rows.Count > 0)
            {
                DataView dvw = new DataView();
                dvw.Table    = dtre;
                litTree.Text = InitNavigationTree("0", dtre.Rows[0]["Resource_Class"].ToString(), dvw, 1).ToString();
            }
            string    sql = @" select c.comment_id,c.comment_content,create_time,comment_evaluate,ISNULL(u.TrueName,u.UserName)as Commenter,o.Book_Id  from userorder_comment c
 left join F_User u on u.UserId=c.user_id
 left join UserOrder o on o.UserOrder_No=c.order_num where  o.Book_Id='" + ResourceFolder_ID + "'";
            DataTable dtC = Rc.Common.DBUtility.DbHelperSQL.Query(sql).Tables[0];
            rptcourse_comment.DataSource = dtC;
            rptcourse_comment.DataBind();
        }