Exemplo n.º 1
0
        /// <summary>
        /// 更新商家信息
        /// </summary>
        /// <param name="storeTypeEntity"></param>
        /// <returns></returns>
        public Tuple <bool, string> UpdateStoreInfo(StoreInfoParam storeInfo)
        {
            var count = helper.QueryScalar($@"select Count(1) from [User] where Phone='{storeInfo.Phone}' and Id not in ({storeInfo.Id})");

            if (Convert.ToInt32(count) > 0)
            {
                return(Tuple.Create(false, "该手机号已经存在"));
            }

            int result = 0;

            if (storeInfo.Id > 0)
            {
                string password = string.Empty;
                var    temp     = helper.QueryScalar($@"select [Password] from [User] where Id={storeInfo.Id}");
                if (temp.ToString() == storeInfo.Password)
                {
                    password = temp.ToString();
                }
                else
                {
                    password = Util.MD5Encrypt(storeInfo.Password);
                }
                result = helper.Execute($@"update [User] set UserName='******',
 Phone='{storeInfo.Phone}',Password='******' where Id={storeInfo.Id};
update StoreDetailInfo set StoreName='{storeInfo.StoreName}',BusinessLicense='{storeInfo.BusinessLicense}',
LegalPerson='{storeInfo.LegalPerson}',LegalPersonIdCardF='{storeInfo.LegalPersonIdCardF}',
LegalPersonIdCardB='{storeInfo.LegalPersonIdCardB}',Province='{storeInfo.Province}',City='{storeInfo.City}',
County='{storeInfo.County}',DetailAddress='{storeInfo.DetailAddress}',Contacts='{storeInfo.Contacts}',
ContactsPhone='{storeInfo.ContactsPhone}' where UserId={storeInfo.Id};");
            }

            return(Tuple.Create(result > 0 ? true : false, string.Empty));
        }
Exemplo n.º 2
0
        public ResponseResultDto <bool> UpdateStoreInfo(StoreInfoParam storeInfo)
        {
            if (storeInfo == null || storeInfo.Id < 0)
            {
                return(new ResponseResultDto <bool>
                {
                    IsSuccess = false,
                    ErrorMessage = "参数异常",
                    Result = false
                });
            }
            var result = storeApiRepository.UpdateStoreInfo(storeInfo);

            return(new ResponseResultDto <bool>
            {
                IsSuccess = result.Item1,
                ErrorMessage = string.Empty,
                Result = result.Item1
            });
        }