/// <summary>
 /// 更新(物流公司账号表)
 ///</summary>
 /// <param name="entity">物流公司账号表</param>
 /// <returns>影响的行</returns>
 /// <remarks> 2015-10-10 朱成果 创建</remarks>
 public override int Update(LgDeliveryCompanyAccount entity)
 {
     return(Context.Update("LGDELIVERYCOMPANYACCOUNT", entity)
            .AutoMap(o => o.SysNo)
            .Where("SysNo", entity.SysNo)
            .Execute());
 }
 /// <summary>
 /// 插入(物流公司账号表)
 ///</summary>
 /// <param name="entity">物流公司账号表</param>
 /// <returns>新增记录编号</returns>
 /// <remarks> 2015-10-10 朱成果 创建</remarks>
 public override int Insert(LgDeliveryCompanyAccount entity)
 {
     entity.SysNo = Context.Insert("LGDELIVERYCOMPANYACCOUNT", entity)
                    .AutoMap(o => o.SysNo)
                    .ExecuteReturnLastId <int>("SysNo");
     return(entity.SysNo);
 }
Пример #3
0
        /// <summary>
        /// 创建电子面单账号
        /// </summary>
        /// <param name="model">物流公司账号实体</param>
        /// <returns>是否创建成功(Result中 StatusCode==1为添加 StatusCode==2为更新)</returns>
        /// <remarks>2015-10-10 王江 创建</remarks>
        public Result AddOrUpdate(LgDeliveryCompanyAccount model, ref Result result, int CurrentUserSysNo)
        {
            model.AccountName = model.AccountName.Trim();
            //创建
            if (model.SysNo == 0)
            {
                //检测名称是否存在

                bool isExist = ILgDeliveryCompanyAccountDao.Instance.IsExistName(model);
                if (isExist)
                {
                    result.Message = "该名称已存在";
                    return(result);
                }

                model.CreateBy       = CurrentUserSysNo;
                model.CreateDate     = DateTime.Now;
                model.LastUpdateBy   = CurrentUserSysNo;
                model.LastUpdateDate = DateTime.Now;

                //执行添加操作
                result.Status     = ILgDeliveryCompanyAccountDao.Instance.Insert(model) > 0;
                result.StatusCode = 1;
                return(result);
            }
            //更新
            else
            {
                //检测名称是否存在
                bool isExist = ILgDeliveryCompanyAccountDao.Instance.IsExistNameWithOutSelf(model);
                if (isExist)
                {
                    result.Message = "该名称已存在";
                    return(result);
                }
                LgDeliveryCompanyAccount entity = ILgDeliveryCompanyAccountDao.Instance.GetEntity(model.SysNo);
                if (entity == null)
                {
                    result.Message = "未找到该记录";
                    return(result);
                }
                entity.AccountName       = model.AccountName;
                entity.DeliveryTypeSysNo = model.DeliveryTypeSysNo;
                entity.AccountId         = model.AccountId;
                entity.AccountSecretKey  = model.AccountSecretKey;
                entity.LastUpdateBy      = CurrentUserSysNo;
                entity.LastUpdateDate    = DateTime.Now;
                //执行更新操作
                result.Status     = ILgDeliveryCompanyAccountDao.Instance.Update(entity) > 0;
                result.StatusCode = 2;
                return(result);
            }
        }
Пример #4
0
 /// <summary>
 /// 判断是否存在,不包含自身
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2015-10-10 王江 创建</remarks>
 public abstract bool IsExistNameWithOutSelf(LgDeliveryCompanyAccount entity);
Пример #5
0
 /// <summary>
 /// 判断是否存在
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2015-10-10 王江 创建</remarks>
 public abstract bool IsExistName(LgDeliveryCompanyAccount entity);
Пример #6
0
 /// <summary>
 /// 更新(物流公司账号表)
 /// </summary>
 /// <param name="entity">物流公司账号表</param>
 /// <returns>影响的行</returns>
 /// <remarks> 2015-10-10 朱成果 创建</remarks>
 public abstract int Update(LgDeliveryCompanyAccount entity);
Пример #7
0
 /// <summary>
 /// 插入(物流公司账号表)
 ///</summary>
 /// <param name="entity">物流公司账号表</param>
 /// <returns>新增记录编号</returns>
 /// <remarks> 2015-10-10 朱成果 创建</remarks>
 public abstract int Insert(LgDeliveryCompanyAccount entity);
 /// <summary>
 /// 检测名称是否存在(不包含此记录本身)
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns>返回true则存在</returns>
 /// <remarks>2015-10-10 王江 创建</remarks>
 public override bool IsExistNameWithOutSelf(LgDeliveryCompanyAccount entity)
 {
     return(Context.Sql("select count(1) from LGDELIVERYCOMPANYACCOUNT m where m.accountname=@accountname and m.sysno!=@paraSysNo")
            .Parameter("accountname", entity.AccountName).Parameter("paraSysNo", entity.SysNo).QuerySingle <int>() > 0);
 }
 /// <summary>
 /// 检测名称是否存在
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns>返回true则存在</returns>
 /// <remarks>2015-10-10 王江 创建</remarks>
 public override bool IsExistName(LgDeliveryCompanyAccount entity)
 {
     return(Context.Sql("select count(1) from LGDELIVERYCOMPANYACCOUNT m where m.accountname=@accountname")
            .Parameter("accountname", entity.AccountName).QuerySingle <int>() > 0);
 }