/// <summary>
        /// 取消操作
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool QuXiao(int id)
        {
            SOSOshop.Model.AdminInfo adminInfo = SOSOshop.BLL.AdministrorManager.Get();
            string s = string.Format(@"declare @uid int,@Gift_ID int,@Gift_Number decimal,@Integral decimal 
if exists(select * from MemberIntegralGiftExchange where [State]<>0 and [id]={0}) begin 
update MemberIntegralGiftExchange set ontime=getdate(),Editer={1},[State]=0 
where [State]<>0 and [id]={0} 
select @uid = uid, @Gift_ID = Gift_ID, @Gift_Number = Gift_Number from MemberIntegralGiftExchange where [id]={0}
select @Integral = Integral * @Gift_Number from MemberIntegralGift where [id]=@Gift_ID 
update MemberIntegralGift set Number = Number + @Gift_Number where [id]=@Gift_ID
update MemberIntegral set realityIntegral = realityIntegral + @Integral where [uid]=@uid 
end
select @uid,@Integral", id, adminInfo == null ? 0 : adminInfo.AdminId);

            SOSOshop.BLL.Db db = new SOSOshop.BLL.Db();
            DataSet         ds = db.ExecuteDataSet(s);
            bool            ok = ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && !ds.Tables[0].Rows[0].IsNull(0);

            if (ok)
            {
                int     uid      = int.Parse(ds.Tables[0].Rows[0][0].ToString());
                decimal integral = decimal.Parse(ds.Tables[0].Rows[0][1].ToString());
                SOSOshop.BLL.Integral.MemberIntegral bll2 = new SOSOshop.BLL.Integral.MemberIntegral();
                bll2.PresentIntegral(uid, Convert.ToInt32(integral), "返还兑换礼品的积分", true);
            }
            return(ok);
        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     tablist.Sorting += new GridViewSortEventHandler(tablist_Sorting);
     if (!IsPostBack)
     {
         #region ajax
         if (ChangeHope.WebPage.PageRequest.GetFormString("Option") != string.Empty && ChangeHope.WebPage.PageRequest.GetFormString("id") != "")
         {
             string types = Request["Option"].Trim();
             string id    = ChangeHope.WebPage.PageRequest.GetFormString("id");
             string ids   = ChangeHope.WebPage.PageRequest.GetFormString("ids").Trim(',');
             int    uid   = 0; int.TryParse(id, out uid);
             //获取上级单位
             if (types == "GetParentIncName")
             {
                 if (!string.IsNullOrEmpty(ids))
                 {
                     StringBuilder s        = new StringBuilder();
                     DataSet       IncNames = bll.ExecuteDataSet("select ID, Name, isnull(BuyFilingStatus,2) from DrugsBase_Enterprise where ID in (" + ids + ")");
                     if (IncNames != null && IncNames.Tables.Count > 0 && IncNames.Tables[0].Rows.Count > 0)
                     {
                         foreach (DataRow dr in IncNames.Tables[0].Rows)
                         {
                             s.Append("{ID:" + dr[0] + ",Name:'" + dr[1].ToString().Replace("'", "\\'") + "',BuyFilingStatus:" + dr[2] + "},");
                         }
                     }
                     Response.Write("[" + s.ToString().TrimEnd(',') + "]");
                 }
                 else if (uid > 0)
                 {
                     string s       = "";
                     object IncName = bll.ExecuteScalar("select Name from DrugsBase_Enterprise where ID='" + uid + "'");
                     if (IncName != null)
                     {
                         s = IncName.ToString();
                     }
                     Response.Write(s);
                 }
             }
             //删除
             else if (types == "del")
             {
                 if (isDelete())
                 {
                     bool noBecause = ChangeHope.WebPage.PageRequest.GetFormString("noBecause") == "";
                     if (noBecause && bll.ExecuteScalar("select 1 from orders where ReceiverId in (" + id + ")") != null)
                     {
                         Response.Write("noBecauseOrders");
                     }
                     else
                     {
                         bool ok = false;
                         if (uid > 0)
                         {
                             ok = new SOSOshop.BLL.MemberAccount().Delete(uid);
                         }
                         else
                         {
                             ok = new SOSOshop.BLL.MemberAccount().DeleteAll(id);
                         }
                         Response.Write(ok ? "ok" : "");
                         if (ok)
                         {
                             #region 后台用户操作日志记录
                             SOSOshop.Model.AdminInfo adminInfo = SOSOshop.BLL.AdministrorManager.Get();
                             SOSOshop.BLL.Logs.Log.LogAdminAdd("删除买家信息", (adminInfo == null ? 0 : adminInfo.AdminId), (adminInfo == null ? "" : adminInfo.AdminName), 1);
                             #endregion
                         }
                     }
                 }
                 else
                 {
                     Response.Write("no");
                 }
             }
             //审核
             else if (types == "State")
             {
                 if (isEdit())
                 {
                     bool ok = 0 < bll.ExecuteNonQuery("UPDATE memberaccount SET State = 0 where State <> 0 and UID in (" + id + ")");
                     Response.Write(ok ? "ok" : "");
                 }
                 else
                 {
                     Response.Write("no");
                 }
             }
             //获取积分
             else if (types == "getIntegral")
             {
                 int integral = 0;
                 if (SOSOshop.BLL.PowerPass.isPass("008009001"))
                 {
                     try
                     {
                         SOSOshop.BLL.Integral.MemberIntegral bll2 = new SOSOshop.BLL.Integral.MemberIntegral();
                         integral = bll2.GetRealityIntegral(uid);
                     }
                     catch { }
                     Response.Write(integral);
                 }
                 else
                 {
                     Response.Write("no");
                 }
             }
             //赠送积分
             else if (types == "editIntegral")
             {
                 int integral = 0; int.TryParse(Request["integral"], out integral);
                 if (SOSOshop.BLL.PowerPass.isPass("008009015"))
                 {
                     bool ok = false;
                     try
                     {
                         SOSOshop.BLL.Integral.MemberIntegral bll2      = new SOSOshop.BLL.Integral.MemberIntegral();
                         SOSOshop.Model.AdminInfo             adminInfo = SOSOshop.BLL.AdministrorManager.Get();
                         string remarks = string.Format("管理员{0}赠送积分", (adminInfo == null ? "" : adminInfo.AdminName));
                         bll2.PresentIntegral(uid, integral, remarks);
                         ok = true;
                         #region 后台用户操作日志记录
                         SOSOshop.BLL.Logs.Log.LogAdminAdd(remarks + "给" + Request["TrueName"] + ":" + integral, (adminInfo == null ? 0 : adminInfo.AdminId), (adminInfo == null ? "" : adminInfo.AdminName), 1);
                         #endregion
                     }
                     catch { }
                     Response.Write(ok ? "ok" : "");
                 }
                 else
                 {
                     Response.Write("no");
                 }
             }
             Response.End();
             return;
         }
         #endregion
         if (!SOSOshop.BLL.PowerPass.isPass("008009001") && !SOSOshop.BLL.PowerPass.isPass("008009012"))
         {
             SOSOshop.BLL.PromptInfo.Popedom("000000000000", "对不起,您没有查看的权限!");
         }
         //显示列表
         Search_Click(null, null);
     }
     //权限赋值
     isCheckUp         = SOSOshop.BLL.PowerPass.isPass("008009013");
     IsEdit            = SOSOshop.BLL.PowerPass.isPass("008009004");
     IsDelete          = SOSOshop.BLL.PowerPass.isPass("008009003");
     IsPresentIntegral = SOSOshop.BLL.PowerPass.isPass("008009015");
 }