public int Fiction_UpdateById(Fiction obj) { using (SiteFictionAccess access = new SiteFictionAccess()) { return(access.Fiction_UpdateById(obj)); } }
static void Main(string[] args) { Book b; Console.WriteLine("Enter the Code for Book"); Console.WriteLine("1-Fiction"); Console.WriteLine("2-Non Fiction"); Console.WriteLine("3-Academic"); Console.WriteLine("4-Others"); int Option = Convert.ToInt32(Console.ReadLine()); if (Option == 1) { b = new Fiction(); b.Offer(); } else if (Option == 2) { b = new NonFiction(); b.Offer(); } else if (Option == 3) { b = new Academic(); b.Offer(); } else if (Option == 4) { b = new Book(); b.Offer(); } }
public int Fiction_Insert(Fiction obj) { DbCommand dbCmd = db.GetStoredProcCommand("Proc_Fiction_Insert"); db.AddOutParameter(dbCmd, "@Id", DbType.Int32, 4); db.AddInParameter(dbCmd, "@Title", DbType.String, obj.Title); db.AddInParameter(dbCmd, "@Author", DbType.String, obj.Author); db.AddInParameter(dbCmd, "@Intro", DbType.String, obj.Intro); db.AddInParameter(dbCmd, "@CoverImage", DbType.String, obj.CoverImage); db.AddInParameter(dbCmd, "@C_C_ID", DbType.Int32, obj.C_C_ID); db.AddInParameter(dbCmd, "@LastUpdateChapter", DbType.String, obj.LastUpdateChapter); db.AddInParameter(dbCmd, "@LastUpdateTime", DbType.String, obj.LastUpdateTime); db.AddInParameter(dbCmd, "@CompleteState", DbType.Int32, obj.CompleteState); db.AddInParameter(dbCmd, "@LastChapterId", DbType.String, obj.LastChapterId); try { int returnValue = db.ExecuteNonQuery(dbCmd); int Id = (int)dbCmd.Parameters["@Id"].Value; return(returnValue); } catch (Exception e) { throw new Exception(e.Message); } }
public Fiction Add(Fiction fiction) { fiction.UploadDate = DateTime.Now; appDbContext.Fictions.Add(fiction); appDbContext.SaveChanges(); return(fiction); }
public async Task <IActionResult> Create(Fiction fiction, string tagName) { var author = await _userManager.GetUserAsync(User); fiction.LastModifiedDate = DateTime.Now; fiction.UploadDate = DateTime.Now; fiction.Author = author; var tag = new Tag() { Name = tagName, FicId = fiction.Id, }; _context.Tags.Add(tag); fiction.Tags.Add(tag); _fictionRepository.Add(fiction); //await _context.SaveChangesAsync(); author.Fictions.Add(fiction); return(RedirectToAction("Fiction", new { Id = fiction.Id })); }
public ActionResult SiteContentCheck() { string c_id = Request["c_id"] ?? string.Empty; int status = Request["status"].ToInt32(1); int successCount = 0; int failCount = 0; int result = 0; Fiction info = null; string[] c_idArr = c_id.Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < c_idArr.Length; i++) { info = YuYangServiceClass.Fiction_SelectById(c_idArr[i].ToInt32()); //info.c_status = status; result = YuYangServiceClass.Fiction_UpdateById(info); if (result > 0) { successCount++; } else { failCount++; } } if (c_idArr.Length == 1) { return(Json(new { success = true, errors = new { text = "审核成功" } })); } else { return(Json(new { success = true, errors = new { text = string.Format("审核成功{0}条,失败{1}条", successCount, failCount) } })); } }
public List <Fiction> Fiction_SelectPage(string cloumns, int pageIndex, int pageSize, string orderBy, string where, out int rowCount) { DbCommand dbCmd = db.GetStoredProcCommand("Proc_Fiction_SelectPage"); db.AddOutParameter(dbCmd, "@rowCount", DbType.Int32, 4); db.AddInParameter(dbCmd, "@cloumns", DbType.String, cloumns); db.AddInParameter(dbCmd, "@pageIndex", DbType.Int32, pageIndex); db.AddInParameter(dbCmd, "@pageSize", DbType.Int32, pageSize); db.AddInParameter(dbCmd, "@orderBy", DbType.String, orderBy); db.AddInParameter(dbCmd, "@where", DbType.String, where); List <Fiction> list = new List <Fiction>(); try { using (IDataReader reader = db.ExecuteReader(dbCmd)) { while (reader.Read()) { Fiction obj = this.Obj2Model <Fiction>(reader); list.Add(obj); } reader.NextResult(); } rowCount = (int)dbCmd.Parameters["@rowCount"].Value; return(list); } catch (Exception e) { throw new Exception(e.Message); } }
public int Fiction_Insert(Fiction obj) { using (SiteFictionAccess access = new SiteFictionAccess()) { return(access.Fiction_Insert(obj)); } }
public ActionResult SiteContentEdit() { string c_title = Request["c_title"] ?? string.Empty; string c_keywords = Request["c_keywords"] ?? string.Empty; string c_subTitle = Request["c_subTitle"] ?? string.Empty; string c_content = Request["c_content"] ?? string.Empty; string c_intro = Request["c_intro"] ?? string.Empty; string fid = Request["fid"] ?? string.Empty; string c_id = Request["c_id"] ?? string.Empty;//分类Id Fiction info = null; if (string.IsNullOrEmpty(fid)) { info = new Fiction(); info.CoverImage = string.Empty; } else { info = YuYangServiceClass.Fiction_SelectById(fid.ToInt32()); } //info.c_status = (int)SiteEnum.SiteItemStatus.待审核; info.LastUpdateTime = DateTime.Now; info.Title = c_title; info.C_C_ID = c_id.ToInt32(); info.Author = c_subTitle; info.Intro = c_intro; info.LastUpdateChapter = string.Empty; //TODO:新增时 小说封面设置 if (string.IsNullOrEmpty(fid)) { int result = YuYangServiceClass.Fiction_Insert(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "新增成功" } })); } else { return(Json(new { success = false, errors = new { text = "新增失败" } })); } } else { int result = YuYangServiceClass.Fiction_UpdateById(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "修改成功" } })); } else { return(Json(new { success = false, errors = new { text = "修改失败" } })); } } }
public static int Fiction_UpdateById(Fiction obj) { IYuYangService channel = Entity.CreateChannel <IYuYangService>(SiteEnum.SiteService.YuYangService); var result = channel.Fiction_UpdateById(obj); (channel as IDisposable).Dispose(); return(result); }
public static Result OnFailure(this Result result, Fiction action) { if (result.IsFailure) { action(); } return(result); }
public static Result OnSuccess(this Result result, Fiction action) { if (result.IsSuccess) { action(); } return(result); }
protected Expression ExpressionVariableName() { List <string> path = Interleave <string> (Identifier, Exclude(Spaced(String(".")))); if (path == null || Fiction.IsReservedKeyword(path[0])) { return(null); } return(new VariableReference(path)); }
public override dynamic Create(GroupBox g) { Fiction f = new Fiction(base.Create(g)); GroupBox fictionGroupBox = ((Grid)g.Content).Children.OfType <GroupBox>().First(x => x.Name == "FictionGroup"); IEnumerable <TextBox> tbList = ((Grid)fictionGroupBox.Content).Children.OfType <TextBox>(); f.Type = tbList.First(x => x.Name == "InpFictType").Text; f.Age = tbList.First(x => x.Name == "InpFictAge").Text; f.Genre = "Fiction"; return(f); }
public static void AddIntoBook(string id, string title, string author, string available, string price, string label6, int val) { Book b = null; switch (val) { case 1: b = new Fiction(); b.Id = int.Parse(id); b.Title = title; b.AuthorName = author; b.Available = int.Parse(available); b.Price = int.Parse(price); (b as Fiction).Type = label6; bookList.Add(b); break; case 2: b = new Art(); b.Id = int.Parse(id); b.Title = title; b.AuthorName = author; b.Available = int.Parse(available); b.Price = int.Parse(price); (b as Art).Era = label6; bookList.Add(b); break; case 3: b = new Art(); b.Id = int.Parse(id); b.Title = title; b.AuthorName = author; b.Available = int.Parse(available); b.Price = int.Parse(price); (b as Comics).Region = label6; bookList.Add(b); break; case 4: b = new Art(); b.Id = int.Parse(id); b.Title = title; b.AuthorName = author; b.Available = int.Parse(available); b.Price = int.Parse(price); (b as Cooking).Cuisine = label6; bookList.Add(b); break; } }
public ActionResult ContentEditView() { string c_id = Request["c_id"] ?? string.Empty; string fid = Request["fid"] ?? string.Empty; Fiction info = null; if (string.IsNullOrEmpty(fid)) { info = new Fiction(); } else { info = YuYangServiceClass.Fiction_SelectById(fid.ToInt32(0)); } ViewData["window"] = Request["window"] ?? string.Empty; ViewData["info"] = info; ViewBag.c_id = c_id; ViewBag.fid = fid; return(View()); }
public Fiction Fiction_SelectById(int Id) { DbCommand dbCmd = db.GetStoredProcCommand("Proc_Fiction_SelectById"); db.AddInParameter(dbCmd, "@Id", DbType.Int32, Id); Fiction obj = null; try { using (IDataReader reader = db.ExecuteReader(dbCmd)) { while (reader.Read()) { obj = this.Obj2Model <Fiction>(reader); } } return(obj); } catch (Exception e) { throw new Exception(e.Message); } }
public FantasticTales(Fiction f) : base(f) { }
private Process CreateProcessInfoToRunWithoutShellExecute(string fileName, string arguments, bool getStdOutput, bool getStdError, Fiction <string> logOutput, Fiction <string> logError) { var process = new Process { StartInfo = { WorkingDirectory = System.IO.Path.GetDirectoryName(fileName), Arguments = arguments, FileName = fileName, UseShellExecute = false, RedirectStandardOutput = getStdOutput, RedirectStandardError = getStdError, CreateNoWindow = true } }; process.ErrorDataReceived += (o, args) => { var data = args?.Data; if (!string.IsNullOrEmpty(data)) { logError?.Invoke($"External process error: {data}"); } }; process.OutputDataReceived += (o, args) => { var data = args?.Data; if (!string.IsNullOrEmpty(data)) { logOutput?.Invoke($"External process output: {args?.Data}"); } }; process.EnableRaisingEvents = true; return(process); }
public int LaunchProcessWithoutShellExecuteAndWaitExitCode(string fileName, string arguments, Fiction <string> logOutput, Fiction <string> logError, int timeoutMilliseconds) { var process = CreateProcessInfoToRunWithoutShellExecute(fileName, arguments, true, true, logOutput: logOutput, logError: logError); var started = process.Start(); if (!started) { throw new Exception("Couldn't start process"); } process.BeginOutputReadLine(); process.BeginErrorReadLine(); process.WaitForExit(timeoutMilliseconds); return(process.ExitCode); }
//NOTE! This method is very similar to one above public int LaunchProcessWithoutShellExecuteAndWaitExitCode(string fileName, string arguments, bool getStdOutput, bool getStdError, Fiction <string> logOutput, Fiction <string> logError) { var process = CreateProcessInfoToRunWithoutShellExecute(fileName, arguments, getStdOutput, getStdError, logOutput: logOutput, logError: logError); var started = process.Start(); if (!started) { throw new Exception("Couldn't start process"); } if (getStdOutput) { process.BeginOutputReadLine(); } if (getStdError) { process.BeginErrorReadLine(); } process.WaitForExit(); return(process.ExitCode); }
public ActionResult SiteContentRecommendEdit() { //内容ID string c_id = Request["c_id"] ?? string.Empty; //推荐区块ID string b_gid = Request["b_gid"] ?? string.Empty; //区块页面ID string p_gid = Request["p_gid"] ?? string.Empty; Fiction fInfo = null; Site_CMSItem item = null; int existCount = 0; int successCount = 0; int failCount = 0; int result = 0; Site_CMSBlock b_info = SiteServiceClass.Site_CMSBlock_SelectByb_gid(b_gid); string[] c_idArr = c_id.Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < c_idArr.Length; i++) { fInfo = YuYangServiceClass.Fiction_SelectById(c_idArr[i].ToInt32()); item = SiteServiceClass.Site_CMSItem_SelectByc_gidAndb_gid(c_idArr[i], b_gid); if (item != null) { existCount++; continue; } item = new Site_CMSItem(); item.i_b_gid = b_gid; item.i_intro = fInfo.Intro;// item.i_createTime = DateTime.Now; item.i_createUser = SiteHelp.CurrentUserName; item.i_c_gid = fInfo.Id.ToString();//此处存放小说的唯一Id item.i_c_type = string.Empty; item.i_gid = Guid.NewGuid().ToString().Substring(0, 8); item.i_p_gid = p_gid; item.i_status = (int)SiteEnum.SiteItemStatus.待审核; item.i_subTitle = fInfo.Author;//作者 item.i_title = fInfo.Title; item.i_c_img_src = string.Empty; //图片需要根据该区块设置的图片尺寸,缩放该图片,使用原图来进行缩放 if (!string.IsNullOrEmpty(b_info.b_img_size.Trim())) { if (!string.IsNullOrEmpty(fInfo.CoverImage)) { int index = fInfo.CoverImage.LastIndexOf('_'); string sourceSrc = fInfo.CoverImage.Substring(0, index) + ".jpg"; string error; byte[] imgData = SiteUntility.GetRemoteImage(sourceSrc, out error); if (imgData != null) { List <string> srcResult = UploadServiceClass.UploadImg( imgData, SiteEnum.SiteUploadConfigName.baseUpload.ToString(), new List <string>() { b_info.b_img_size }, ".jpg", "s" ); item.i_c_img_src = srcResult[1]; } } } result = SiteServiceClass.Site_CMSItem_Insert(item); if (result > 0) { successCount++; } else { failCount++; } } if (c_idArr.Length == 1) { return(Json(new { success = true, errors = new { text = "推荐成功" } })); } else { return(Json(new { success = true, errors = new { text = string.Format("推荐成功{0}条,失败{1}条,重复{2}条", successCount, failCount, existCount) } })); } }
public void Delete(Fiction fiction) { appDbContext.Fictions.Remove(fiction); // appDbContext.SaveChanges(); }
public Travelling(Fiction f) : base(f) { }
public Fiction(Fiction f) : base(f) { this.Type = f.Type; this.Age = f.Age; }