/// <summary> /// 读取记录列表。 /// </summary> /// <param name="db">数据库操作对象</param> /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param> public IList <MemBillVATEntity> GetMemBillVATAll() { string sql = @"SELECT [Id],[MemId],[CompanyName],[CompanyCode],[CompanyAddress],[CompanyPhone],[CompanyBank],[BankAccount],[ReceiverName],[ReceiverPhone],[ReceiverProvince],[ReceiverCity],[ReceiverAddress],[Status],[CreateTime],[UpdateTime],[CheckManId],[CheckTime] from dbo.[MemBillVAT] WITH(NOLOCK) "; IList <MemBillVATEntity> entityList = new List <MemBillVATEntity>(); DbCommand cmd = db.GetSqlStringCommand(sql); using (IDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { MemBillVATEntity entity = new MemBillVATEntity(); entity.Id = StringUtils.GetDbInt(reader["Id"]); entity.MemId = StringUtils.GetDbInt(reader["MemId"]); entity.CompanyName = StringUtils.GetDbString(reader["CompanyName"]); entity.CompanyCode = StringUtils.GetDbString(reader["CompanyCode"]); entity.CompanyAddress = StringUtils.GetDbString(reader["CompanyAddress"]); entity.CompanyPhone = StringUtils.GetDbString(reader["CompanyPhone"]); entity.CompanyBank = StringUtils.GetDbString(reader["CompanyBank"]); entity.BankAccount = StringUtils.GetDbString(reader["BankAccount"]); entity.ReceiverName = StringUtils.GetDbString(reader["ReceiverName"]); entity.ReceiverPhone = StringUtils.GetDbString(reader["ReceiverPhone"]); entity.ReceiverProvince = StringUtils.GetDbInt(reader["ReceiverProvince"]); entity.ReceiverCity = StringUtils.GetDbInt(reader["ReceiverCity"]); entity.ReceiverAddress = StringUtils.GetDbString(reader["ReceiverAddress"]); entity.Status = StringUtils.GetDbInt(reader["Status"]); entity.CreateTime = StringUtils.GetDbDateTime(reader["CreateTime"]); entity.UpdateTime = StringUtils.GetDbDateTime(reader["UpdateTime"]); entity.CheckManId = StringUtils.GetDbInt(reader["CheckManId"]); entity.CheckTime = StringUtils.GetDbDateTime(reader["CheckTime"]); entityList.Add(entity); } } return(entityList); }
/// <summary> /// 判断当前节点是否已存在相同的 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int ExistNum(MemBillVATEntity entity) { ///id=0,判断总数,ID>0判断除自己之外的总数 string sql = @"Select count(1) from dbo.[MemBillVAT] WITH(NOLOCK) "; string where = "where "; if (entity.Id == 0) { where = where + " (CompanyName=@CompanyName) "; where = where + " (ReceiverName=@ReceiverName) "; } else { where = where + " id<>@Id and (CompanyName=@CompanyName) "; where = where + " id<>@Id and (ReceiverName=@ReceiverName) "; } sql = sql + where; DbCommand cmd = db.GetSqlStringCommand(sql); if (entity.Id > 0) { db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id); } db.AddInParameter(cmd, "@CompanyName", DbType.String, entity.CompanyName); db.AddInParameter(cmd, "@ReceiverName", DbType.String, entity.ReceiverName); object identity = db.ExecuteScalar(cmd); if (identity == null || identity == DBNull.Value) { return(0); } return(Convert.ToInt32(identity)); }
/// <summary> /// 插入一条记录到表MemBillVAT,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0 /// </summary> /// <param name="db">数据库操作对象</param> /// <param name="memBillVAT">待插入的实体对象</param> public int AddMemBillVAT(MemBillVATEntity entity) { string sql = @" insert into MemBillVAT( [MemId],[CompanyName],[CompanyCode],[CompanyAddress],[CompanyPhone],[CompanyBank],[BankAccount],[ReceiverName],[ReceiverPhone],[ReceiverProvince],[ReceiverCity],[ReceiverAddress],[Status],[CreateTime],[UpdateTime],IsDefault,BillType )VALUES ( @MemId,@CompanyName,@CompanyCode,@CompanyAddress,@CompanyPhone,@CompanyBank,@BankAccount,@ReceiverName,@ReceiverPhone,@ReceiverProvince,@ReceiverCity,@ReceiverAddress,@Status,@CreateTime,@UpdateTime,@IsDefault,@BillType ); SELECT SCOPE_IDENTITY();" ; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@MemId", DbType.Int32, entity.MemId); db.AddInParameter(cmd, "@CompanyName", DbType.String, entity.CompanyName); db.AddInParameter(cmd, "@CompanyCode", DbType.String, entity.CompanyCode); db.AddInParameter(cmd, "@CompanyAddress", DbType.String, entity.CompanyAddress); db.AddInParameter(cmd, "@CompanyPhone", DbType.String, entity.CompanyPhone); db.AddInParameter(cmd, "@CompanyBank", DbType.String, entity.CompanyBank); db.AddInParameter(cmd, "@BankAccount", DbType.String, entity.BankAccount); db.AddInParameter(cmd, "@ReceiverName", DbType.String, entity.ReceiverName); db.AddInParameter(cmd, "@ReceiverPhone", DbType.String, entity.ReceiverPhone); db.AddInParameter(cmd, "@ReceiverProvince", DbType.Int32, entity.ReceiverProvince); db.AddInParameter(cmd, "@ReceiverCity", DbType.Int32, entity.ReceiverCity); db.AddInParameter(cmd, "@ReceiverAddress", DbType.String, entity.ReceiverAddress); db.AddInParameter(cmd, "@Status", DbType.Int32, 0); db.AddInParameter(cmd, "@IsDefault", DbType.Int32, 0); db.AddInParameter(cmd, "@BillType", DbType.Int32, entity.BillType); db.AddInParameter(cmd, "@CreateTime", DbType.DateTime, DateTime.Now.ToString()); db.AddInParameter(cmd, "@UpdateTime", DbType.DateTime, DateTime.Now.ToString()); object identity = db.ExecuteScalar(cmd); if (identity == null || identity == DBNull.Value) { return(0); } return(Convert.ToInt32(identity)); }
public int AddMemBillVATMsg(MemBillVATEntity entity) { string sql = @"insert into MemBillVAT( [MemId],[CompanyName],[CompanyCode],[CompanyAddress],[CompanyPhone],[CompanyBank],[BankAccount], [Status],[CreateTime],[UpdateTime] )VALUES ( @MemId,@CompanyName,@CompanyCode,@CompanyAddress,@CompanyPhone,@CompanyBank,@BankAccount,0,@CreateTime,@UpdateTime ); SELECT SCOPE_IDENTITY();" ; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id); db.AddInParameter(cmd, "@MemId", DbType.Int32, entity.MemId); db.AddInParameter(cmd, "@CompanyName", DbType.String, entity.CompanyName); db.AddInParameter(cmd, "@CompanyCode", DbType.String, entity.CompanyCode); db.AddInParameter(cmd, "@CompanyAddress", DbType.String, entity.CompanyAddress); db.AddInParameter(cmd, "@CompanyPhone", DbType.String, entity.CompanyPhone); db.AddInParameter(cmd, "@CompanyBank", DbType.String, entity.CompanyBank); db.AddInParameter(cmd, "@BankAccount", DbType.String, entity.BankAccount); db.AddInParameter(cmd, "@CreateTime", DbType.DateTime, DateTime.Now.ToString()); db.AddInParameter(cmd, "@UpdateTime", DbType.DateTime, DateTime.Now.ToString()); if (db.ExecuteNonQuery(cmd) > 0) { return(entity.Id); } else { return(0); } }
/// <summary> /// 根据主键值更新记录的全部字段(注意:该方法不会对自增字段、timestamp类型字段以及主键字段更新!如果要更新主键字段,请使用Update方法)。 /// 如果数据库有数据被更新了则返回True,否则返回False /// </summary> /// <param name="db">数据库操作对象</param> /// <param name="memBillVAT">待更新的实体对象</param> public int UpdateMemBillVAT(MemBillVATEntity entity) { string sql = @" UPDATE dbo.[MemBillVAT] SET [CompanyName]=@CompanyName,[CompanyCode]=@CompanyCode,[CompanyAddress]=@CompanyAddress,[CompanyPhone]=@CompanyPhone,[CompanyBank]=@CompanyBank,[BankAccount]=@BankAccount,[ReceiverName]=@ReceiverName,[ReceiverPhone]=@ReceiverPhone,[ReceiverProvince]=@ReceiverProvince,[ReceiverCity]=@ReceiverCity,[ReceiverAddress]=@ReceiverAddress,[Status]=@Status WHERE [BillType]=@BillType and [MemId]=@MemId"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@BillType", DbType.Int32, entity.BillType); db.AddInParameter(cmd, "@MemId", DbType.Int32, entity.MemId); db.AddInParameter(cmd, "@CompanyName", DbType.String, entity.CompanyName); db.AddInParameter(cmd, "@CompanyCode", DbType.String, entity.CompanyCode); db.AddInParameter(cmd, "@CompanyAddress", DbType.String, entity.CompanyAddress); db.AddInParameter(cmd, "@CompanyPhone", DbType.String, entity.CompanyPhone); db.AddInParameter(cmd, "@CompanyBank", DbType.String, entity.CompanyBank); db.AddInParameter(cmd, "@BankAccount", DbType.String, entity.BankAccount); db.AddInParameter(cmd, "@ReceiverName", DbType.String, entity.ReceiverName); db.AddInParameter(cmd, "@ReceiverPhone", DbType.String, entity.ReceiverPhone); db.AddInParameter(cmd, "@ReceiverProvince", DbType.Int32, entity.ReceiverProvince); db.AddInParameter(cmd, "@ReceiverCity", DbType.Int32, entity.ReceiverCity); db.AddInParameter(cmd, "@ReceiverAddress", DbType.String, entity.ReceiverAddress); db.AddInParameter(cmd, "@Status", DbType.Int32, entity.Status); if (db.ExecuteNonQuery(cmd) > 0) { return(entity.Id); } else { return(0); } }
public int UpdateMemBillVATMsg(MemBillVATEntity entity) { string sql = @" UPDATE dbo.[MemBillVAT] SET [CompanyName]=@CompanyName,[CompanyCode]=@CompanyCode,[CompanyAddress]=@CompanyAddress,[CompanyPhone]=@CompanyPhone,[CompanyBank]=@CompanyBank,[BankAccount]=@BankAccount , [Status]=0 ,[UpdateTime]=@UpdateTime WHERE [Id]=@id and [MemId]=@MemId"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id); db.AddInParameter(cmd, "@MemId", DbType.Int32, entity.MemId); db.AddInParameter(cmd, "@CompanyName", DbType.String, entity.CompanyName); db.AddInParameter(cmd, "@CompanyCode", DbType.String, entity.CompanyCode); db.AddInParameter(cmd, "@CompanyAddress", DbType.String, entity.CompanyAddress); db.AddInParameter(cmd, "@CompanyPhone", DbType.String, entity.CompanyPhone); db.AddInParameter(cmd, "@CompanyBank", DbType.String, entity.CompanyBank); db.AddInParameter(cmd, "@BankAccount", DbType.String, entity.BankAccount); db.AddInParameter(cmd, "@UpdateTime", DbType.DateTime, entity.UpdateTime); if (db.ExecuteNonQuery(cmd) > 0) { return(entity.Id); } else { return(0); } }
public ActionResult Register4() { MemBillVATEntity _en = new MemBillVATEntity(); int memid = CookieBLL.GetRegisterCookie(); if (memid > 0) { _en = MemBillVATBLL.Instance.GetMemBillVATByMemId(memid); } else { return(RedirectToAction("Login")); } ViewBag.BillEntity = _en; return(View()); }
public MemBillVATEntity GetMemBillVATByMemId(int memid) { string sql = @"SELECT top(1) [Id],[MemId],[CompanyName],[CompanyCode],[CompanyAddress],[CompanyPhone],[CompanyBank],[BankAccount],[ReceiverName],[ReceiverPhone],[ReceiverProvince],[ReceiverCity],[ReceiverAddress],[Status],[CreateTime],[UpdateTime],[CheckManId],[CheckTime] ,IsDefault,BillType FROM dbo.[MemBillVAT] WITH(NOLOCK) WHERE [MemId]=@MemId and BillType=@BillType" ; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@MemId", DbType.Int32, memid); db.AddInParameter(cmd, "@BillType", DbType.Int32, (int)BillType.VAT); MemBillVATEntity entity = new MemBillVATEntity(); using (IDataReader reader = db.ExecuteReader(cmd)) { if (reader.Read()) { entity.Id = StringUtils.GetDbInt(reader["Id"]); entity.MemId = StringUtils.GetDbInt(reader["MemId"]); entity.CompanyName = StringUtils.GetDbString(reader["CompanyName"]); entity.CompanyCode = StringUtils.GetDbString(reader["CompanyCode"]); entity.CompanyAddress = StringUtils.GetDbString(reader["CompanyAddress"]); entity.CompanyPhone = StringUtils.GetDbString(reader["CompanyPhone"]); entity.CompanyBank = StringUtils.GetDbString(reader["CompanyBank"]); entity.BankAccount = StringUtils.GetDbString(reader["BankAccount"]); entity.ReceiverName = StringUtils.GetDbString(reader["ReceiverName"]); entity.ReceiverPhone = StringUtils.GetDbString(reader["ReceiverPhone"]); entity.ReceiverProvince = StringUtils.GetDbInt(reader["ReceiverProvince"]); entity.ReceiverCity = StringUtils.GetDbInt(reader["ReceiverCity"]); entity.ReceiverAddress = StringUtils.GetDbString(reader["ReceiverAddress"]); entity.Status = StringUtils.GetDbInt(reader["Status"]); entity.CreateTime = StringUtils.GetDbDateTime(reader["CreateTime"]); entity.UpdateTime = StringUtils.GetDbDateTime(reader["UpdateTime"]); entity.CheckManId = StringUtils.GetDbInt(reader["CheckManId"]); entity.CheckTime = StringUtils.GetDbDateTime(reader["CheckTime"]); entity.IsDefault = StringUtils.GetDbInt(reader["IsDefault"]); entity.BillType = StringUtils.GetDbInt(reader["BillType"]); } } return(entity); }
public int UpdateMemBillVATReciever(MemBillVATEntity entity) { string sql = @" UPDATE dbo.[MemBillVAT] SET IsDefault=0 where [MemId]=@MemId UPDATE dbo.[MemBillVAT] SET [ReceiverName]=@ReceiverName,[ReceiverPhone]=@ReceiverPhone,[ReceiverProvince]=@ReceiverProvince,[ReceiverCity]=@ReceiverCity,[ReceiverAddress]=@ReceiverAddress ,IsDefault=1 WHERE [Id]=@id and [MemId]=@MemId"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id); db.AddInParameter(cmd, "@MemId", DbType.Int32, entity.MemId); db.AddInParameter(cmd, "@ReceiverName", DbType.String, entity.ReceiverName); db.AddInParameter(cmd, "@ReceiverPhone", DbType.String, entity.ReceiverPhone); db.AddInParameter(cmd, "@ReceiverProvince", DbType.Int32, entity.ReceiverProvince); db.AddInParameter(cmd, "@ReceiverCity", DbType.Int32, entity.ReceiverCity); db.AddInParameter(cmd, "@ReceiverAddress", DbType.String, entity.ReceiverAddress); if (db.ExecuteNonQuery(cmd) > 0) { return(entity.Id); } else { return(0); } }
/// <summary> /// 企业申请信息详情 /// </summary> /// <returns></returns> public ActionResult SupplierDetail() { int _memid = QueryString.IntSafeQ("MemId", 0); MemberEntity _mementity = MemberBLL.Instance.GetMember(_memid); MemberInfoEntity _meminfoentity = MemberInfoBLL.Instance.GetMemberInfoByMemId(_memid); MemBillVATEntity _membill = MemBillVATBLL.Instance.GetMemBillVATByMemId(_memid); MemStoreEntity _storeentity = StoreBLL.Instance.GetStoreByMemId(_memid); string _provinceName = GYProvinceBLL.Instance.GetGYProvince(_storeentity.ProvinceId).Name; string _cityName = GYCityBLL.Instance.GetGYCityByCode(_storeentity.CityId.ToString()).Name; ViewBag.AddressofStore = _provinceName + _cityName; _provinceName = GYProvinceBLL.Instance.GetGYProvince(_membill.ReceiverProvince).Name; _cityName = GYCityBLL.Instance.GetGYCityByCode(_membill.ReceiverCity.ToString()).Name; ViewBag.AddressofBill = _provinceName + _cityName; ViewBag.mementity = _mementity; ViewBag.meninfoentity = _meminfoentity; ViewBag.membill = _membill; ViewBag.storentity = _storeentity; return(View()); }
public int UpdateMemBillVATMsg(MemBillVATEntity entity) { return(MemBillVATDA.Instance.UpdateMemBillVATMsg(entity)); }
/// <summary> /// 插入一条记录到表MemBillVAT,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0。 /// 该方法提供给界面等UI层调用 /// </summary> /// <param name="memBillVAT">要添加的MemBillVAT数据实体对象</param> public int AddMemBillVAT(MemBillVATEntity memBillVAT) { return(MemBillVATDA.Instance.AddMemBillVAT(memBillVAT)); }
/// <summary> /// 更新一条MemBillVAT记录。 /// 该方法提供给界面等UI层调用 /// </summary> /// <param name="memBillVAT">待更新的实体对象</param> /// <param name="columns">要更新的列名,不提供任何列名时默认将更新主键之外的所有列</param> public int UpdateMemBillVAT(MemBillVATEntity memBillVAT) { return(MemBillVATDA.Instance.UpdateMemBillVAT(memBillVAT)); }
public MemBillVATEntity GetMemBillVATByTitle(int memid, int _billid, string title, int billtype) { MemBillVATEntity _entity = MemBillVATDA.Instance.GetMemBillVATByTitle(memid, _billid, title, billtype); return(_entity); }
/// <summary> /// 判断对象是否存在 /// </summary> /// <param name="dicEnum"></param> /// <returns></returns> public bool IsExist(MemBillVATEntity memBillVAT) { return(MemBillVATDA.Instance.ExistNum(memBillVAT) > 0); }
public MemBillVATEntity GetMemBillVATByMemId(int memid) { MemBillVATEntity _entity = MemBillVATDA.Instance.GetMemBillVATByMemId(memid); return(_entity); }
/// <summary> /// 根据主键获取一个MemBillVAT实体记录。 /// 该方法提供给其他实体的业务逻辑层(Logic)方法调用 /// </summary> /// <returns>MemBillVAT实体</returns> /// <param name="columns">要返回的列</param> public MemBillVATEntity GetMemBillVAT(int id) { MemBillVATEntity _entity = MemBillVATDA.Instance.GetMemBillVAT(id); return(_entity); }
public MemBillVATEntity GetMemBillVATByTitle(int memid, int _billid, string title, int billtype) { string where = " where [MemId]=@MemId "; if (_billid > 0) { where += " and Id=@Id "; } else { if (!string.IsNullOrEmpty(title)) { where += " and CompanyName=@CompanyName "; } if (billtype != -1) { where += " and BillType=@BillType "; } } string sql = @"SELECT top(1) [Id],[MemId],[CompanyName],[CompanyCode],[CompanyAddress],[CompanyPhone],[CompanyBank],[BankAccount],[ReceiverName],[ReceiverPhone],[ReceiverProvince],[ReceiverCity],[ReceiverAddress],[Status],[CreateTime],[UpdateTime],[CheckManId],[CheckTime] ,IsDefault,BillType FROM dbo.[MemBillVAT] WITH(NOLOCK) " + where; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@MemId", DbType.Int32, memid); if (_billid > 0) { db.AddInParameter(cmd, "@Id", DbType.Int32, _billid); } else { if (!string.IsNullOrEmpty(title)) { db.AddInParameter(cmd, "@CompanyName", DbType.String, title); } if (billtype != -1) { db.AddInParameter(cmd, "@BillType", DbType.Int32, billtype); } } MemBillVATEntity entity = new MemBillVATEntity(); using (IDataReader reader = db.ExecuteReader(cmd)) { if (reader.Read()) { entity.Id = StringUtils.GetDbInt(reader["Id"]); entity.MemId = StringUtils.GetDbInt(reader["MemId"]); entity.CompanyName = StringUtils.GetDbString(reader["CompanyName"]); entity.CompanyCode = StringUtils.GetDbString(reader["CompanyCode"]); entity.CompanyAddress = StringUtils.GetDbString(reader["CompanyAddress"]); entity.CompanyPhone = StringUtils.GetDbString(reader["CompanyPhone"]); entity.CompanyBank = StringUtils.GetDbString(reader["CompanyBank"]); entity.BankAccount = StringUtils.GetDbString(reader["BankAccount"]); entity.ReceiverName = StringUtils.GetDbString(reader["ReceiverName"]); entity.ReceiverPhone = StringUtils.GetDbString(reader["ReceiverPhone"]); entity.ReceiverProvince = StringUtils.GetDbInt(reader["ReceiverProvince"]); entity.ReceiverCity = StringUtils.GetDbInt(reader["ReceiverCity"]); entity.ReceiverAddress = StringUtils.GetDbString(reader["ReceiverAddress"]); entity.Status = StringUtils.GetDbInt(reader["Status"]); entity.CreateTime = StringUtils.GetDbDateTime(reader["CreateTime"]); entity.UpdateTime = StringUtils.GetDbDateTime(reader["UpdateTime"]); entity.CheckManId = StringUtils.GetDbInt(reader["CheckManId"]); entity.CheckTime = StringUtils.GetDbDateTime(reader["CheckTime"]); entity.IsDefault = StringUtils.GetDbInt(reader["IsDefault"]); entity.BillType = StringUtils.GetDbInt(reader["BillType"]); } } return(entity); }
/// <summary> /// 获取增值税发票列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="recordCount"></param> /// <param name="companyName"></param> /// <param name="status"></param> /// <param name="billType"></param> /// <returns></returns> public IList <MemBillVATEntity> GetMemBillVATList(int pageSize, int pageIndex, ref int recordCount, string companyName, int status, int billType) { string where = " where 1=1"; if (!string.IsNullOrEmpty(companyName)) { where += " And CompanyName like @CompanyName"; } if (status > -1) { where += " And Status=@Status"; } if (billType > 0) { where += " And BillType=@BillType"; } string sql = @"SELECT [Id],[MemId],[CompanyName],[CompanyCode],[CompanyAddress],[CompanyPhone],[CompanyBank],[BankAccount],[ReceiverName],[ReceiverPhone],[ReceiverProvince],[ReceiverCity],[ReceiverAddress],[Status],[CreateTime],[UpdateTime],[CheckManId],[CheckTime],IsDefault,BillType FROM (SELECT ROW_NUMBER() OVER (ORDER BY BillType desc,isdefault desc, Id desc) AS ROWNUMBER, [Id],[MemId],[CompanyName],[CompanyCode],[CompanyAddress],[CompanyPhone],[CompanyBank],[BankAccount],[ReceiverName],[ReceiverPhone],[ReceiverProvince],[ReceiverCity],[ReceiverAddress],[Status],[CreateTime],[UpdateTime],[CheckManId],[CheckTime],IsDefault,BillType from dbo.[MemBillVAT] WITH(NOLOCK) " + where + @" ) as temp where rownumber BETWEEN ((@PageIndex - 1) * @PageSize + 1) AND @PageIndex * @PageSize" ; string sql2 = " Select count(1) from dbo.[MemBillVAT] " + where; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@PageIndex", DbType.Int32, pageIndex); db.AddInParameter(cmd, "@PageSize", DbType.Int32, pageSize); IList <MemBillVATEntity> entityList = new List <MemBillVATEntity>(); if (!string.IsNullOrEmpty(companyName)) { db.AddInParameter(cmd, "@CompanyName", DbType.String, "%" + companyName + "%"); } if (status > -1) { db.AddInParameter(cmd, "@Status", DbType.Int32, status); } if (billType > 0) { db.AddInParameter(cmd, "@BillType", DbType.Int32, billType); } using (IDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { MemBillVATEntity entity = new MemBillVATEntity(); entity.Id = StringUtils.GetDbInt(reader["Id"]); entity.MemId = StringUtils.GetDbInt(reader["MemId"]); entity.CompanyName = StringUtils.GetDbString(reader["CompanyName"]); entity.CompanyCode = StringUtils.GetDbString(reader["CompanyCode"]); entity.CompanyAddress = StringUtils.GetDbString(reader["CompanyAddress"]); entity.CompanyPhone = StringUtils.GetDbString(reader["CompanyPhone"]); entity.CompanyBank = StringUtils.GetDbString(reader["CompanyBank"]); entity.BankAccount = StringUtils.GetDbString(reader["BankAccount"]); entity.ReceiverName = StringUtils.GetDbString(reader["ReceiverName"]); entity.ReceiverPhone = StringUtils.GetDbString(reader["ReceiverPhone"]); entity.ReceiverProvince = StringUtils.GetDbInt(reader["ReceiverProvince"]); entity.ReceiverCity = StringUtils.GetDbInt(reader["ReceiverCity"]); entity.ReceiverAddress = StringUtils.GetDbString(reader["ReceiverAddress"]); entity.Status = StringUtils.GetDbInt(reader["Status"]); entity.CreateTime = StringUtils.GetDbDateTime(reader["CreateTime"]); entity.UpdateTime = StringUtils.GetDbDateTime(reader["UpdateTime"]); entity.CheckManId = StringUtils.GetDbInt(reader["CheckManId"]); entity.CheckTime = StringUtils.GetDbDateTime(reader["CheckTime"]); entity.IsDefault = StringUtils.GetDbInt(reader["IsDefault"]); entity.BillType = StringUtils.GetDbInt(reader["BillType"]); entityList.Add(entity); } } cmd = db.GetSqlStringCommand(sql2); if (!string.IsNullOrEmpty(companyName)) { db.AddInParameter(cmd, "@CompanyName", DbType.String, "%" + companyName + "%"); } if (status > -1) { db.AddInParameter(cmd, "@Status", DbType.Int32, status); } if (billType > 0) { db.AddInParameter(cmd, "@BillType", DbType.Int32, billType); } using (IDataReader reader = db.ExecuteReader(cmd)) { if (reader.Read()) { recordCount = StringUtils.GetDbInt(reader[0]); } else { recordCount = 0; } } return(entityList); }
public int AddMemBillVATMsg(MemBillVATEntity entity) { return(MemBillVATDA.Instance.AddMemBillVATMsg(entity)); }
public int UpdateMemBillVATReciever(MemBillVATEntity entity) { return(MemBillVATDA.Instance.UpdateMemBillVATReciever(entity)); }
/// <summary> /// 生成真实订单 /// </summary> /// <returns></returns> public string CreateOrder() { ResultObj _result = new ResultObj(); int _resultstatus = (int)CommonStatus.Fail; long _preordercode = FormString.LongIntSafeQ("preordercode"); int _addressid = FormString.IntSafeQ("addressid"); //int _paytype = FormString.IntSafeQ("paytype"); int _systype = FormString.IntSafeQ("systype"); if (_systype == 0) { _systype = (int)SystemType.B2B; } string _remark = FormString.SafeQ("remark"); string acceptername = FormString.SafeQ("acceptername"); int province = FormString.IntSafeQ("province"); int city = FormString.IntSafeQ("city"); string address = FormString.SafeQ("address", 500); string mobilephone = FormString.SafeQ("mobilephone"); int jifen = FormString.IntSafeQ("jifen"); int memcouponid = FormString.IntSafeQ("memcouponid"); int expressid = FormString.IntSafeQ("expressid"); int ordertype = FormString.IntSafeQ("ordertype", -1); if (jifen % 100 != 0) { jifen = jifen / 100 * 100; } if (jifen > 0 && !AssetBLL.Instance.CheckIntegralEnough(memid, jifen)) { jifen = 0; } int billtype = FormString.IntSafeQ("billtype"); OrderBillBasicEntity _billentity = new OrderBillBasicEntity(); _billentity.BillType = billtype; if (billtype == (int)BillType.Normal) { string title = FormString.SafeQ("billtitle", 200); _billentity.CompanyName = title; } else if (billtype == (int)BillType.VAT) { _billentity.BillId = FormString.IntSafeQ("billvatid"); MemBillVATEntity _mementity = MemBillVATBLL.Instance.GetMemBillVAT(memid); //if (_mementity.Status != 1) //{ // resultstatus = (int)CommonStatus.BillVATNoCheck; // _result.Status = resultstatus; // return JsonJC.ObjectToJson(_result); //} _billentity.ReceiverName = FormString.SafeQ("billvatrename"); _billentity.ReceiverPhone = FormString.SafeQ("billvatrephone"); _billentity.ReceiverProvince = FormString.IntSafeQ("billvatreprovince"); _billentity.ReceiverCity = FormString.IntSafeQ("billvatrecity"); _billentity.ReceiverAddress = FormString.SafeQ("billvatreaddress", 300); _billentity.CompanyName = _mementity.CompanyName; _billentity.CompanyPhone = _mementity.CompanyPhone; _billentity.CompanyCode = _mementity.CompanyCode; _billentity.CompanyBank = _mementity.CompanyBank; _billentity.CompanyAddress = _mementity.CompanyAddress; _billentity.BankAccount = _mementity.BankAccount; _billentity.Status = _mementity.Status; } VWOrderEntity _vworder = OrderDetailPreTempBLL.Instance.GetVWOrderByTempCode(_preordercode); if (ordertype != -1) { _vworder.OrderType = ordertype; } _vworder.OrderStyle = (int)OrderStyleEnum.Normal; _vworder.DisCountFee = _vworder.DisCountFee; decimal tempprice = _vworder.PreDisCountPrice - _vworder.DisCountFee; if (tempprice > 1) { decimal jifenamt = OrderCommonBLL.Instance.GetJiFenAmt(jifen); _vworder.Integral = jifen; _vworder.IntegralFee = jifenamt; tempprice = tempprice - jifenamt; } else { _vworder.Integral = 0; _vworder.IntegralFee = 0; } if (memcouponid > 0) { MemCouponsEntity couponen = MemCouponsBLL.Instance.GetCouponByMemCouponId(memid, memcouponid); if (couponen != null && couponen.Id == memcouponid && couponen.EndTime > DateTime.Now) { DicCouponsEntity dicen = couponen.DicCoupons; if (dicen.CouponType == (int)CouponTypeEnum.Money && dicen.MinimumReqAmount < tempprice) { _vworder.MemCouponsId = memcouponid; _vworder.CouponsFee = dicen.CouponValue; tempprice = tempprice - dicen.CouponValue; } } } _vworder.ActPrice = tempprice; //_vworder.PayType = _paytype; _vworder.ExpressCom = expressid; _vworder.Remark = _remark; _vworder.MemId = memid; _vworder.MemLevel = member.MemGrade; _vworder.IsStore = member.IsStore; //if (_paytype == (int)PayType.OutLine) //{ // _vworder.PayConfirmCode = StringUtils.GetRandomString(12); //} //if (billtype == 1) //{ // _vworder.BillType = (int)BillType.Normal; //} //else if (billtype == 2) //{ // _vworder.BillType = (int)BillType.VAT; //} OrderAddressEntity _address = new OrderAddressEntity(); _address.CityId = city; _address.AccepterName = acceptername; _address.ProvinceId = province; _address.Address = address; _address.MobilePhone = mobilephone; //_vworder.AcceptAddress = _address; if (_vworder.ActPrice >= 1) { List <int> listpdids = new List <int>(); string productdetails = ""; if (_vworder != null && _vworder.Details != null && _vworder.Details.Count > 0) { foreach (VWOrderDetailEntity ordetailentity in _vworder.Details) { listpdids.Add(ordetailentity.ProductDetailId); productdetails += "|" + ordetailentity.ProductDetailId.ToString() + "_" + ordetailentity.Num.ToString(); } if (productdetails != "") { productdetails = productdetails.TrimStart('|'); if (ProductStyleBLL.Instance.ProductsEnough(productdetails)) { string ordercode = OrderBLL.Instance.CreateOrder(_vworder, _address, _billentity); if (!string.IsNullOrEmpty(ordercode)) { //IList<OrderDetailEntity> _listproduct = OrderDetailBLL.Instance.GetOrderDetailAllByOrder(memid, StringUtils.GetDbLong(ordercode), false); //foreach (OrderDetailEntity _entity in _listproduct) //{ // productdetails += "|" + _entity.ProductDetailId.ToString() + "_" + _entity.Num.ToString(); //} if (productdetails != "") { if (ProductStyleBLL.Instance.ProductsToOrder(productdetails) > 0) { VWShoppingCartInfo ShoppingCartentity = ShoppingCartProcessor.GetShoppingCart(); ShoppingCartProcessor.RemoveCartItems(ShoppingCartentity, listpdids); //if (_vworder.PayType == (int)PayType.WeChat) //{ _result.Obj = ordercode; //} //else //{ // _result.Obj = ordercode; //} _result.Status = (int)CommonStatus.Success; return(JsonJC.ObjectToJson(_result)); } else { _result.Status = (int)CommonStatus.ProductLess; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); } } else { _result.Status = (int)CommonStatus.Success; _result.Obj = ordercode; return(JsonJC.ObjectToJson(_result)); } } } else { _result.Status = (int)CommonStatus.ProductLess; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); } } } } _result.Status = (int)CommonStatus.Fail; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); }
public string CompanyBillVATRegister() { ResultObj _loginentity = new ResultObj(); int memid = CookieBLL.GetRegisterCookie(); if (memid > 0) { MemberEntity _mem = MemberBLL.Instance.GetMember(memid); if (_mem != null) { if (_mem.Status == (int)MemberStatus.Active) { _loginentity.Status = (int)CommonStatus.HasAccount; } else { string companyname = FormString.SafeQ("companyname"); string companycode = FormString.SafeQ("companycode"); string companyaddress = FormString.SafeQ("companyaddress"); string companyphone = FormString.SafeQ("companyphone"); string companybank = FormString.SafeQ("companybank"); string bankaccount = FormString.SafeQ("bankaccount"); string receivername = FormString.SafeQ("receivername"); int province = FormString.IntSafeQ("province"); int city = FormString.IntSafeQ("city"); string receiverphone = FormString.SafeQ("receiverphone"); string receiveraddress = FormString.SafeQ("receiveraddress"); MemBillVATEntity _bill = new MemBillVATEntity(); _bill.BankAccount = bankaccount; _bill.BillType = (int)BillType.VAT; _bill.CompanyAddress = companyaddress; _bill.CompanyBank = companybank; _bill.CompanyCode = companycode; _bill.CompanyName = companyname; _bill.CompanyPhone = companyphone; _bill.CreateTime = DateTime.Now; _bill.MemId = memid; _bill.ReceiverAddress = receiveraddress; _bill.ReceiverCity = city; _bill.ReceiverName = receivername; _bill.ReceiverPhone = receiverphone; _bill.ReceiverProvince = province; _bill.UpdateTime = DateTime.Now; int billid = MemBillVATBLL.Instance.AddMemBillVAT(_bill); if (billid > 0) { _loginentity.Status = (int)CommonStatus.Success; } else { _loginentity.Status = (int)CommonStatus.Fail; } } } else { _loginentity.Status = (int)CommonStatus.Fail; } } else { _loginentity.Status = (int)CommonStatus.Fail; } return(JsonJC.ObjectToJson(_loginentity)); }
/// <summary> /// 生成真实订单 /// </summary> /// <returns></returns> public string CreateOrderXuQiu() { ResultObj _result = new ResultObj(); int _resultstatus = (int)CommonStatus.Fail; long _preordercode = FormString.LongIntSafeQ("preordercode"); int _addressid = FormString.IntSafeQ("addressid"); int _paytype = FormString.IntSafeQ("paytype"); string _remark = FormString.SafeQ("remark", 80000); string acceptername = FormString.SafeQ("acceptername"); int province = FormString.IntSafeQ("province"); int city = FormString.IntSafeQ("city"); string address = FormString.SafeQ("address", 500); string mobilephone = FormString.SafeQ("mobilephone"); int jifen = FormString.IntSafeQ("jifen"); int memcouponid = FormString.IntSafeQ("memcouponid");//折扣券Id int expressid = FormString.IntSafeQ("expressid"); int ordertype = FormString.IntSafeQ("ordertype", -1); if (jifen % 100 != 0) { jifen = jifen / 100 * 100; } if (jifen > 0 && !AssetBLL.Instance.CheckIntegralEnough(memid, jifen)) { jifen = 0; } int billtype = FormString.IntSafeQ("billtype"); OrderBillBasicEntity _billentity = new OrderBillBasicEntity(); _billentity.BillType = billtype; if (billtype == (int)BillType.Normal) { string title = FormString.SafeQ("billtitle", 200); _billentity.CompanyName = title; } else if (billtype == (int)BillType.VAT) { _billentity.BillId = FormString.IntSafeQ("billvatid"); MemBillVATEntity _mementity = MemBillVATBLL.Instance.GetMemBillVAT(memid); _billentity.ReceiverName = FormString.SafeQ("billvatrename"); _billentity.ReceiverPhone = FormString.SafeQ("billvatrephone"); _billentity.ReceiverProvince = FormString.IntSafeQ("billvatreprovince"); _billentity.ReceiverCity = FormString.IntSafeQ("billvatrecity"); _billentity.ReceiverAddress = FormString.SafeQ("billvatreaddress", 300); _billentity.CompanyName = _mementity.CompanyName; _billentity.CompanyPhone = _mementity.CompanyPhone; _billentity.CompanyCode = _mementity.CompanyCode; _billentity.CompanyBank = _mementity.CompanyBank; _billentity.CompanyAddress = _mementity.CompanyAddress; _billentity.BankAccount = _mementity.BankAccount; _billentity.Status = _mementity.Status; } OrderAddressEntity _address = new OrderAddressEntity(); _address.CityId = city; _address.AccepterName = acceptername; _address.ProvinceId = province; _address.Address = address; _address.MobilePhone = mobilephone; Dictionary <int, VWOrderEntity> _vworderdic = OrderDetailPreTempBLL.Instance.GetVWOrdersByTempCode(_preordercode); List <int> listpdids = new List <int>(); string productdetails = ""; if (_vworderdic.Keys.Count > 0) { IList <VWOrderRemarkEntity> remarklist = new List <VWOrderRemarkEntity>(); if (!string.IsNullOrEmpty(_remark)) { remarklist = JsonJC.JsonToObject <List <VWOrderRemarkEntity> >(_remark.Replace(""", "\"")); } Dictionary <int, string> remarkdic = new Dictionary <int, string>(); foreach (VWOrderRemarkEntity reenti in remarklist) { remarkdic.Add(StringUtils.GetDbInt(reenti.CGMemId), reenti.Remark); } foreach (int okey in _vworderdic.Keys) { if (okey > 0) { foreach (VWOrderDetailEntity oden in _vworderdic[okey].Details) { listpdids.Add(oden.ProductDetailId); productdetails += "|" + oden.ProductDetailId.ToString() + "_" + oden.Num.ToString(); } productdetails = productdetails.TrimStart('|'); OrderCommonBLL.Instance.GetTransFeeForOrder(_vworderdic[okey]); _vworderdic[okey].CGMemId = okey; _vworderdic[okey].PreOrderCode = _preordercode; _vworderdic[okey].OrderType = (int)OrderType.OnLine; _vworderdic[okey].NeedDeliver = 1; //需要发货 _vworderdic[okey].PayPrice = 0; //支付价格0 _vworderdic[okey].PayType = _paytype; _vworderdic[okey].ExpressCom = 0; //普通配送 _vworderdic[okey].MemId = memid; _vworderdic[okey].MemLevel = member.MemGrade; _vworderdic[okey].IsStore = member.IsStore; _vworderdic[okey].OrderStyle = (int)OrderStyleEnum.XuQiu; if (remarkdic.ContainsKey(okey)) { _vworderdic[okey].Remark = remarkdic[okey]; } } else { foreach (VWOrderDetailEntity oden in _vworderdic[okey].Details) { listpdids.Add(oden.ProductDetailId); } } } if (ProductStyleBLL.Instance.ProductsEnough(productdetails)) { string ordercode = OrderBLL.Instance.CreateOrderList(_vworderdic, _address, _billentity); if (!string.IsNullOrEmpty(ordercode)) { if (productdetails != "") { if (ProductStyleBLL.Instance.ProductsToOrder(productdetails) > 0) { VWShoppingCartInfo ShoppingCartentity = ShoppingXuQiuProcessor.GetShoppingXuQiu(); ShoppingXuQiuProcessor.RemoveCartXuQiuItems(ShoppingCartentity, listpdids); _result.Status = (int)CommonStatus.Success; _result.Obj = ordercode; return(JsonJC.ObjectToJson(_result)); } else { _result.Status = (int)CommonStatus.ProductLess; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); } } else { _result.Status = (int)CommonStatus.Success; _result.Obj = ordercode; return(JsonJC.ObjectToJson(_result)); } } } else { _result.Status = (int)CommonStatus.ProductLess; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); } } _result.Status = (int)CommonStatus.Fail; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); }