Пример #1
0
    public override string InvokeRequest()
    {
        int      cnt  = 0;
        Resp313B resp = new Resp313B();

        DbHelper db = new DbHelper(Common.OracleConnStrLocal, true);

        try
        {
            Criteria c = new Criteria();
            c.userid   = this.req.data.userid;
            c.noticeId = this.req.data.noticeid;
            List <M_T_Notice> etyList = BHelper.FetchNotice(c, db);

            List <string> parameters = new List <string>();
            parameters.Add("NoticeId");
            for (int i = 0; i < etyList.Count; i++)
            {
                cnt += Common.Delete <M_T_Notice>(etyList[i], db, parameters);
            }
            db.Commit();

            resp.data.result  = "100";
            resp.data.message = "接口操作完成(处理了" + cnt.ToString() + "条数据)";
        }
        catch (Exception err)
        {
            db.Abort();
            resp.data.result  = "200";
            resp.data.message = err.Message;
        }
        return(Common.Serialize <Resp313B>(resp));
    }
Пример #2
0
    private bool UpdateNotice()
    {
        DbHelper db = new DbHelper(Common.OracleConnStrLocal, true);

        try
        {
            Criteria c = new Criteria();
            c.noticeId = this.req.data.noticeid;
            List <M_T_Notice> etyList = BHelper.FetchNotice(c, db);

            if (etyList.Count > 0)
            {
                etyList[0].StartDate   = DateTime.Parse(this.req.data.startdate);
                etyList[0].EndDate     = DateTime.Parse(this.req.data.enddate);
                etyList[0].Detail      = this.req.data.detail;
                etyList[0].Title       = this.req.data.title;
                etyList[0].ImgUrlLarge = this.req.data.imgurl;
                etyList[0].LeaseNumber = this.req.data.userid;
                etyList[0].UpdateBy    = this.req.data.userid;

                List <string> keys = new List <string>();
                keys.Add("NoticeId");
                if (Common.Update <M_T_Notice>(etyList[0], db, keys) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        catch (Exception err)
        {
            db.Abort();
            throw err;
        }
        finally
        {
            db.Commit();
        }
    }