Exemple #1
0
        public void AddCard()
        {
            CardDto dto = new CardDto();
            dto.CardCode = Convert.ToInt32(Request["CardCode"].ToString());
            dto.CardName = Request["CardName"].ToString();
            dto.CardBankType = Convert.ToInt32(Request["CardBankType"].ToString());
            dto.CardUseType = Convert.ToInt32(Request["CardUseType"].ToString());
            dto.CardAmount = Convert.ToInt32(Request["CardAmount"].ToString());

            DateTime CardBillDate;
            if (DateTime.TryParse(Request["CardBillDate"].ToString(), out CardBillDate) == false)
                throw new ArgumentNullException();
            dto.CardBillDate = CardBillDate;
            dto.CardDelayDay = Convert.ToInt32(Request["CardDelayDay"].ToString());

            dto.CardInputDate = DateTime.Now;
            dto.Remark = Request["Remark"].ToString();
            int num = 1;
            try
            {
                _bll.AddCard(dto);
                if (num > 0)
                {
                    JsonFormat(new ExtJson { success = true, msg = "添加成功!" });
                }
                else {
                    JsonFormat(new ExtJson { success = true, msg = "添加失败!" });
                }
            }
            catch
            {
                JsonFormat(new ExtJson { success = true, msg = "添加失败!" });
            }
        }
Exemple #2
0
 public void AddCard(CardDto dto)
 {
     if (dto == null)
         throw new ArgumentNullException();
     var _unitOfWork = _repostory.UnitOfWork;
     var _build = CardFactory.Create(
         dto.CardCode,
         dto.CardName,
         dto.CardBankType,
         dto.CardUseType,
         dto.CardAmount,
         dto.CardBillDate,
         dto.CardDelayDay,
         dto.CardInputDate,
         dto.Remark
         );
     _repostory.Add(_build);
     _unitOfWork.Commit();
 }
Exemple #3
0
 private CardDto DataRowToModel(DataRow row)
 {
     var model = new CardDto();
     if (row != null)
     {
         if (!row["ID"].IsNullOrEmpty())
         {
             model.ID = row["ID"].ToInt32();
         }
         if (!row["CardCode"].IsNullOrEmpty())
         {
             model.CardCode = row["CardCode"].ToInt32();
         }
         if (!row["CardName"].IsNullOrEmpty())
         {
             model.CardName = row["CardName"].ToString();
         }
         if (!row["CardBankType"].IsNullOrEmpty())
         {
             model.CardBankType = row["CardBankType"].ToInt32();
         }
         if (!row["CardUseType"].IsNullOrEmpty())
         {
             model.CardUseType = row["CardUseType"].ToInt32();
         }
         if (!row["CardAmount"].IsNullOrEmpty())
         {
             model.CardAmount = row["CardAmount"].ToInt32();
         }
         if (!row["CardBillDate"].IsNullOrEmpty())
         {
             model.CardBillDate = row["CardBillDate"].ToDateTime();
         }
         if (!row["CardDelayDay"].IsNullOrEmpty())
         {
             model.CardDelayDay = row["CardDelayDay"].ToInt32();
         }
         if (!row["CardInputDate"].IsNullOrEmpty())
         {
             model.CardInputDate = row["CardInputDate"].ToDateTime();
         }
         if (!row["Remark"].IsNullOrEmpty())
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return model;
 }