public async Task UpdateCompanyDetail(CompanyDetail companyDetail) { var companyDetailJson = new StringContent(JsonSerializer.Serialize(companyDetail), Encoding.UTF8, "application/json"); await _httpClient.PutAsync($"api/companydetail/{companyDetail.Id}", companyDetailJson); }
public ProxyResponse <InsertCompanyResult> InsertCompany(CompanyDetail company) { OperationMethod = HttpMethod.Post; var uri = base.GetRequestUri(null); return(base.GetResponse <CompanyDetail, InsertCompanyResult>(uri, company)); }
public CompanyDetail AddCompanyDetail(CompanyDetail companyDetail) { var addedEntity = _appDbContext.CompanyDetails.Add(companyDetail); _appDbContext.SaveChanges(); return(addedEntity.Entity); }
private void CurrencySetup(CompanyDetail cm) { if (cm.UnderCompanyId == 0 || cm.UnderCompanyId == null) { DAL.CustomFormat cf = new DAL.CustomFormat(); cf.CompanyId = cm.Id; cf.CurrencyPositiveSymbolPrefix = "RM"; cf.CurrencyPositiveSymbolSuffix = "RM"; cf.CurrencyNegativeSymbolPrefix = "RM"; cf.CurrencyNegativeSymbolSuffix = "RM"; cf.CurrencyToWordPrefix = "Ringgit"; cf.CurrencyToWordSuffix = "Ringgit"; cf.DecimalToWordPrefix = "Cent"; cf.DecimalToWordSuffix = "Cent"; cf.DigitGroupingBy = 2; cf.CurrencyCaseSensitive = 2; cf.DecimalSymbol = "."; cf.DigitGroupingSymbol = ","; cf.IsDisplayWithOnlyOnSuffix = true; cf.NoOfDigitAfterDecimal = 2; DB.CustomFormats.Add(cf); DB.SaveChanges(); } }
public IActionResult UserDetail(CompanyUserViewModel model) { // Check company contact if (model.IsCompanyContact == true && model.CompanyDetails.UserId != model.UserDetails.UserId) { CompanyDetail companyDetail = _context.CompanyDetails.SingleOrDefault(c => c.Id == model.CompanyDetails.Id); model = SetCompanyContact(model); companyDetail.UserId = model.CompanyDetails.UserId; _context.SaveChanges(); StatusMessage = "Company contact has been updated"; } else if (model.IsCompanyContact == false && model.CompanyDetails.UserId == model.UserDetails.UserId) { StatusMessage = "There must be a user set as company contact.\nSet a different user as company contact to remove this user."; } // update role details UserDetail userDetail = _context.UserDetails.SingleOrDefault(c => c.UserId == model.UserDetails.UserId); if (userDetail.ProfileId != model.UserDetails.Profile.Id) { userDetail.ProfileId = model.UserDetails.Profile.Id; _context.SaveChanges(); StatusMessage = "User role has been updated"; } return(RedirectToAction(nameof(UserDetail))); }
public DataBaseResultSet SaveCompanyDetail <T>(T objData) where T : class, IModel, new() { CompanyDetail obj = objData as CompanyDetail; string sQuery = "sprocCompanyDetailInsertUpdateSingleItem"; List <DbParameter> list = new List <DbParameter>(); list.Add(SqlConnManager.GetConnParameters("RecNo", "RecNo", 8, GenericDataType.Long, ParameterDirection.Input, obj.RecNo)); list.Add(SqlConnManager.GetConnParameters("CompanyCode", "CompanyCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.CompanyCode)); list.Add(SqlConnManager.GetConnParameters("AccountCode", "AccountCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.AccountCode)); list.Add(SqlConnManager.GetConnParameters("CashDiscount", "CashDiscount", 8, GenericDataType.Decimal, ParameterDirection.Input, obj.CashDiscount)); list.Add(SqlConnManager.GetConnParameters("CUser", "CUser", 8, GenericDataType.Long, ParameterDirection.Input, obj.CUser)); list.Add(SqlConnManager.GetConnParameters("CDateTime", "CDateTime", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CDateTime)); list.Add(SqlConnManager.GetConnParameters("EUser", "EUser", 8, GenericDataType.Long, ParameterDirection.Input, obj.EUser)); list.Add(SqlConnManager.GetConnParameters("EDateTime", "EDateTime", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.EDateTime)); list.Add(SqlConnManager.GetConnParameters("CreatedBy", "CreatedBy", 50, GenericDataType.String, ParameterDirection.Input, obj.CreatedBy)); list.Add(SqlConnManager.GetConnParameters("CreatedDate", "CreatedDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CreatedDate)); list.Add(SqlConnManager.GetConnParameters("UpdateddBy", "UpdateddBy", 50, GenericDataType.String, ParameterDirection.Input, obj.UpdateddBy)); list.Add(SqlConnManager.GetConnParameters("UpdatedDate", "UpdatedDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.UpdatedDate)); list.Add(SqlConnManager.GetConnParameters("UpdatedCount", "UpdatedCount", 4, GenericDataType.Int, ParameterDirection.Input, obj.UpdatedCount)); list.Add(SqlConnManager.GetConnParameters("LUT", "LUT", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.LUT)); list.Add(SqlConnManager.GetConnParameters("OperationFlag", "OperationFlag", 4, GenericDataType.Int, ParameterDirection.Input, (short)obj.OperationFlag)); list.Add(SqlConnManager.GetConnParameters("Message", "Message", 300, GenericDataType.String, ParameterDirection.Output, null)); list.Add(SqlConnManager.GetConnParameters("ErrorCode", "ErrorCode", 4, GenericDataType.Int, ParameterDirection.Output, null)); return(SqlConnManager.Save(sQuery, CommandType.StoredProcedure, list.ToArray())); }
public ProxyResponse <UpdateCompanyResult> UpdateCompany(CompanyDetail company, int companyId) { OperationMethod = HttpMethod.Put; var uri = base.GetRequestUri(companyId.ToString()); return(base.GetResponse <CompanyDetail, UpdateCompanyResult>(uri, company)); }
public void DeleteUserById(int id) { List <UserInRole> userInRole = ctx.UserInRoles.Where(u => u.UserId == id).ToList(); foreach (var r in userInRole) { ctx.UserInRoles.Remove(r); } List <UserInCategory> userInCat = ctx.UserInCategories.Where(u => u.UserId == id).ToList(); foreach (var r in userInCat) { ctx.UserInCategories.Remove(r); } User user = ctx.Users.First(u => u.Id == id); if (user.UserDetails != null) { ctx.Educations.Remove(ctx.Educations.First(e => e.Id == user.UserDetail.EducationId)); ctx.JobExperiences.Remove(ctx.JobExperiences.First(e => e.Id == user.UserDetail.JobExperienceId)); UserDetail detail = ctx.UserDetails.First(d => d.Id == user.UserDetails); ctx.UserDetails.Remove(detail); } if (user.CompanyDetails != null) { CompanyDetail detail = ctx.CompanyDetails.First(d => d.Id == user.CompanyDetails); ctx.CompanyDetails.Remove(detail); } ctx.Users.Remove(user); ctx.SaveChanges(); }
public async Task <IActionResult> GetCompanyDetails(Search search) { try { var companies = Db.Companies.Where(c => c.Name.Contains(search.Keyword) || search.SkillIds.Where(s => c.SkillIds.Contains(s.ToString())).Count() > 0 || search.ProjectDomain.Where(d => c.ProjectDomains.Contains(d)).Count() > 0 ); List <CompanyDetail> CompanyDetails = new List <CompanyDetail>(); var companydetails = new CompanyDetail(); foreach (var company in companies) { companydetails.Executive = await Db.Executives.FirstOrDefaultAsync(e => e.CompanyId == company.Id); if (companydetails.Executive == null) { continue; } companydetails.Company = company; companydetails.Skills = await Db.Skills.Where(s => company.SkillIds.Contains(s.Id.ToString())).ToListAsync(); companydetails.Projects = await Db.Projects.Where(p => p.VendorId == company.Id).ToListAsync(); CompanyDetails.Add(companydetails); } return(Ok(CompanyDetails)); } catch (Exception ex) { return(BadRequest()); } }
public bool AddCompany(CompanyDetailsVM model) { try { CompanyDetail dataModel = new CompanyDetail() { CompanyStatus = (int)model.CompanyStatus, CompanyName = model.CompanyName, ManagingPartner = model.ManagingPartner, LaunchedYear = model.LaunchedYear, Stage = (int)model.Stage, NumberOfMembers = model.NumberOfMembers, WebSite = model.WebSite, Email = model.Email, Phone = model.Phone, Country = model.Country, City = model.City, Pincode = model.Pincode, CreatedBy = model.CreatedBy }; using (GrowUpIncubatorEntities db = new GrowUpIncubatorEntities()) { db.CompanyDetails.Add(dataModel); db.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public Message AddOrEdit(CompanyDetail companyDetail) { var message = new Message(); var ID = companyDetail.CompanyId; int result = _iCompanyDetailRepository.AddOrEdit(companyDetail); try { if (result > 0) { if (Convert.ToInt32(ID) > 0) { message = Message.SetMessages.SetSuccessMessage("Submission Updated Successfully!"); } else { message = Message.SetMessages.SetSuccessMessage("Submission Successful!"); } } else { message = Message.SetMessages.SetErrorMessage("Could not be submitted!"); } } catch (Exception e) { message = Message.SetMessages.SetWarningMessage(e.Message.ToString()); } return(message); }
public bool UpdateCompany(CompanyDetailsVM model) { try { CompanyDetail dbCompanyList = new CompanyDetail(); using (GrowUpIncubatorEntities db = new GrowUpIncubatorEntities()) { dbCompanyList = db.CompanyDetails.Where(x => x.Id == model.Id).FirstOrDefault(); if (dbCompanyList != null) { dbCompanyList.Id = dbCompanyList.Id; dbCompanyList.CompanyStatus = (int)dbCompanyList.CompanyStatus; dbCompanyList.CompanyName = dbCompanyList.CompanyName; dbCompanyList.ManagingPartner = dbCompanyList.ManagingPartner; dbCompanyList.LaunchedYear = dbCompanyList.LaunchedYear; dbCompanyList.Stage = (int)dbCompanyList.Stage; dbCompanyList.NumberOfMembers = dbCompanyList.NumberOfMembers; dbCompanyList.WebSite = dbCompanyList.WebSite; dbCompanyList.Email = dbCompanyList.Email; dbCompanyList.Phone = dbCompanyList.Phone; dbCompanyList.Country = dbCompanyList.Country; dbCompanyList.City = dbCompanyList.City; dbCompanyList.Pincode = dbCompanyList.Pincode; db.SaveChanges(); return(true); } } return(false); } catch (Exception ex) { return(false); } }
public void SaveUserDetails() { CompanyDetail companyDe = new CompanyDetail(); companyDe.CompanyName = "IMS Health"; companyDe.CompanyAddress = "Mohakhali"; Customer cus = new Customer(); cus.Name = "Palash"; cus.FatherName = "X"; cus.MobileNo = "019243329321"; cus.CompanyDetail = companyDe; CarDBEntities contex = new CarDBEntities(); //contex.Customers.Add(cus); //contex.SaveChanges(); // CustomerService customerService = new CustomerService(); CompanyService companyService = new CompanyService(); //for insert companyService.InsertCompany(companyDe); customerService.InsertCustomer(cus); //return IEnumerable <Customer> customerList = customerService.GetCustomers(); //error IEnumerable <CompanyDetail> companyList = companyService.GetCompanies(); }
public IActionResult NewCustomer(string companyName) { if (string.IsNullOrWhiteSpace(companyName)) { StatusMessage = "New customer must have a Company Name."; return(RedirectToAction("Index")); } var companyDetail = new CompanyDetail() { Name = companyName, StartDate = DateTime.Now, EndDate = new DateTime(2070, 1, 1) }; try { _context.Add(companyDetail); _context.SaveChanges(); StatusMessage = string.Format("Company '{0}' created, please add company contact.", companyName); return(RedirectToLocal("/Customer/Customer/" + companyDetail.Id)); } catch (Exception ex) { StatusMessage = string.Format("Company '{0}' could not be created, error: {1}.", companyName, ex.Message); } return(RedirectToLocal("/Customer/Index")); }
public CompanyDetail GetCompDetails(string symbol) { // string to specify information to be retrieved from the API string IEXTrading_API_PATH = BASE_URL + "stock/" + symbol + "/company"; // initialize objects needed to gather data string companydetails = ""; CompanyDetail CompanyDetails = new CompanyDetail(); httpClient.BaseAddress = new Uri(IEXTrading_API_PATH); // connect to the API and obtain the response HttpResponseMessage response = httpClient.GetAsync(IEXTrading_API_PATH).GetAwaiter().GetResult(); // now, obtain the Json objects in the response as a string if (response.IsSuccessStatusCode) { companydetails = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); } // parse the string into appropriate objects if (!companydetails.Equals("")) { CompanyDetails = JsonConvert.DeserializeObject <CompanyDetail>(companydetails); } return(CompanyDetails); }
public ActionResult Edit(CompanyDetail objCompanyDetail) { CompanyDetailBLL objCompanyDetailBll = new CompanyDetailBLL(); objCompanyDetailBll.UpdateCompanyDetail(objCompanyDetail); return(RedirectToAction("Index", "CompanyDetail")); }
public EditCompanyDetailViewModel GetCompanyDetail() { var user = _userService.GetUser(); var model = new EditCompanyDetailViewModel(); CompanyDetail companyDetail = _companyDetailRepository.Get(x => x.UserId == user.UserId); if (companyDetail != null) { model.ImagePath = companyDetail.ImageUrl; model.UserId = companyDetail.UserId; model.WebSite = companyDetail.WebSite; model.SectorId = companyDetail.SectorId; model.NumberOfEmployees = companyDetail.NumberOfEmployees; //model.ImageUrl = companyDetail.ImageUrl; model.FoundationYear = companyDetail.FoundationYear; model.CompanyName = companyDetail.CompanyName; model.Address = companyDetail.Address; model.About = companyDetail.About; model.NumberOfUnreadSendedMessages = _messageService.GetUnreadSendedMessageCount(); model.ImageFileName = Path.GetFileName(model.ImagePath); } model.SectorList = _sectorService.GetSectorList(); return(model); }
public ActionResult Index() { var data = new ViewModel(); data.ContentPage = Models.Page.LoadOrCreatePageCode("ContactUs"); if (data.ContentPage == null) { throw new Exception("Contact Us page not found"); } var companyDetail = Models.CompanyDetail.Load(new Sql("Select Top 1 * from CompanyDetail")); if (companyDetail == null) { companyDetail = new CompanyDetail(); companyDetail.Address = "Lorem ipsum dolor sit amet"; companyDetail.DateAdded = DateTime.Now; companyDetail.Email = "*****@*****.**"; companyDetail.Latitude = 41.4395; companyDetail.Longitude = 72.1936; companyDetail.Phone = "00-0000000-00"; companyDetail.Title = "Lorem ipsum dolor sit amet"; companyDetail.Save(); } data.CompanyDetails = companyDetail; data.ContactUsTextBlock = TextBlockCache.GetRich("Contact Us Text", ""); data.ContactDetails = new ContactUs(); return(View("ContactUs", data)); }
/// <summary> /// This method is used fetch Item List from database. - JJ /// </summary> /// <param name="CompanyDetail">object of CompanyDetail</param> /// ?<param name="BranchId"></param> /// <returns>list of ItemProfileAC</returns> public List <ItemProfileAC> GetItemList(CompanyDetail company, int BranchId) { try { var itemACList = new List <ItemProfileAC>(); var itemList = _itemProfileContext.Fetch(x => x.IsDeleted == false && x.CompanyId == company.Id && x.IsActive && x.IsParentItem).ToList(); if (itemList != null) { foreach (var item in itemList) { var itemProfileList = GetItemProfileAcObject(item, BranchId); foreach (var itemProfile in itemProfileList) { var childitemList = _itemProfileContext.Fetch(x => x.IsDeleted == false && x.CompanyId == company.Id && x.IsActive && x.ParentItemId == item.Id).ToList(); itemProfile.listOfChildProfileAC = new List <SubItemProfileAC>(); foreach (var childItem in childitemList) { itemProfile.HasChildItem = true; itemProfile.listOfChildProfileAC.Add(GetSubItemProfileAcObject(childItem, BranchId, itemProfile.SupplierId, itemProfile.SupplierName)); } itemACList.Add(itemProfile); } } } return(itemACList); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public async Task <string> GetSimIdByTicker(string ticker) { var urlToUse = urlForTickerToId.Replace(@"{tickerStr}", ticker.Trim()); CompanyDetail firstDetail = await CallSimFinForSimId(urlToUse); return(firstDetail != null ? firstDetail.SimId : ""); }
public async Task <string> GetSimIdByCompanyName(string companyName) { var urlToUse = urlForCompanyNameToId.Replace(@"{companyName}", companyName.Trim()); CompanyDetail firstDetail = await CallSimFinForSimId(urlToUse); return(firstDetail != null ? firstDetail.SimId : ""); }
public DataTable Save(BatchDetail det, CompanyDetail companydet, string filePath, DataTable dtcounties) { Save(det); DataTable dtData = GetData(filePath); if (dtData.Rows.Count > 0) { DataTable dtDTSMapping = null; DataTable dtCaseTypeMapping = null; det.TotalCount = dtData.Rows.Count; det.CreatedDate = DateTime.Now; if (companydet.DTSMapping != null) { dtDTSMapping = (DataTable)XMLUtilities.Deserialize(companydet.DTSMapping, typeof(DataTable)); } if (companydet.CaseTypeMapping != null) { dtCaseTypeMapping = (DataTable)XMLUtilities.Deserialize(companydet.CaseTypeMapping, typeof(DataTable)); } Transform(det, ref dtData, dtDTSMapping, dtCaseTypeMapping, dtcounties); } else { throw new ApplicationException(ErrorConstants.EmptyBatchError); } return(dtData); }
public void CompanyTest() { var mth = new CompanyDetail() { CompanyID = 6368 }; var c = ApiClient.Execute(mth).Result; }
public CompanyDetailVM getCompDetailVM(CompanyDetail companydetails) { List <Company> companies = dbContext.Companies.ToList(); CompanyDetail current = companydetails; return(new CompanyDetailVM(companies, companydetails)); }
/// <summary> /// Parses the company details file. /// </summary> /// <returns></returns> /// <exception cref="Exception"> /// File path is not set /// or /// Columns to read not set /// </exception> public bool ParseCompanyDetailsFile() { var counter = 0; if (FileName == null) { throw new Exception("File path is not set"); } if (Columns.Length == 0) { throw new Exception("Columns to read not set"); } SetIdentifierFields(out string symbol, out string ipoYear, out string sector, out string industry, out string name); using (var reader = File.OpenText(FileName)) { var csv = new CsvReader(reader); ConfigureReader(csv); while (csv.Read()) { ExtractDataFromRecord(symbol, ipoYear, sector, industry, name, csv, out string securitySymbol, out string securitySector, out string securityIndustry, out int securityIPOYear, out string securityName); if (string.IsNullOrWhiteSpace(securitySector) || string.IsNullOrWhiteSpace(securityIndustry) || securitySector.Equals("n/a") || securityIndustry.Equals("n/a")) { continue; } var cd = CompanyDetails.FirstOrDefault(r => r.Symbol.Equals(securitySymbol)); if (cd == null) { cd = new CompanyDetail { Symbol = securitySymbol, IPOyear = securityIPOYear, Sector = securitySector, Industry = securityIndustry, SecurityName = securityName }; CompanyDetails.Add(cd); counter++; } else { cd.IPOyear = securityIPOYear; cd.Sector = securitySector; cd.Industry = securityIndustry; } } } Console.WriteLine($"New records count {counter}"); return(true); }
public void GetListCompanyDetail <T>(T objFilter, ref List <T> listData) where T : class, IModel, new() { string sQuery = "GetListCompanyDetail"; CompanyDetail objData = objFilter as CompanyDetail; List <DbParameter> list = new List <DbParameter>(); list.Add(SqlConnManager.GetConnParameters("RecNo", "RecNo", 8, GenericDataType.Long, ParameterDirection.Input, objData.RecNo)); SqlConnManager.GetList <T>(sQuery, CommandType.StoredProcedure, list.ToArray(), FillCompanyDetailDataFromReader, ref listData); }
private void FillCompanyDetailDataFromReader <T>(DbDataReader DbReader, ref List <T> listData) where T : class, IModel, new() { while (DbReader.Read()) { T obj = new T(); CompanyDetail objData = obj as CompanyDetail; obj.FillDataFromDB(DbReader); listData.Add(obj); } }
public ActionResult Save(CompanyDetail objCompanyDetail) { if (ModelState.IsValid) { CompanyDetailBLL objCompanyDetailBll = new CompanyDetailBLL(); objCompanyDetailBll.SaveCompanyInfo(objCompanyDetail); } return(RedirectToAction("Index", "CompanyDetail")); }
public ActionResult AddOrEdit(int id = 0) { CompanyDetail companyDetail = new CompanyDetail(); if (id != 0) { companyDetail = _iCompanyDetailManager.GetACompanyDetail(id); } return(View(companyDetail)); }
public void ChangeCompanyByList_OpenDetail_CheckChanges() { using (CompaniesList list = (CompaniesList)ModulesManager.Current.OpenModuleObjectDetail(new CompaniesListObject(Session), false)) { Company company = SessionHelper.GetObject <Company>(FoxCompany, list.CompaniesEdit.VRObjectsEditObject.VideoRentObjects.Session); company.Tag = "changed tag"; using (CompanyDetail detail = (CompanyDetail)list.OpenDetail(company.Oid)) { Assert.AreEqual("changed tag", detail.CompanyEdit.VRObjectEditObject.VideoRentObject.Tag); } } }
public void AddCompanyStats( string CompanyCode, int OpenedThisYear, int SettledThisYear, int CurrentVersion, string[] userlist, string[] ipaddresses, DateTime[] userLastLoggedOn ) { using (DataBaseContext context = new DataBaseContext()) { int currentIndex = 0; var company = (from obj in context.Companies where obj.CompanyCode == CompanyCode select obj).First(); if (company.CompanyDetail != null) { company.CompanyDetail.OpenedThisYear = OpenedThisYear; company.CompanyDetail.SettledThisYear = SettledThisYear; company.CompanyDetail.CurrentVersion = CurrentVersion; } else { CompanyDetail newDetail = new CompanyDetail(); newDetail.OpenedThisYear = OpenedThisYear; newDetail.SettledThisYear = SettledThisYear; newDetail.CurrentVersion = CurrentVersion; newDetail.Company = company; context.AddToCompanyDetails(newDetail); } bool canInsertUser = (company.SettUsers.Count() == userlist.Count() && company.SettUsers.Count() == ipaddresses.Count() && company.SettUsers.Count() == userLastLoggedOn.Count() ); if (canInsertUser) { foreach (var current in company.SettUsers) { SettUser newUser = new SettUser(); newUser.UserName = userlist[currentIndex]; newUser.IPAddress = ipaddresses[currentIndex]; //??? needs change type of field ipaddress newUser.LastLogonDate = userLastLoggedOn[currentIndex]; newUser.Company = company; context.AddToSettUsers(newUser); ++currentIndex; } } else { //Handle error here } } }
public void TestCompanyCRUD() { List<Company> list = Company.Query("code = 'testcode'"); foreach (Company c in list) { c.Destory(); } list = Company.Query(); long count = list.Count; Company com = new Company(); com.Code = "testcode"; com.Name = "testname"; com.Doc = "沪"; com.Input = "X"; com.Output = "X"; com.ParentID = Company.Query("input <> 'X' and output <> 'X'")[0].ID; for (int i = 0; i < 10; i++) { CompanyDetail d = new CompanyDetail(); d.BankID = Bank.Query()[0].ID; d.Account = i.ToString(); d.Balance = i; d.Credit = i; com.DetailList.Add(d); } Assert.IsTrue(com.Save()); Assert.IsTrue(com.ID > 0); Company q = Company.CreateByID(com.ID); Assert.IsTrue(q.ID == com.ID); Assert.IsTrue(q.DetailList.Count == 10); q.DetailList.RemoveAt(0); q.Save(); list = q.Find("code = 'testcode'"); Assert.IsTrue(list.Count == 1); Assert.IsTrue(list[0].DetailList.Count == 9); list = Company.Query(); Assert.IsTrue(list.Count == count + 1); com.Destory(); list = Company.Query(); Assert.IsTrue(list.Count == count); }
private async Task LoadData() { this.IsBusy = true; var mth = new CompanyDetail() { CompanyID = this.CompanyID }; this.Data = await ApiClient.Execute(mth); this.ProductsVM = new ProductsViewModel(this.Data?.Products); this.HistoryVM = new HistoryViewModel(this.Data?.History); this.LeaderVM = new LeaderViewModel(this.Data?.Leaders); this.NotifyOfPropertyChange(() => this.Data); this.NotifyOfPropertyChange(() => this.ProductsVM); this.NotifyOfPropertyChange(() => this.HistoryVM); this.NotifyOfPropertyChange(() => this.LeaderVM); this.IsBusy = false; }
// 为所有的外单位加一个现金帐户 private void update_2013_11_08() { List<Bank> banks = Bank.Query("code = 'XJ' and name = '现金'"); if (banks.Count == 0) { MessageBox.Show("请增加一个银行,其代码为‘XJ’,名称为‘现金’"); return; } List<Company> list = Company.Query(); foreach (Company cp in list) { bool finded = false; foreach (CompanyDetail cd in cp.DetailList) { if (cd.Account == "现金") finded = true; } if (!finded) //没有找到现金户的话,就直接处理 { CompanyDetail newcd = new CompanyDetail() { Account = "现金", AccountType = "现金户", ParentID = cp.ID, BankID = banks[0].ID }; newcd.Save(); } } }
private void MyRefresh() { if (_status != winStatusEnum.查看) { if (MessageBox.Show("刷新会导致当前的操作的数据丢失,是否要继续?", "注意", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.No) { return; } } _company = null; _detail = null; Company.OrderBy = "order by code"; List<Company> companies = Company.Query(); tree.DataSource = companies; lueType.DataSource = null; lueType.DataSource = CompanyDetail.AccountTypeList; lueCompany.DataSource = Company.Query(); SetFormStatus(winStatusEnum.查看); }
/// <summary> /// 编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) return; // 找到要编辑的银行 long id = long.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "ID").ToString()); foreach (CompanyDetail cd in _company.DetailList) { if (cd.ID == id) _detail = cd; } SetFormStatus(winStatusEnum.编辑); }
/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _detail = new CompanyDetail(); _company.DetailList.Add(_detail); gridControl1.DataSource = null; gridControl1.DataSource = _company.DetailList; SetFormStatus(winStatusEnum.新增); }