public List <InformationModel> GetInformation(string condition, Guid adminId) { // InformationModel List 最终提交到页面的数据集 // InformationModel 继承至 Information // 目的是为了包含FollowModel List List <InformationModel> InformationModelList = new List <InformationModel>(); List <Information> InformationList = new List <Information>(); if (string.IsNullOrEmpty(condition)) { // 如果condition没有值 // 首先获取前50条数据记录到 InformationList InformationList = _informationBLL.GetInformationByAnythingswithGroupLeader(50, adminId).ToList(); } else { // 如果condition有值 就按条件查询 InformationList = _informationBLL.GetInformationByAnythingswithGroupLeader(condition, adminId).ToList(); } List <Information> InfoList = new List <Information>(); InfoList = InformationList.ToList(); // 然后循环InformationList // 构造 InformationModelList foreach (Information item in InformationList) { InformationModel info = new InformationModel(item); List <FollowModel> followModelList = new List <FollowModel>(); List <FollowRecord> followRecordList = new List <FollowRecord>(); followRecordList = _followRecordBLL.GetFollowRecordByInformationId(info.Id).ToList(); foreach (FollowRecord fr in followRecordList) { FollowModel fm = new FollowModel(); fm.FollowName = _followBLL.GetFollow(fr.FollowId).FollowItem; fm.FollowValue = fr.FollowValue; followModelList.Add(fm); } info.FollowList = followModelList.AsEnumerable(); // 获取收集员的账号 var m = _memberBLL.GetMemberById(info.MemberId); if (m != null) { info.MemberAccount = m.Account; InformationModelList.Add(info); } } return(InformationModelList); }
public static void WriteComputer(string userLoginName) { try { InformationModel info = new InformationModel(); var temp = info.MachineInfo.BiosId; var temp1 = info.OperatingSystemInfo.NetBiosName; if (_useAzure) { //Build up the computer entry AzureComputerEntry entry = new AzureComputerEntry(userLoginName, info.OperatingSystemInfo.NetBiosName); entry.ComputerInfo = JsonConvert.SerializeObject(info); // Create the TableOperation object that inserts/replaces the computer entity. TableOperation insertOperation = TableOperation.InsertOrReplace(entry); // Execute the insert/replace operation. _azureTableComputer.Execute(insertOperation); } else { //Build up the computer entry //The template of the entry in the log file string entryTemplate = "{0} - ({1:yyyy-MM-dd HH:mm:ss}) - {2}"; //Append the log lines to the file File.AppendAllText(GetPathAndFileName(), string.Format(entryTemplate, userLoginName, DateTime.Now, JsonConvert.SerializeObject(info))); } } catch (Exception) { //supress any log entry writing exception } }
public async Task <ActionResult> Create( [Bind( "EmailAddress", "ZipCode", "City", "Country", "Street", "StreetNumber", "PhoneNumber", "WebSite", "Instagram", "Facebook", "LinkedIn", "IdentificationId")] InformationModel task) { try { var content = JsonConvert.SerializeObject(task); var httpResponse = await Client.PostAsync(BaseUrl, new StringContent(content, Encoding.Default, "application/json")); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public Information(ModelHelpers modelHelpers) { this.modelHelpers = modelHelpers; InitializeComponent(); DataContext = new InformationModel(modelHelpers.Gallifrey); modelHelpers.Gallifrey.TrackEvent(TrackingType.InformationShown); }
public IActionResult DeleteInfo(InformationModel model) { var informationManager = DomainHub.GetDomain <IInformationManager>(); informationManager.Delete(model.Key, model.Language); return(Redirect($"/Admin/Info?_={DateTime.Now.Ticks}")); }
public IList <InformationModel> GetModelsByAddress(string address) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM dbo.Information WHERE Address LIKE '%"); strSql.Append(address + "%' ORDER BY AddTime DESC"); IList <InformationModel> lstInformation = new List <InformationModel>(); using (SqlDataReader sdr = DBHelper.ExecuteSqlReader(strSql.ToString())) { while (sdr.Read()) { InformationModel model = new InformationModel(); model.id = sdr["Id"].ToString(); model.userName = sdr["UserName"].ToString(); model.title = sdr["Title"].ToString(); model.content = sdr["Content"].ToString(); model.wage = sdr["Wage"].ToString(); model.viewCount = sdr["ViewCount"].ToString(); model.address = sdr["Address"].ToString(); model.addTime = sdr["AddTime"].ToString(); model.isAcceptOrder = sdr["IsAcceptOrder"].ToString(); model.getOrderUserName = sdr["GetOrderUserName"].ToString(); lstInformation.Add(model); } } return(lstInformation); }
public override InformationModel GetByIdInformation(int id) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("tbh_Articles_GetArticleByID", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ArticleID", SqlDbType.Int).Value = articleID; cn.Open(); IDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { InformationModel model = new InformationModel { (int)reader["id"], reader["name"].ToString, reader["Description"].ToString, (int)reader["STATUS"] }; return(model); } else { return(null); } } }
void DetectSessionState(object obj) { // Check whether the current session is locked. bool isCurrentLocked = session.IsLocked(); var state = isCurrentLocked ? SessionSwitchReason.SessionLock : SessionSwitchReason.SessionUnlock; InformationModel info = new InformationModel(); string line = string.Format("Current State: {0} Time: {1} " + "User Name: {2} Domain: {3} ", state, DateTime.Now, info.UserInfo.LoginName, info.UserInfo.DomainName ); StreamWriter file = new StreamWriter(Path.GetTempPath() + "\\Debugfile.log", true); file.WriteLine(line); file.Close(); }
public string Post([FromBody] string value) { JObject reponse; InformationModel model = JsonConvert.DeserializeObject <InformationModel>(value); if (CheckModel(model).Status == API.Status.ERROR.ToString()) { reponse = JObject.FromObject(CheckModel(model)); return(reponse.ToString()); } DatabaseConnection databaseConnection = DatabaseConnection.GetInstance; PropertyInfo[] propertyInfos = model.GetType().GetProperties(); string[] columnname = new string[propertyInfos.Length]; int index = 0; foreach (PropertyInfo propertyInfo in propertyInfos) { columnname[index] = propertyInfo.Name; index++; } List <object> data = new List <object>(); data.Add(model); JObject databaseReturn = databaseConnection.InsertData(TABLENAME, columnname, data); API.Status status = (bool)databaseReturn["isError"] ? API.Status.ERROR : API.Status.DONE; string message = (bool)databaseReturn["isError"] ? databaseReturn["message"].ToString() : "success"; ResponseModel responsemodel = API.ParseReturn(status, message, (JObject)databaseReturn["data"]); reponse = JObject.FromObject(responsemodel); return(reponse.ToString()); }
public async static Task <InformationModel> GetInformationByIdAsync(string id) { try { HttpService http = new HttpService(); string response = await http.SendGetRequest(InterfaceUrl.GetInformationById(id)); if (response != string.Empty) { JObject jsonObject = JObject.Parse(response); InformationModel model = new InformationModel(); model.id = jsonObject["id"].ToString(); model.userName = jsonObject["userName"].ToString(); model.wage = jsonObject["wage"].ToString(); model.title = jsonObject["title"].ToString(); model.viewCount = jsonObject["viewCount"].ToString(); model.content = jsonObject["content"].ToString(); model.isAcceptOrder = jsonObject["isAcceptOrder"].ToString(); model.getOrderUserName = jsonObject["getOrderUserName"].ToString(); model.addTime = jsonObject["addTime"].ToString(); model.address = jsonObject["address"].ToString(); return(model); } } catch { } return(null); }
private async Task PublishInformation(string title, string content) { string strFileName = FileHelper.GenerateFileNameByUserName(userName); BlobHelper blob = new BlobHelper(); await blob.CreateContainer(encriptUserName); for (int i = 0; i < App.lstPicture.Count; ++i) { string fileUrl = strFileName + i; await blob.UploadFromStorageFile(App.lstPicture[i], encriptUserName, fileUrl); lstFileUrl.Add(FileHelper.GenerateFileUrl(fileUrl, encriptUserName)); } InformationModel model = new InformationModel(); model.title = title; if (txtWage.Text.Length <= 0) { model.wage = Constants.NegotiablePrice; } model.content = FileHelper.GenerateXMLDocument(content, lstFileUrl); model.addTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); model.userName = userName; model.viewCount = "0"; model.address = address; model.isAcceptOrder = Constants.OrderStatus.NotAccept; string jsonContent = JsonHelper.ObjectToJson(model); HttpService http = new HttpService(); await http.SendPostRequest(InterfaceUrl.CreateInformationUrl, jsonContent); }
public int CreateInformation(InformationModel model) { string strSql = "INSERT INTO dbo.Information VALUES(@id,@userName,@title,@content,@wage,@viewCount,@addTime,@address,@isAcceptOrder,@getOrderUserName)"; SqlParameter[] parameters = { new SqlParameter("@id", System.Data.SqlDbType.VarChar, 50), new SqlParameter("@userName", System.Data.SqlDbType.NVarChar, 50), new SqlParameter("@title", System.Data.SqlDbType.NVarChar, 200), new SqlParameter("@content", System.Data.SqlDbType.NText), new SqlParameter("@wage", System.Data.SqlDbType.VarBinary, 50), new SqlParameter("@viewCount", System.Data.SqlDbType.VarChar, 50), new SqlParameter("@addTime", System.Data.SqlDbType.VarChar, 50), new SqlParameter("@address", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@isAcceptOrder", System.Data.SqlDbType.VarChar, 3), new SqlParameter("@getOrderUserName", System.Data.SqlDbType.NVarChar, 50) }; parameters[0].Value = Guid.NewGuid().ToString("N"); parameters[1].Value = model.userName; parameters[2].Value = model.title; parameters[3].Value = model.content; parameters[4].Value = model.wage; parameters[5].Value = model.viewCount; parameters[6].Value = model.addTime; parameters[7].Value = model.address; parameters[8].Value = model.isAcceptOrder; parameters[9].Value = model.getOrderUserName; return(DBHelper.ExecuteNonQuery(strSql, parameters)); }
public override FAQModel GetByIdFAQ(int id) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("proc_GET_FAQ_BY_ID", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.Int).Value = id; cn.Open(); IDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { InformationModel model = new InformationModel { (int)reader["id"], (int)reader["IdUser"], reader["Description"].ToString, reader["Answer"].ToString, (int)reader["STATUS"] }; } else { return(null); } } }
public IList <InformationModel> GetModelsByUserName(string userName) { string strSql = "SELECT * FROM dbo.Information WHERE UserName=@userName"; SqlParameter[] parameters = { new SqlParameter("@userName", System.Data.SqlDbType.NVarChar, 50) }; parameters[0].Value = userName; IList <InformationModel> lstInformation = new List <InformationModel>(); using (SqlDataReader sdr = DBHelper.ExecuteSqlReader(strSql, parameters)) { while (sdr.Read()) { InformationModel model = new InformationModel(); model.id = sdr["Id"].ToString(); model.userName = sdr["UserName"].ToString(); model.title = sdr["Title"].ToString(); model.content = sdr["Content"].ToString(); model.wage = sdr["Wage"].ToString(); model.viewCount = sdr["ViewCount"].ToString(); model.address = sdr["Address"].ToString(); model.addTime = sdr["AddTime"].ToString(); model.isAcceptOrder = sdr["IsAcceptOrder"].ToString(); model.getOrderUserName = sdr["GetOrderUserName"].ToString(); lstInformation.Add(model); } } return(lstInformation); }
private async void GetInformationRequest() { try { InformationModel model = await App.Client.GetInformations(); if (model.status == "true") { info = new Information() { advertisement = model.filebase + model.feeds[0].advertisement, ad_url = model.feeds[0].ad_url, applicationGenericShare = model.feeds[0].applicationGenericShare, credits = model.filebase + model.feeds[0].credits, id = model.feeds[0].id, laternaMainShare = model.feeds[0].laternaMainShare, priority = model.feeds[0].priority, toursMainShare = model.feeds[0].toursMainShare }; } } catch (Exception) { } }
public IActionResult UpdateInfo(InformationModel model) { var informationManager = DomainHub.GetDomain <IInformationManager>(); informationManager.Update(model.Key, model.Language, model.Title, model.Author, model.Content, model.FacebookComment); return(Redirect($"/Admin/Info?_={DateTime.Now.Ticks}")); }
public InformationModel GetNameAndAmount(string name, decimal amount) { // Dependecy Injection using UnityContainer try { //Intialization of container UnityContainer container = new UnityContainer(); //Registring Interface and Business Class with Container container.RegisterType <IRepositoryDecimalToText, RepositoryDecimalToText>(); //Resolving the classes and calling them using Loose Coupling Container _objIRepository = container.Resolve <Container>(); return(_objIRepository.displayText(name, amount)); } catch { // In case of error Re-initializaing the object with Empty values InformationModel exception = new InformationModel(); exception.MyName = name; exception.MyCurrentcyNumberText = "Number is out of range, Please re-enter"; exception.MyOriginalNumber = string.Empty; return(exception); } }
//Changes forgotten password public async Task ForgotPasswordAsync(UserModel user, ForgotPasswordModel forgotPassword) { if (user.Status == (int)UserStatus.NotValid) { CustomException errors = new CustomException((int)HttpStatusCode.BadRequest); errors.AddError("None Verified Email", "Your email is not verified"); errors.Throw(); } if (user.Status == (int)UserStatus.Banned) { CustomException errors = new CustomException((int)HttpStatusCode.BadRequest); errors.AddError("User Is Banned", "User is banned from application"); errors.Throw(); } InformationModel ForgotPasswordVerificationCodeInfo = await _informationRepository.GetInformationByInformationNameAsync("ForgotPasswordVerificationCode"); InformationModel ForgotPasswordVerificationCodeGenerateDateInfo = await _informationRepository.GetInformationByInformationNameAsync("ForgotPasswordVerificationCodeGenerateDate"); UserInformationModel ForgotPasswordVerificationCode = await _userInformationRepository.GetUserInformationByIdAsync(user.Id, ForgotPasswordVerificationCodeInfo.Id); UserInformationModel ForgotPasswordVerificationCodeGenerateDate = await _userInformationRepository.GetUserInformationByIdAsync(user.Id, ForgotPasswordVerificationCodeGenerateDateInfo.Id); //Bad request if (ForgotPasswordVerificationCode == null) { CustomException errors = new CustomException((int)HttpStatusCode.BadRequest); errors.AddError("Email Verification Code Not Exist", "There is no verification code which is generated for you"); errors.Throw(); } //Generated code timed out if (String.Format("{0:u}", DateTime.UtcNow.AddMinutes(-15)).CompareTo(ForgotPasswordVerificationCodeGenerateDate.Value) > 0) { _userInformationRepository.Delete(ForgotPasswordVerificationCode); _userInformationRepository.Delete(ForgotPasswordVerificationCodeGenerateDate); CustomException errors = new CustomException((int)HttpStatusCode.BadRequest); errors.AddError("Verification Code Timeout", "Verification code timed out, please request another verification code"); errors.Throw(); } //Verification code accepted if (ForgotPasswordVerificationCode.Value == forgotPassword.VerificationCode) { user.Password = forgotPassword.NewPassword; _userRepository.Update(user); _userInformationRepository.Delete(ForgotPasswordVerificationCode); _userInformationRepository.Delete(ForgotPasswordVerificationCodeGenerateDate); } //Verification code does not matched else { CustomException errors = new CustomException((int)HttpStatusCode.BadRequest); errors.AddError("Verification Code", "Verification code does not matched"); errors.Throw(); } }
public InformationModel GetModelById(string id) { string strSql = "SELECT * FROM dbo.Information WHERE Id=@id"; SqlParameter[] parameters = { new SqlParameter("@id", System.Data.SqlDbType.VarChar, 50) }; parameters[0].Value = id; InformationModel model = new InformationModel(); using (SqlDataReader sdr = DBHelper.ExecuteSqlReader(strSql, parameters)) { if (sdr.Read()) { model.id = sdr["Id"].ToString(); model.userName = sdr["UserName"].ToString(); model.title = sdr["Title"].ToString(); model.content = sdr["Content"].ToString(); model.wage = sdr["Wage"].ToString(); model.viewCount = sdr["ViewCount"].ToString(); model.address = sdr["Address"].ToString(); model.addTime = sdr["AddTime"].ToString(); model.isAcceptOrder = sdr["IsAcceptOrder"].ToString(); model.getOrderUserName = sdr["GetOrderUserName"].ToString(); } } return(model); }
private InformationModel ErrorMessages(int i, string name, string amount) { InformationModel information = new InformationModel(); information.MyName = name; information.MyOriginalNumber = amount; switch (i) { case 1: information.MyCurrentcyNumberText = "Please Enter the Name"; break; case 2: information.MyCurrentcyNumberText = "API in not working fine"; break; case 3: information.MyCurrentcyNumberText = "Please Enter the Amount"; break; case 4: information.MyCurrentcyNumberText = "Sorry! there is some error, Please Try again"; break; case 5: information.MyCurrentcyNumberText = "Format of Amount is incorrect"; break; default: return(information); } return(information); }
public ActionResult GraduateInformation(InformationModel model) { if (!ModelState.IsValid) { return(View(model)); } try { _mediator.Notify(new SaveGradInfo { Name = model.Name, Street = model.Street, City = model.City, StudentEmail = model.StudentEmail, ParentEmail = model.ParentEmail, FineArts = model.FineArts, AcademicClasses = model.AcademicClasses, WillParticipateInGraduation = model.WillParticipateInGraduation.Value, TakenKeysWorldView = model.TakenKeysWorldView, TakenApprovedWorldView = model.TakenApprovedWorldView, WillSecureAnnouncements = model.WillSecureAnnouncements, NeedCapAndGown = model.NeedCapAndGown, Height = model.Height }); return(RedirectToAction <CheckListController>(c => c.GraduateInformation()) .WithSuccess("Your Graduation Information has been saved.")); } catch (Exception) { return(RedirectToAction <CheckListController>(c => c.GraduateInformation()) .WithError("There was a problem. Your Graduation Information has been saved.")); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(InformationModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Information("); strSql.Append("Email,QQ,Tel,InformationImgId,ContactName,InformationClassId,InformationTypeId,InformationTitle,InformationContent,InformationMemo,CreateTime,CreateUserId,Property"); strSql.Append(") values ("); strSql.Append("@Email,@QQ,@Tel,@InformationImgId,@ContactName,@InformationClassId,@InformationTypeId,@InformationTitle,@InformationContent,@InformationMemo,@CreateTime,@CreateUserId,@Property"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Email", SqlDbType.VarChar, 30), new SqlParameter("@QQ", SqlDbType.VarChar, 20), new SqlParameter("@Tel", SqlDbType.VarChar, 20), new SqlParameter("@InformationImgId", SqlDbType.VarChar, 50), new SqlParameter("@ContactName", SqlDbType.VarChar, 20), new SqlParameter("@InformationClassId", SqlDbType.Decimal, 9), new SqlParameter("@InformationTypeId", SqlDbType.Decimal, 9), new SqlParameter("@InformationTitle", SqlDbType.NVarChar, 100), new SqlParameter("@InformationContent", SqlDbType.NVarChar, 2500), new SqlParameter("@InformationMemo", SqlDbType.NVarChar, 100), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@CreateUserId", SqlDbType.VarChar, 50), new SqlParameter("@Property", SqlDbType.Xml, -1) }; parameters[0].Value = model.Email; parameters[1].Value = model.QQ; parameters[2].Value = model.Tel; parameters[3].Value = model.InformationImgId; parameters[4].Value = model.ContactName; parameters[5].Value = model.InformationClassId; parameters[6].Value = model.InformationTypeId; parameters[7].Value = model.InformationTitle; parameters[8].Value = model.InformationContent; parameters[9].Value = model.InformationMemo; parameters[10].Value = model.CreateTime; parameters[11].Value = model.CreateUserId; parameters[12].Value = model.Property; bool result = false; try { model.InformationId = decimal.Parse(helper.ExecuteNonQueryBackId(strSql.ToString(), "InformationId", parameters)); result = true; } catch (Exception ex) { this.helper.Close(); throw ex; } finally { } return(result); }
/// <summary> /// 修改information的页面 /// </summary> /// <param name="informationId"></param> /// <returns></returns> public ActionResult Update(string informationId) { InformationModel model = GetInformationModel(informationId); List <Follow> frList = _followBLL.GetAllFollow().ToList(); ViewData["FollowItems"] = frList; ViewBag.Count = frList.Count(); return(View(model)); }
public void Excecute() { var exec = new Logic(); InformationModel values = exec.ReadFile(); var cleaning = exec.Cleaning(values); exec.WriteFile(cleaning); //throw new NotImplementedException(); }
public ActionResult GraduateInformation() { InformationModel model = _dbContext.GraduateInformation .Where(i => i.StudentId.Equals(_currentUser.User.Id)).Project().To <InformationModel>() .SingleOrDefault() ?? new InformationModel(); return(View(model)); }
public IActionResult Info(InformationModel model, string operation) { var informationManager = DomainHub.GetDomain <IInformationManager>(); var information = informationManager[model.Key, model.Language]; model = new InformationModel(information); ViewBag.operation = operation; return(View(model)); }
public async static Task UpdateInfo(string infoId, InformationModel model) { try { HttpService http = new HttpService(); string jsonContent = JsonHelper.ObjectToJson(model); await http.SendPutRequest(InterfaceUrl.UpdateInformation(infoId), jsonContent); } catch { } }
public async Task <SomeBigModel> GetNewModel(InformationModel newInfo) { var log = await _context.Logs.OrderByDescending(_ => _.Time) .FirstOrDefaultAsync(_ => _.InformationId == newInfo.Id); return(new SomeBigModel { Information = newInfo, Log = _mapper.Map <LogModel>(log) }); }
public ResponsResult SaveHelp(InformationModel model) { ResponsResult result = new ResponsResult(); if ((int)model.Type < 1) { return(result.SetError("请选择类型")); } if (model.Type != InformationType.UseGuide) { var info = this.First <Informations>(t => t.Type == (int)model.Type); if (info == null) { info = new Informations { Id = this.GenNewGuid(), CreateTime = DateTime.Now, Type = (int)model.Type, Title = model.Type.GetString() }; this.Add(info); } else { info.UpdateTime = DateTime.Now; this.Update(info); } info.Description = model.Description; model.Id = info.Id; this.Save(); } else { if (string.IsNullOrEmpty(model.Title)) { return(result.SetError("请输入标题")); } var info = this.Single <Informations>(t => t.Id == model.Id); if (info == null) { info = new Informations { Id = this.GenNewGuid(), CreateTime = DateTime.Now, Type = (int)model.Type }; this.Add(info); } else { info.UpdateTime = DateTime.Now; this.Update(info); } info.Title = model.Title.Trim(); info.Description = model.Description; model.Id = info.Id; this.Save(); } result.Data = model.Id; return(result); }
public IActionResult AddInfo(InformationModel model) { if (model.Key != null && model.Language != null) { var informationManager = DomainHub.GetDomain <IInformationManager>(); informationManager.Add(model.Key, model.Title, model.Author, model.Content); return(Redirect($"/Admin/Info?_={DateTime.Now.Ticks}")); } return(View(model)); }
public override bool InsertInformation(InformationModel model) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("proc_ADD_INFORMATION", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@NAME", SqlDbType.NVarChar).Value = model.Name; cmd.Parameters.Add("@STATUS", SqlDbType.Int).Value = model.Status; cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = model.Description; cn.Open(); int re = ExecuteNonQuery(cmd); return (re == 1); } }
public override InformationModel GetByIdInformation(int id) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("tbh_Articles_GetArticleByID", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ArticleID", SqlDbType.Int).Value = articleID; cn.Open(); IDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { InformationModel model = new InformationModel { (int)reader["id"], reader["name"].ToString, reader["Description"].ToString, (int)reader["STATUS"] }; return model; } else return null; } }
public abstract bool UpdateInformation(InformationModel model);
public abstract int InsertInformation(InformationModel model);