public void NotConvertEntity_WithNull() { Appendix entity = null; var convertedBO = _converter.Convert(entity); Assert.Null(convertedBO); }
public void Append(WikiDirectory wikiDirectory) { if (Predef == null) { Predef = new List <string>(); } if (Chaps == null) { Chaps = new List <string>(); } if (Appendix == null) { Appendix = new List <string>(); } if (Postdef == null) { Postdef = new List <string>(); } var items = wikiDirectory .WikiEntries .Select(x => x.MarkdownName) .Where( x => !Predef.Contains(x) && !Chaps.Contains(x) && !Appendix.Contains(x) && !Postdef.Contains(x)); foreach (var item in items) { Chaps.Add(item); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,FileName")] Appendix appendix) { if (id != appendix.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appendix); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppendixExists(appendix.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(appendix)); }
/// <summary> /// 新增客户资料数据(包含文件上传) /// </summary> /// <param name="_UA01">实体类</param> /// <returns>影响行数</returns> public int AddCustomerBase(CustomerBase _CustomerBase, Appendix _Appendix) { try { CreateSqlHandler <Appendix> _CreateSqlHandlerAppendix = new CreateSqlHandler <Appendix>(); CreateSqlHandler <CustomerBase> _CreateSqlHandlerCustomerBase = new CreateSqlHandler <CustomerBase>(); //生成CA01Sql语句 string strCA01Sql = _CreateSqlHandlerCustomerBase.Insert(_CustomerBase, "CA01"); //生成GA07Sql语句 string strGA07Sql = _CreateSqlHandlerAppendix.Insert(_Appendix, "GA07"); int num = Math.Abs(Provider.ExecuteNonQuery("PRO_CA01", 1, new SqlParameter[] { new SqlParameter() { ParameterName = @"sqlCA01", Value = strCA01Sql, DbType = DbType.String }, new SqlParameter() { ParameterName = @"sqlGA07", Value = strGA07Sql, DbType = DbType.String }, new SqlParameter() { ParameterName = @"CA01999", Value = _CustomerBase.CA01999, DbType = DbType.String } })); return(num); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> CreateAppendix(int id, [Bind("Id,Name,FileName")] AppendixViewModel appendix) { if (ModelState.IsValid) { string fileName = ""; if (appendix.FileName != null) { string uploadPath = Path.Combine(hostingEnvironment.WebRootPath, "images"); fileName = Guid.NewGuid().ToString() + "_" + appendix.FileName.FileName; string FilePath = Path.Combine(uploadPath, fileName); appendix.FileName.CopyTo(new FileStream(FilePath, FileMode.Create)); } Appendix model = new Appendix(); //model.Id = 0; model.FileName = fileName; model.Name = appendix.Name; _context.Add(model); var task = _context.Tasks.Find(id); await _context.SaveChangesAsync(); task.AppendixId = model.Id; _context.Update(task); await _context.SaveChangesAsync(); return(RedirectToAction("TaskForModule", new { id = task.ModuleId })); } return(View(appendix)); }
public void btnAddAppendix(object sender, EventArgs e) { if (!_View.AppendixList.Exists(MatchTitle)) { Appendix appendix = new Appendix(0, 0, _View.ATitle, _View.Directory); _View.AppendixList.Add(appendix); } }
private bool MatchTitle(Appendix appendix) { if (appendix.Title == _View.ATitle) { return(true); } return(false); }
public async Task <StatusResponse> SendAppendixAsync(Appendix appendix) { try { string postBody = JsonConvert.SerializeObject(appendix); HttpResponseMessage response = await client.PostAsync("Appendix", new StringContent(postBody, Encoding.UTF8, "application/json")); if (response.IsSuccessStatusCode) { string str = await response.Content.ReadAsStringAsync(); //AnalyticsService.TrackEvent(str); var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; StatusResponse statusResponse = JsonConvert.DeserializeObject <StatusResponse>(str, settings); if (statusResponse == null) { return new StatusResponse() { Status = 0, Message = "No response received", AppendixID = -1 } } ; return(statusResponse); } else { string str = await response.Content.ReadAsStringAsync(); } } catch (HttpRequestException hre) { } catch (TaskCanceledException hca) { } catch (Exception ex) { } finally { /*if (httpClient != null) * { * httpClient.Dispose(); * httpClient = null; * }*/ } return(new StatusResponse() { Status = 0, Message = "No response received", AppendixID = -1 }); }
public bool Save(Appendix appendix) { using (var file = new StreamWriter($"{_location}/{File}")) { file.WriteLine(appendix.Condition); file.WriteLine(appendix.Resources); } return(true); }
public void SaveAppendix() { var appendixToSave = new Appendix() { Condition = "Test", Resources = "Test" }; var saved = _repository.Save(appendixToSave); Assert.True(saved); }
public Appendix Add(AppendixDto addedAppendix) { var appendix = new Appendix() { FileBinary = addedAppendix.FileBinary, FileName = addedAppendix.FileName, ReportId = addedAppendix.ReportId.Value }; _domainContext.Appendixs.Add(appendix); return(appendix); }
/// <summary> /// 插入附件 /// </summary> public int InsertAppendix(Appendix appendix) { int pkid; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AppendixID, SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add(_ABulletinID, SqlDbType.Int).Value = appendix.BulletinID; cmd.Parameters.Add(_ATitle, SqlDbType.NVarChar, 50).Value = appendix.Title; cmd.Parameters.Add(_Directory, SqlDbType.Text).Value = appendix.Directory; SqlHelper.ExecuteNonQueryReturnPKID("AppendixInsert", cmd, out pkid); return(pkid); }
private void FindAppendixInDirectory() { Appendix[] appendixtemp = new Appendix[_View.AppendixList.Count]; (_View.AppendixList).CopyTo(appendixtemp); foreach (Appendix appendix in appendixtemp) { if (!File.Exists(appendix.Directory)) { _View.AppendixList.Remove(appendix); } } _View.AppendixList = _View.AppendixList; }
public void btnAddAppendix(object sender, EventArgs e) { _View.ErrorMessageFromBll = ""; try { Appendix appendix = new Appendix(0, _View.BulletinID, _View.ATitle, _View.Directory); _BulletinBll.CreateAppendix(appendix, null); ReBindAppendix(); } catch (ApplicationException ex) { _View.ErrorMessageFromBll = ex.Message; } }
/// <summary> /// 保存操作 /// </summary> private void DataSave() { int result = 0; List <Appendix> list = new List <Appendix>(); #region 保存客户文件 HttpFileCollection files = HttpContext.Current.Request.Files; try { for (int iFile = 0; iFile < files.Count; iFile++) { HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension, newFileName; fileName = System.IO.Path.GetFileName(postedFile.FileName); //上传文件名 string fileNameGuid = Guid.NewGuid().ToString("N"); fileExtension = System.IO.Path.GetExtension(fileName); //后缀名 newFileName = fileNameGuid + fileExtension; //重命名 string fileSrc = string.Format("/File/{0}", fileName); if (fileName != "") { Appendix _Appendix = new Appendix(); _Appendix.GA07002 = Request.QueryString["OA01001"].ToString(); _Appendix.GA07003 = fileExtension; //文件后缀 _Appendix.GA07004 = postedFile.ContentLength; //文件大小 _Appendix.GA07005 = fileSrc; _Appendix.GA07006 = fileName; //旧文件名字 _Appendix.GA07007 = newFileName; //新文件名字 _Appendix.GA07008 = 2; //2 代表订单对应的文件 _Appendix.GA07997 = 0; _Appendix.GA07998 = DateTime.Now; postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("/File/") + newFileName); list.Add(_Appendix); } } result = _OrderBLL.AddOrderFileBase(list);//执行保存文件 } catch (System.Exception Ex) { throw Ex; } #endregion //成功失败提示 new Sinoo.Common.MessageShow().InsertMessage(this, result, "DataClear();"); }
public void LoadExistingAppendix() { var appendixToSave = new Appendix() { Condition = "Test", Resources = "Test" }; _repository.Save(appendixToSave); var loadedAppendix = _repository.Load(); Assert.NotNull(loadedAppendix); Assert.Contains(appendixToSave.Condition, loadedAppendix.Condition); Assert.Contains(appendixToSave.Resources, loadedAppendix.Resources); }
/// <summary> /// 通过附件ID查找附件 /// </summary> public Appendix GetAppendixByPKID(int appendixID) { Appendix appendix = null; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AppendixID, SqlDbType.Int).Value = appendixID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAppendixByPKID", cmd)) { while (sdr.Read()) { appendix = new Appendix(Convert.ToInt32(sdr[_DbAppendixID]), Convert.ToInt32(sdr[_DbABulletinID]), sdr[_DbATitle].ToString(), sdr[_DbDirectory].ToString()); } } return(appendix); }
/// <summary> /// 通过公告ID查找附件 /// </summary> public List <Appendix> GetAppendixByBulletinID(int bulletinID) { List <Appendix> appendixList = new List <Appendix>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_ABulletinID, SqlDbType.Int).Value = bulletinID; using (SqlDataReader sdrItem = SqlHelper.ExecuteReader("GetAppendixByBulletinID", cmd)) { while (sdrItem.Read()) { Appendix appendix = new Appendix(Convert.ToInt32(sdrItem[_DbAppendixID]), Convert.ToInt32(sdrItem[_DbABulletinID]), sdrItem[_DbATitle].ToString(), sdrItem[_DbDirectory].ToString()); appendixList.Add(appendix); } } return(appendixList); }
public async Task <IActionResult> Create([Bind("Id,Name,FileName")] AppendixViewModel appendix) { if (ModelState.IsValid) { string fileName = ""; if (appendix.FileName != null) { string uploadPath = Path.Combine(hostingEnvironment.WebRootPath, "images"); fileName = Guid.NewGuid().ToString() + "_" + appendix.FileName.FileName; string FilePath = Path.Combine(uploadPath, fileName); appendix.FileName.CopyTo(new FileStream(FilePath, FileMode.Create)); } Appendix model = new Appendix(); model.FileName = fileName; model.Name = appendix.Name; _context.Add(model); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(appendix)); }
private bool MatchTitle(Appendix appendix) { return(appendix.Title == _View.ATitle); }
public RemoveExpense(Compensation compensation, Appendix expense) { Compensation = compensation; Expense = expense; }
public ShowExpense(Appendix expense) { Expense = expense; }
public virtual void AddAppendix(Appendix appendix) { Appendixes.Add(appendix); }
public void RemoveAppendix(Appendix expense) { appendices.Remove(expense); }
public AddAppendix(Appendix appendix) { _Appendix = appendix; }
public void CreateAppendix(Appendix appendix, Account loginUser) { AddAppendix addAppendix = new AddAppendix(appendix); addAppendix.Excute(); }
public void AddAppendix(Appendix expense) { appendices.Add(expense); }