Пример #1
0
        public bool AddContactWay(ContactWayEntity contactWayEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("@JournalID");
            sqlCommandText.Append(", @ChannelID");
            sqlCommandText.Append(", @Company");
            sqlCommandText.Append(", @LinkMan");
            sqlCommandText.Append(", @Address");
            sqlCommandText.Append(", @ZipCode");
            sqlCommandText.Append(", @Tel");
            sqlCommandText.Append(", @Fax");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.ContactWay ({0}) VALUES ({1})",sqlCommandText.ToString().Replace("@", ""),sqlCommandText.ToString()));

            db.AddInParameter(cmd,"@JournalID",DbType.Int64,contactWayEntity.JournalID);
            db.AddInParameter(cmd,"@ChannelID", DbType.Int64, contactWayEntity.ChannelID);
            db.AddInParameter(cmd,"@Company", DbType.AnsiString, contactWayEntity.Company);
            db.AddInParameter(cmd,"@LinkMan",DbType.AnsiString,contactWayEntity.LinkMan);
            db.AddInParameter(cmd,"@Address",DbType.AnsiString,contactWayEntity.Address);
            db.AddInParameter(cmd,"@ZipCode",DbType.AnsiString,contactWayEntity.ZipCode);
            db.AddInParameter(cmd,"@Tel",DbType.AnsiString,contactWayEntity.Tel);
            db.AddInParameter(cmd,"@Fax",DbType.AnsiString,contactWayEntity.Fax);
            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch(SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Пример #2
0
 public ActionResult Save(ContactWayEntity model)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     model.JournalID = CurAuthor.JournalID;
     if (!string.IsNullOrWhiteSpace(model.Address))
         model.Address = Server.UrlDecode(model.Address);
     ExecResult result = service.SaveContactWay(model);
     return Json(new { result = result.result, msg = result.msg });
 }
Пример #3
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="contactWay">ContactWayEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteContactWay(ContactWayEntity contactWay)
 {
     return ContactWayDataAccess.Instance.DeleteContactWay(contactWay);
 }
Пример #4
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="contactWay">ContactWayEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddContactWay(ContactWayEntity contactWay)
 {
     return ContactWayDataAccess.Instance.AddContactWay(contactWay);
 }
Пример #5
0
 private ContactWayEntity GetModel(Int64 ContactID)
 {
     ContactWayEntity model = null;
     if (ContactID > 0)
     {
         ContactWayQuery query = new ContactWayQuery();
         query.JournalID = CurAuthor.JournalID;
         query.ContactID = ContactID;
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         model = service.GetContactWayModel(query);
     }
     if (model == null)
         model = new ContactWayEntity();
     return model;
 }
 public ExecResult Save(ContactWayEntity model)
 {
     IContactWayService service = ServiceContainer.Instance.Container.Resolve<IContactWayService>();
     return service.Save(model);
 }
Пример #7
0
 public List<ContactWayEntity> MakeContactWayList(IDataReader dr)
 {
     List<ContactWayEntity> list=new List<ContactWayEntity>();
     while(dr.Read())
     {
      ContactWayEntity contactWayEntity=new ContactWayEntity();
     contactWayEntity.ContactID = (Int64)dr["ContactID"];
     contactWayEntity.JournalID = (Int64)dr["JournalID"];
     contactWayEntity.ChannelID = (Int64)dr["ChannelID"];
     contactWayEntity.Company = (String)dr["Company"];
     contactWayEntity.LinkMan = (String)dr["LinkMan"];
     contactWayEntity.Address = (String)dr["Address"];
     contactWayEntity.ZipCode = (String)dr["ZipCode"];
     contactWayEntity.Tel = (String)dr["Tel"];
     contactWayEntity.Fax = (String)dr["Fax"];
     contactWayEntity.AddDate = (DateTime)dr["AddDate"];
        list.Add(contactWayEntity);
     }
     dr.Close();
     return list;
 }
Пример #8
0
        public bool UpdateContactWay(ContactWayEntity contactWayEntity)
        {
            bool flag = false;
            StringBuilder whereCommandText = new StringBuilder();
            whereCommandText.Append("  ContactID=@ContactID");
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("Company=@Company");
            sqlCommandText.Append(", LinkMan=@LinkMan");
            sqlCommandText.Append(", Address=@Address");
            sqlCommandText.Append(", ZipCode=@ZipCode");
            sqlCommandText.Append(", Tel=@Tel");
            sqlCommandText.Append(", Fax=@Fax");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.ContactWay SET {0} WHERE  {1}",sqlCommandText.ToString(),whereCommandText.ToString()));

            db.AddInParameter(cmd,"@ContactID",DbType.Int64,contactWayEntity.ContactID);
            db.AddInParameter(cmd,"@Company", DbType.AnsiString, contactWayEntity.Company);
            db.AddInParameter(cmd,"@LinkMan",DbType.AnsiString,contactWayEntity.LinkMan);
            db.AddInParameter(cmd,"@Address",DbType.AnsiString,contactWayEntity.Address);
            db.AddInParameter(cmd,"@ZipCode",DbType.AnsiString,contactWayEntity.ZipCode);
            db.AddInParameter(cmd,"@Tel",DbType.AnsiString,contactWayEntity.Tel);
            db.AddInParameter(cmd,"@Fax",DbType.AnsiString,contactWayEntity.Fax);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch(SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Пример #9
0
        public bool DeleteContactWay(ContactWayEntity contactWayEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("DELETE FROM dbo.ContactWay");
            sqlCommandText.Append(" WHERE  ContactID=@ContactID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd,"@ContactID",DbType.Int64,contactWayEntity.ContactID);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch(SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Пример #10
0
 public ContactWayEntity MakeContactWay(DataRow dr)
 {
     ContactWayEntity contactWayEntity=null;
     if(dr!=null)
     {
          contactWayEntity=new ContactWayEntity();
          contactWayEntity.ContactID = (Int64)dr["ContactID"];
          contactWayEntity.JournalID = (Int64)dr["JournalID"];
          contactWayEntity.ChannelID = (Int64)dr["ChannelID"];
          contactWayEntity.Company = (String)dr["Company"];
          contactWayEntity.LinkMan = (String)dr["LinkMan"];
          contactWayEntity.Address = (String)dr["Address"];
          contactWayEntity.ZipCode = (String)dr["ZipCode"];
          contactWayEntity.Tel = (String)dr["Tel"];
          contactWayEntity.Fax = (String)dr["Fax"];
          contactWayEntity.AddDate = (DateTime)dr["AddDate"];
     }
     return contactWayEntity;
 }
 /// <summary>
 /// 保存联系人数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ExecResult SaveContactWay(ContactWayEntity model)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, ContactWayEntity>(GetAPIUrl(APIConstant.ContactWay_SAVE), model);
     return result;
 }
Пример #12
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="contactWay">ContactWayEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteContactWay(ContactWayEntity contactWay)
 {
     return ContactWayBusProvider.DeleteContactWay(contactWay);
 }
Пример #13
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="contactWay">ContactWayEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddContactWay(ContactWayEntity contactWay)
 {
     return ContactWayBusProvider.AddContactWay(contactWay);
 }
Пример #14
0
 /// <summary>
 /// 更新存储媒介中的实体数据
 /// </summary>
 /// <param name="contactWay">ContactWayEntity实体对象</param>
 /// <returns>true:更新成功 false:更新失败</returns>
 public bool UpdateContactWay(ContactWayEntity contactWay)
 {
     return ContactWayBusProvider.UpdateContactWay(contactWay);
 }
Пример #15
0
 /// <summary>
 /// 保存联系人
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ExecResult Save(ContactWayEntity model)
 {
     ExecResult execResult = new ExecResult();
     bool result = false;
     model.Company = model.Company.TextFilter();
     model.LinkMan = model.LinkMan.TextFilter();
     model.Tel = model.Tel.TextFilter();
     model.Fax = model.Fax.TextFilter();
     model.ZipCode = model.ZipCode.TextFilter();
     model.Address = model.Address.TextFilter();
     if (model.ContactID == 0)
     {
         result = AddContactWay(model);
         if (result)
         {
             execResult.result = EnumJsonResult.success.ToString();
             execResult.msg = "新增联系人信息成功!";
         }
         else
         {
             execResult.result = EnumJsonResult.failure.ToString();
             execResult.msg = "新增联系人信息失败!";
         }
     }
     else
     {
         result = UpdateContactWay(model);
         if (result)
         {
             execResult.result = EnumJsonResult.success.ToString();
             execResult.msg = "修改联系人信息成功!";
         }
         else
         {
             execResult.result = EnumJsonResult.failure.ToString();
             execResult.msg = "修改联系人信息失败!";
         }
     }
     return execResult;
 }