Ejemplo n.º 1
0
        public string SubmitDoubt(DoubtInfo_Add doubt)
        {
            var id     = Guid.NewGuid().ToString("N");
            var entity = new Doubt
            {
                Id                    = id,
                Title                 = doubt.Title,
                Description           = doubt.Description,
                Category              = doubt.Category,
                ShowIndex             = 0,
                UpCount               = 0,
                DownCount             = 0,
                CreateTime            = DateTime.Now,
                CreateUserKey         = doubt.CreateUserKey,
                CreateUserDisplayName = doubt.CreateUserDisplayName,
                UpdateTime            = DateTime.Now,
                UpdateUserKey         = doubt.CreateUserKey,
                UpdateUserDisplayName = doubt.CreateUserDisplayName,
            };

            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();
                using (var manager = new DoubtManager())
                {
                    manager.AddDoubt(entity);
                }
                biz.CommitTran();
            }
            return(id);
        }
Ejemplo n.º 2
0
 public IList QueryDoubtList_Web(string key, string category, string userId, int pageIndex, int pageSize, out int totalCount)
 {
     using (var manager = new DoubtManager())
     {
         var list = manager.QueryDoubtList_Web(key, category, userId, pageIndex, pageSize, out totalCount);
         return(list);
     }
 }
Ejemplo n.º 3
0
        public DoubtInfo_Query QueryDoubtInfoById(string doubtId)
        {
            using (var manager = new DoubtManager())
            {
                var entity = manager.GetDoubtById(doubtId);

                var info = new DoubtInfo_Query();
                ObjectConvert.ConverEntityToInfo <Doubt, DoubtInfo_Query>(entity, ref info);
                return(info);
            }
        }
Ejemplo n.º 4
0
 public void UpdateDoubtIndex(Dictionary <string, int> indexCollection)
 {
     using (var biz = new GameBiz.Business.GameBizBusinessManagement())
     {
         biz.BeginTran();
         using (var manager = new DoubtManager())
         {
             manager.UpdateDoubtIndex(indexCollection);
         }
         biz.CommitTran();
     }
 }
Ejemplo n.º 5
0
 public void DeleteDoubt(string doubtId)
 {
     using (var biz = new GameBiz.Business.GameBizBusinessManagement())
     {
         biz.BeginTran();
         using (var manager = new DoubtManager())
         {
             var entity = manager.GetDoubtById(doubtId);
             if (entity == null)
             {
                 throw new ArgumentException("指定编号的问题不存在");
             }
             manager.DeleteUpDownRecord(doubtId);
             manager.DeleteDoubt(entity);
         }
         biz.CommitTran();
     }
 }
Ejemplo n.º 6
0
 public void UpDownDoubt(string doubtId, string userId, string operation)
 {
     using (var biz = new GameBiz.Business.GameBizBusinessManagement())
     {
         biz.BeginTran();
         using (var manager = new DoubtManager())
         {
             var entity = manager.GetDoubtById(doubtId);
             if (entity == null)
             {
                 throw new ArgumentException("指定编号的问题不存在");
             }
             var record = manager.GetUpDownRecord(userId, doubtId);
             if (record != null)
             {
                 throw new ArgumentException("不能重复操作");
             }
             if (operation.ToUpper() == "UP")
             {
                 entity.UpCount++;
             }
             else
             {
                 entity.DownCount++;
             }
             manager.UpdateDoubt(entity);
             record = new UpDownRecord
             {
                 UserId     = userId,
                 DoubtId    = doubtId,
                 UpDown     = operation,
                 CreateTime = DateTime.Now,
             };
             manager.AddUpDownRecord(record);
         }
         biz.CommitTran();
     }
 }
Ejemplo n.º 7
0
 public void UpdateDoubt(string doubtId, DoubtInfo_Add doubt)
 {
     using (var biz = new GameBiz.Business.GameBizBusinessManagement())
     {
         biz.BeginTran();
         using (var manager = new DoubtManager())
         {
             var entity = manager.GetDoubtById(doubtId);
             if (entity == null)
             {
                 throw new ArgumentException("指定编号的问题不存在");
             }
             entity.Title                 = doubt.Title;
             entity.Description           = doubt.Description;
             entity.Category              = doubt.Category;
             entity.UpdateTime            = DateTime.Now;
             entity.UpdateUserKey         = doubt.CreateUserKey;
             entity.UpdateUserDisplayName = doubt.CreateUserDisplayName;
             manager.UpdateDoubt(entity);
         }
         biz.CommitTran();
     }
 }