コード例 #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="appVersionId"></param>
        /// <returns></returns>
        public AjaxResult Update(C_S_AppVersion entity, string appVersionId)
        {
            AjaxResult msg = new AjaxResult();

            entity.Update(appVersionId);

            string sqlStr = @"UPDATE dbo.C_S_AppVersion
                                SET ApplicationId = @ApplicationId,
                                    VersionCode = @VersionCode,
                                    AppFileName = @AppFileName,
                                    AppDirectory = @AppDirectory,
                                    AppSize = @AppSize,
                                    Remark = @Remark,
                                    UpdateBy = @UpdateBy,
                                    UpdateTime = @UpdateTime
                                WHERE AppVersionId = @AppVersionId";

            SqlParameter[] parameter =
            {
                new SqlParameter("AppVersionId",  entity.AppVersionId),
                new SqlParameter("ApplicationId", entity.ApplicationId),
                new SqlParameter("VersionCode",   entity.VersionCode),
                new SqlParameter("AppFileName",   entity.AppFileName),
                new SqlParameter("AppDirectory",  entity.AppDirectory),
                new SqlParameter("AppSize",       entity.AppSize),
                new SqlParameter("Remark",        entity.Remark),
                new SqlParameter("UpdateBy",      entity.UpdateBy),
                new SqlParameter("UpdateTime",    entity.UpdateTime)
            };
            int result = SqlHelper.ExecuteNonQuery(sqlStr, parameter);

            if (result == 1)
            {
                msg.data    = "";
                msg.state   = "success";
                msg.message = "修改成功!";
            }
            else
            {
                msg.data    = "";
                msg.state   = "error";
                msg.message = "修改失败!";
            }
            return(msg);
        }
コード例 #2
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public AjaxResult Add(C_S_AppVersion entity)
        {
            DataTable dt = SqlHelper.ExecuteDataTable("select * from C_S_Application where ApplicationId = @ApplicationId", new SqlParameter[] { new SqlParameter("ApplicationId", entity.ApplicationId) });

            entity.Create();
            AjaxResult msg    = new AjaxResult();
            string     sqlStr = @"INSERT INTO dbo.C_S_AppVersion(AppVersionId,ApplicationId,VersionCode,AppFileName,
                                     AppDirectory,AppSize,Remark,CreateBy,CreateTime)
                                VALUES  ( @AppVersionId , @ApplicationId , 
                                          @VersionCode ,  @AppFileName , 
                                          @AppDirectory ,  @AppSize , 
                                          @Remark ,  @CreateBy ,  @CreateTime)";

            SqlParameter[] parameter =
            {
                new SqlParameter("AppVersionId",  entity.AppVersionId),
                new SqlParameter("ApplicationId", entity.ApplicationId),
                new SqlParameter("VersionCode",   entity.VersionCode),
                new SqlParameter("AppFileName",   entity.AppFileName),
                new SqlParameter("AppDirectory",  entity.AppDirectory),
                new SqlParameter("AppSize",       entity.AppSize),
                new SqlParameter("Remark",        entity.Remark),
                new SqlParameter("CreateBy",      entity.CreateBy),
                new SqlParameter("CreateTime",    entity.CreateTime)
            };
            int result = SqlHelper.ExecuteNonQuery(sqlStr, parameter);

            if (result == 1)
            {
                msg.data    = "";
                msg.state   = "success";
                msg.message = "新增成功!";

                #region ===========记录操作日志=============
                C_S_Log log = new C_S_Log()
                {
                    OperateType     = 0,//上传
                    OperateUserId   = entity.CreateBy,
                    ApplicationId   = entity.ApplicationId,
                    Content         = "上传应用",
                    ApplicationCode = "",
                    IPAddress       = Net.Ip,
                    MachineName     = Net.Host
                };

                if (dt.Rows.Count > 0)
                {
                    log.ApplicationCode = dt.Rows[0]["ApplicationCode"].ToString();
                }

                CSLog_BLL.Add(log);
                #endregion =================================
            }
            else
            {
                msg.data    = "";
                msg.state   = "error";
                msg.message = "新增失败!";
            }
            return(msg);
        }