Esempio n. 1
0
        public override ActionResult AddSubmit(FormCollection fm)
        {
            var viewModel = this.GetViewModel(fm);
            var model     = new XCLCMS.Data.Model.FriendLinks();

            model.FriendLinkID = XCLCMS.Lib.Common.FastAPI.CommonAPI_GenerateID(base.UserToken, new Data.WebAPIEntity.RequestEntity.Common.GenerateIDEntity()
            {
                IDType = Data.CommonHelper.EnumType.IDTypeEnum.LIK.ToString()
            });
            model.RecordState      = viewModel.FriendLinks.RecordState;
            model.Title            = viewModel.FriendLinks.Title;
            model.FK_MerchantAppID = viewModel.FriendLinks.FK_MerchantAppID;
            model.FK_MerchantID    = viewModel.FriendLinks.FK_MerchantID;
            model.ContactName      = viewModel.FriendLinks.ContactName;
            model.Description      = viewModel.FriendLinks.Description;
            model.Email            = viewModel.FriendLinks.Email;
            model.OtherContact     = viewModel.FriendLinks.OtherContact;
            model.QQ     = viewModel.FriendLinks.QQ;
            model.Remark = viewModel.FriendLinks.Remark;
            model.Tel    = viewModel.FriendLinks.Tel;
            model.URL    = viewModel.FriendLinks.URL;

            var request = XCLCMS.Lib.WebAPI.Library.CreateRequest <XCLCMS.Data.Model.FriendLinks>(base.UserToken);

            request.Body = new Data.Model.FriendLinks();
            request.Body = model;
            var response = XCLCMS.Lib.WebAPI.FriendLinksAPI.Add(request);

            return(Json(response));
        }
Esempio n. 2
0
        public override ActionResult UpdateSubmit(FormCollection fm)
        {
            var viewModel = this.GetViewModel(fm);
            var model     = new XCLCMS.Data.Model.FriendLinks();

            model.FriendLinkID = viewModel.FriendLinks.FriendLinkID;

            model.RecordState      = viewModel.FriendLinks.RecordState;
            model.Title            = viewModel.FriendLinks.Title;
            model.FK_MerchantAppID = viewModel.FriendLinks.FK_MerchantAppID;
            model.FK_MerchantID    = viewModel.FriendLinks.FK_MerchantID;
            model.ContactName      = viewModel.FriendLinks.ContactName;
            model.Description      = viewModel.FriendLinks.Description;
            model.Email            = viewModel.FriendLinks.Email;
            model.OtherContact     = viewModel.FriendLinks.OtherContact;
            model.QQ     = viewModel.FriendLinks.QQ;
            model.Remark = viewModel.FriendLinks.Remark;
            model.Tel    = viewModel.FriendLinks.Tel;
            model.URL    = viewModel.FriendLinks.URL;

            var request = XCLCMS.Lib.WebAPI.Library.CreateRequest <XCLCMS.Data.Model.FriendLinks>(base.UserToken);

            request.Body = new Data.Model.FriendLinks();
            request.Body = model;
            var response = XCLCMS.Lib.WebAPI.FriendLinksAPI.Update(request);

            return(Json(response));
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XCLCMS.Data.Model.FriendLinks GetModel(long FriendLinkID)
        {
            XCLCMS.Data.Model.FriendLinks model = new XCLCMS.Data.Model.FriendLinks();
            Database  db        = base.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand("select * from FriendLinks WITH(NOLOCK)   where FriendLinkID=@FriendLinkID");

            db.AddInParameter(dbCommand, "FriendLinkID", DbType.Int64, FriendLinkID);
            using (var dr = db.ExecuteReader(dbCommand))
            {
                return(XCLNetTools.DataSource.DataReaderHelper.DataReaderToEntity <XCLCMS.Data.Model.FriendLinks>(dr));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XCLCMS.Data.Model.FriendLinks GetModel(long FriendLinkID)
        {
            XCLCMS.Data.Model.FriendLinks model = new XCLCMS.Data.Model.FriendLinks();
            Database  db        = base.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand("select * from FriendLinks WITH(NOLOCK)   where FriendLinkID=@FriendLinkID");

            db.AddInParameter(dbCommand, "FriendLinkID", DbType.Int64, FriendLinkID);
            DataSet ds = db.ExecuteDataSet(dbCommand);

            var lst = XCLNetTools.Generic.ListHelper.DataTableToList <XCLCMS.Data.Model.FriendLinks>(ds.Tables[0]);

            return(null != lst && lst.Count > 0 ? lst[0] : null);
        }
Esempio n. 5
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(XCLCMS.Data.Model.FriendLinks model)
        {
            Database  db        = base.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("sp_FriendLinks_Update");

            db.AddInParameter(dbCommand, "FriendLinkID", DbType.Int64, model.FriendLinkID);
            db.AddInParameter(dbCommand, "Title", DbType.String, model.Title);
            db.AddInParameter(dbCommand, "Description", DbType.String, model.Description);
            db.AddInParameter(dbCommand, "URL", DbType.AnsiString, model.URL);
            db.AddInParameter(dbCommand, "ContactName", DbType.String, model.ContactName);
            db.AddInParameter(dbCommand, "Email", DbType.AnsiString, model.Email);
            db.AddInParameter(dbCommand, "QQ", DbType.AnsiString, model.QQ);
            db.AddInParameter(dbCommand, "Tel", DbType.AnsiString, model.Tel);
            db.AddInParameter(dbCommand, "Remark", DbType.String, model.Remark);
            db.AddInParameter(dbCommand, "OtherContact", DbType.String, model.OtherContact);
            db.AddInParameter(dbCommand, "FK_MerchantID", DbType.Int64, model.FK_MerchantID);
            db.AddInParameter(dbCommand, "FK_MerchantAppID", DbType.Int64, model.FK_MerchantAppID);
            db.AddInParameter(dbCommand, "RecordState", DbType.AnsiString, model.RecordState);
            db.AddInParameter(dbCommand, "CreateTime", DbType.DateTime, model.CreateTime);
            db.AddInParameter(dbCommand, "CreaterID", DbType.Int64, model.CreaterID);
            db.AddInParameter(dbCommand, "CreaterName", DbType.String, model.CreaterName);
            db.AddInParameter(dbCommand, "UpdateTime", DbType.DateTime, model.UpdateTime);
            db.AddInParameter(dbCommand, "UpdaterID", DbType.Int64, model.UpdaterID);
            db.AddInParameter(dbCommand, "UpdaterName", DbType.String, model.UpdaterName);

            db.AddOutParameter(dbCommand, "ResultCode", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "ResultMessage", DbType.String, 1000);
            db.ExecuteNonQuery(dbCommand);

            var result = XCLCMS.Data.DAL.Common.Common.GetProcedureResult(dbCommand.Parameters);

            if (result.IsSuccess)
            {
                return(true);
            }
            else
            {
                throw new Exception(result.ResultMessage);
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(XCLCMS.Data.Model.FriendLinks model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(XCLCMS.Data.Model.FriendLinks model)
 {
     return(dal.Add(model));
 }