Exemple #1
0
        public bool Update(SuggestionsInfoModel model)
        {
            var sql = @"UPDATE " + tableName +
                      @" SET [BFFeedBackComment]=@BFFeedBackComment
                       ,[BFStatus]=@BFStatus  WHERE Id =@Id ";

            SqlParameter[] para =
            {
                new SqlParameter("@Id",                model.Id),
                new SqlParameter("@BFFeedBackComment", model.BFFeedBackComment),
                new SqlParameter("@BFStatus",          model.BFStatus)
            };

            return(ExecteNonQuery(CommandType.Text, sql, null, para) > 0);
        }
Exemple #2
0
        public static SuggestionModel SaveSuggest(SuggestionsInfoModel model, UserLoginInfo loginUser)
        {
            var result = new SuggestionModel()
            {
                IsSuccess = true
            };

            try {
                if (model.Id == 0)
                {
                    model.BFIsValid         = 1;
                    model.BFStatus          = 1;
                    model.BFCreateUserNo    = loginUser.JobNum;
                    model.BFCreateUserName  = loginUser.UserName;
                    model.BFCreateTime      = DateTime.Now;
                    model.BFOperateUserNo   = loginUser.JobNum;
                    model.BFOperateUserName = loginUser.UserName;
                    model.BFOperateTime     = DateTime.Now;
                    model.BFFeedBackComment = string.Empty;
                    model.BFRespUserNo      = string.Empty;
                    model.BFRespName        = string.Empty;
                    model.Id       = _suggestDAL.Insert(model);
                    result.Message = EncryptHelper.DesEncrypt(model.Id.ToString());
                    result.model   = model;
                }
                else
                {
                    model.BFOperateUserNo   = loginUser.JobNum;
                    model.BFOperateUserName = loginUser.UserName;
                    model.BFOperateTime     = DateTime.Now;
                    var update = _suggestDAL.Update(model);
                    if (!update)
                    {
                        result.IsSuccess = false;
                    }
                    result.model = model;
                }
            }
            catch (Exception ex) {
                result.IsSuccess = false;
                result.Message   = ex.Message;
            }
            return(result);
        }
Exemple #3
0
        public ActionResult SaveSuggest(SuggestionsInfoModel model)
        {
            var result = SuggestBusiness.SaveSuggest(model, this.LoginUser);

            return(Json(result));
        }
Exemple #4
0
        /// <summary>
        /// Insert
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public long Insert(SuggestionsInfoModel model)
        {
            var sql = @"INSERT INTO " + tableName +
                      @" ([BFType]
                   ,[BFPhase]
                   ,[BFDesc]
                   ,[BFRespUserNo]
                   ,[BFRespName]
                   ,[BFStatus]
                   ,[BFPicture]
                   ,[BFPictureUrl]
                   ,[BFFeedBackComment]
                   ,[BFCreateUserNo]
                   ,[BFCreateUserName]
                   ,[BFCreateTime]
                   ,[BFOperateUserNo]
                   ,[BFOperateUserName]
                   ,[BFOperateTime]
                   ,[BFIsValid])" +
                      @" VALUES (@BFType
                    , @BFPhase
                    , @BFDesc
                    , @BFRespUserNo
                    , @BFRespName
                    , @BFStatus
                    , @BFPicture
                    , @BFPictureUrl
                    , @BFFeedBackComment
                    , @BFCreateUserNo
                    , @BFCreateUserName
                    , @BFCreateTime
                    , @BFOperateUserNo
                    , @BFOperateUserName
                    , @BFOperateTime
                    , @BFIsValid) " +
                      "  select id = scope_identity()";

            SqlParameter[] para =
            {
                new SqlParameter("@BFType",            string.IsNullOrEmpty(model.BFType)?string.Empty:model.BFType),
                new SqlParameter("@BFPhase",           string.IsNullOrEmpty(model.BFPhase)?string.Empty: model.BFPhase),
                new SqlParameter("@BFDesc",            string.IsNullOrEmpty(model.BFDesc)?string.Empty:model.BFDesc),
                new SqlParameter("@BFRespUserNo",      string.IsNullOrEmpty(model.BFRespUserNo)?string.Empty:model.BFRespUserNo),
                new SqlParameter("@BFRespName",        string.IsNullOrEmpty(model.BFRespName)?string.Empty:model.BFRespName),
                new SqlParameter("@BFStatus",          model.BFStatus),
                new SqlParameter("@BFPicture",         string.IsNullOrEmpty(model.BFPicture)?string.Empty:model.BFPicture),
                new SqlParameter("@BFPictureUrl",      string.IsNullOrEmpty(model.BFPictureUrl)?string.Empty:model.BFPictureUrl),
                new SqlParameter("@BFFeedBackComment", model.BFFeedBackComment),
                new SqlParameter("@BFCreateUserNo",    model.BFCreateUserNo),
                new SqlParameter("@BFCreateUserName",  model.BFCreateUserName),
                new SqlParameter("@BFCreateTime",      model.BFCreateTime),
                new SqlParameter("@BFOperateUserNo",   model.BFOperateUserNo),
                new SqlParameter("@BFOperateUserName", model.BFOperateUserName),
                new SqlParameter("@BFOperateTime",     model.BFOperateTime),
                new SqlParameter("@BFIsValid",         model.BFIsValid)
            };
            var result = 0;
            var ds     = ExecuteDataSet(CommandType.Text, sql.ToString(), null, para);

            if (ds != null && ds.Tables.Count > 0)
            {
                var Idstring = ds.Tables[0].Rows[0][0].ToString();
                result = string.IsNullOrEmpty(Idstring) ? 0 : Convert.ToInt32(Idstring);
            }
            return(result);
        }