public void ChangeStatus(string CompangIds, CompanyStatus CompanyStatus) { var IdsArray = CompangIds.Split(',').Select(x => Convert.ToInt32(x)); var CompanyStatusValue = (int)CompanyStatus; db.Set<Company>().Where(x => IdsArray.Contains(x.MemberID)).ToList().ForEach(x => x.Status = CompanyStatusValue); db.Commit(); if (CompanyStatus == CompanyStatus.CompanyFailed) { MemberService.ChangeStatus(IdsArray, (int)MemberStatus.CompanyFailed); } else if (CompanyStatus == CompanyStatus.CompanyAuth) { MemberService.ChangeStatus(IdsArray, (int)MemberStatus.CompanyAuth); SendCompanyAuthedMail(IdsArray); } }
public bool ChangeStatus(string CompangIds, CompanyStatus CompanyStatus) { var result = true; try { var IdsArray = CompangIds.Split(',').Select(x => Convert.ToInt32(x)); var CompanyStatusValue = (int)CompanyStatus; DB_Service.Set<Company>().Where(x => IdsArray.Contains(x.CompanyID)).ToList().ForEach(x => x.Status = CompanyStatusValue); DB_Service.Commit(); } catch (DbEntityValidationException ex) { result = false; } return result; }
public IQueryable <CompanyVerifyViewModel> GetVerifyList(CompanyStatus CompanyStatus) { int CompanyStatusValue = (int)CompanyStatus; return(db.Set <Company>().Select(x => new CompanyVerifyViewModel() { MemberID = x.MemberID, Name = x.Name, Description = x.Description, LinkMan = x.LinkMan, Contact = (string.IsNullOrEmpty(x.Mobile) ? "" : "手机:" + x.Mobile) + (string.IsNullOrEmpty(x.Phone) ? "" : "电话:" + x.Phone), Status = x.Status, AddTime = x.AddTime, LastTime = x.LastTime }).Where(x => x.Status == CompanyStatusValue)); }
public void ChangeStatus(string CompangIds, CompanyStatus CompanyStatus) { var IdsArray = CompangIds.Split(',').Select(x => Convert.ToInt32(x)); var CompanyStatusValue = (int)CompanyStatus; db.Set <Company>().Where(x => IdsArray.Contains(x.MemberID)).ToList().ForEach(x => x.Status = CompanyStatusValue); db.Commit(); if (CompanyStatus == CompanyStatus.CompanyFailed) { MemberService.ChangeStatus(IdsArray, (int)MemberStatus.CompanyFailed); } else if (CompanyStatus == CompanyStatus.CompanyAuth) { MemberService.ChangeStatus(IdsArray, (int)MemberStatus.CompanyAuth); SendCompanyAuthedMail(IdsArray); } }
public async Task <bool> Update(CompanyStatus CompanyStatus) { CompanyStatusDAO CompanyStatusDAO = DataContext.CompanyStatus.Where(x => x.Id == CompanyStatus.Id).FirstOrDefault(); if (CompanyStatusDAO == null) { return(false); } CompanyStatusDAO.Id = CompanyStatus.Id; CompanyStatusDAO.Code = CompanyStatus.Code; CompanyStatusDAO.Name = CompanyStatus.Name; await DataContext.SaveChangesAsync(); await SaveReference(CompanyStatus); return(true); }
private static ICustomer GenerateNewCustomer(CompanyStatus customerStatus) { List <string> title = new List <string>() { "Chief", "Prof", "Barr.", "Engr.", "Pastor", "Chef" }; List <string> name = new List <string>() { "Ayo", "Okon", "Ike", "Chima", "Vera", "Bliss" }; List <string> company = new List <string>() { "Dangote Ltd", "Facebook Inc.", "IBM Corp.", "Ayiam Ltd", "Andela Comms.", "Ayo Farms Ltd" }; List <string> industry = new List <string>() { "Finance", "Education", "Real Estate", "Chemicals", "Construction", "Commuinications" }; List <string> date = new List <string>() { "04/10/1989", "06/09/1955", "01/03/1964", "01/10/1960", "06/02/1981", "01/03/1990" }; List <Gender> gender = new List <Gender>() { Gender.Male, Gender.Female, Gender.Male, Gender.Female, Gender.Male, Gender.Female }; Random rand = new Random(); if (customerStatus == CompanyStatus.Person) { return(new PersonCustomer(title[rand.Next(6)], name[rand.Next(6)], name[rand.Next(6)], date[rand.Next(6)], gender[rand.Next(6)], "Nigeria")); } else if (customerStatus == CompanyStatus.Private || customerStatus == CompanyStatus.Public) { return(new CompanyCustomer(industry[rand.Next(6)], company[rand.Next(6)], date[rand.Next(6)], "12345", "Nigeria", customerStatus)); } else { throw new ArgumentException("Invalid Selection"); } }
public async Task <CompanyStatus> Get(long Id) { CompanyStatus CompanyStatus = await DataContext.CompanyStatus.AsNoTracking() .Where(x => x.Id == Id) .Select(x => new CompanyStatus() { Id = x.Id, Code = x.Code, Name = x.Name, }).FirstOrDefaultAsync(); if (CompanyStatus == null) { return(null); } return(CompanyStatus); }
public SupplierListInfo(SqlDataReader reader) { //[Id], Guid,Email,[Name],CompanyName, Address, PhoneNumber, Status,FoundedYear,AllowMatch,Balance,GeneralScore,Priority id = reader.GetInt32(0); guid = reader.GetString(1); email = reader.GetString(2); name = reader.IsDBNull(3) ? "" : reader.GetString(3); companyName = reader.IsDBNull(4) ? "" : reader.GetString(4); address = reader.IsDBNull(5) ? "" : reader.GetString(5); phoneNumber = reader.IsDBNull(6) ? "" : reader.GetString(6); status = (CompanyStatus)(reader.GetInt16(7)); foundedYear = reader.GetInt16(8); regDate = reader.GetDateTime(9); allowMatch = reader.GetString(10) == "1"; balance = Convert.ToSingle(reader.GetValue(11)); generalScore = Convert.ToSingle(reader.GetValue(12)); priority = reader.GetInt32(13); }
public async Task <Response> SetCompanyStatus(Guid companyId, CompanyStatus status) { var companyEntity = await _companiesRepository.GetById(companyId); if (companyEntity == null) { return(new NotFoundErrorResponse()); } if (companyEntity.Status == status) { return(new Response()); } companyEntity.Status = status; await _companiesRepository.Update(companyEntity); return(new Response()); }
public async Task <bool> ValidateId(CompanyStatus CompanyStatus) { CompanyStatusFilter CompanyStatusFilter = new CompanyStatusFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = CompanyStatus.Id }, Selects = CompanyStatusSelect.Id }; int count = await UOW.CompanyStatusRepository.Count(CompanyStatusFilter); if (count == 0) { CompanyStatus.AddError(nameof(CompanyStatusValidator), nameof(CompanyStatus.Id), ErrorCode.IdNotExisted); } return(count == 1); }
/// <summary> /// 更新公司状态 /// </summary> /// <param name="companyId"></param> /// <param name="status"></param> /// <returns>影响的行数</returns> public static int SetCompanyStatus(int companyId, int userId, CompanyStatus status) { StringBuilder sbSQL = new StringBuilder(); if (status == CompanyStatus.Pass) { //通过 sbSQL.AppendFormat("UPDATE Companies SET CompanyStatus = {0},LastPassDateTime = GETDATE() WHERE CompanyId = {1} AND UserId = {2};", (int)status, companyId, userId); //更新用户类型 //sbSQL.AppendFormat("UPDATE Members SET [Type] = {0}/*公司类型*/ WHERE Id = (SELECT UserId FROM Companies WHERE CompanyId = {1} AND UserId = {2});", (int)MemberType.Enterprise, companyId, userId); } else { //不通过 或 申请中 sbSQL.AppendFormat("UPDATE Companies SET CompanyStatus = {0} WHERE CompanyId = {1} AND UserId = {2};", (int)status, companyId, userId); //更新用户类型 //sbSQL.AppendFormat("UPDATE Members SET [Type] = {0}/*个人用户类型*/ WHERE Id = (SELECT UserId FROM Companies WHERE CompanyId = {1} AND UserId = {2});", (int)MemberType.Common, companyId, userId); } return(SQLPlus.ExecuteNonQuery(CommandType.Text, sbSQL.ToString())); }
protected void Grid1_RowDataBound(object sender, FineUIPro.GridRowEventArgs e) { // e.DataItem -> System.Data.DataRowView or custom class. // e.RowIndex -> Current row index. // e.Values -> Rendered html for each column of this row. Infobasis.Data.DataEntity.Company company = e.DataItem as Infobasis.Data.DataEntity.Company; CompanyStatus companyStatus = (CompanyStatus)company.CompanyStatus; RenderField rfCompnyStatus = Grid1.FindColumn("CompanyStatus") as RenderField; if (companyStatus == CompanyStatus.Expired) { //e.RowCssClass = "Expired-Company"; e.CellAttributes[rfCompnyStatus.ColumnIndex]["data-color"] = "Expired-Company"; } else if (companyStatus == CompanyStatus.Disabled) { //e.RowCssClass = "Disabled-Company"; e.CellAttributes[rfCompnyStatus.ColumnIndex]["data-color"] = "Disabled-Company"; } }
public IActionResult Approve(string companyId, CompanyStatus filter, int page) { if (!this.companies.CompanyExists(companyId)) { this.GenerateAlertMessage(string.Format(WebConstants.Message.NonExistingEntity, nameof(WebConstants.Entity.Company), companyId), Alert.Danger); return(RedirectToAction(nameof(All))); } var isApproved = this.companies.Approve(companyId); var companyName = this.companies.GetCompanyName(companyId); if (!isApproved) { this.GenerateAlertMessage(string.Format(WebConstants.Message.CompanyAlreadyApproved, companyName), Alert.Warning); } else { this.GenerateAlertMessage(string.Format(WebConstants.Message.CompanyApproved, companyName), Alert.Success); } return(RedirectToAction(nameof(All), new { page = page, filter = filter })); }
public EntrepreneursTypes GetAllOptions() { EntrepreneursTypes data = new EntrepreneursTypes(); _dataProvider.ExecuteCmd("dbo.EntrepreneursTypes_SelectAll", inputParamMapper : null, singleRecordMapper : delegate(IDataReader reader, short set) { switch (set) { case 0: IndustryType model = new IndustryType(); int startingIndex = 0; model.Id = reader.GetSafeInt32(startingIndex++); model.Name = reader.GetSafeString(startingIndex++); if (data.IndustryTypes == null) { data.IndustryTypes = new List <IndustryType>(); } data.IndustryTypes.Add(model); break; } switch (set) { case 1: CompanyStatus model = new CompanyStatus(); int startingIndex = 0; model.Id = reader.GetSafeInt32(startingIndex++); model.Name = reader.GetSafeString(startingIndex++); if (data.CompanyStatuses == null) { data.CompanyStatuses = new List <CompanyStatus>(); } data.CompanyStatuses.Add(model); break; } }); return(data); }
public IActionResult Block(string companyId, CompanyStatus filter, int page) { if (!this.companies.CompanyExists(companyId)) { this.GenerateAlertMessage(string.Format(WebConstants.Message.NonExistingEntity, nameof(WebConstants.Entity.Company), companyId), Alert.Danger); return(RedirectToAction(nameof(All))); } bool statusChanged = this.companies.ChangeStatus(companyId); if (!statusChanged) { this.GenerateAlertMessage(string.Format(WebConstants.Message.BlockCompanyUnavailable, companyId), Alert.Danger); return(RedirectToAction(nameof(All))); } var companyName = this.companies.GetCompanyName(companyId); var companyStatus = this.companies.GetBlockStatus(companyId); this.GenerateAlertMessage(string.Format(WebConstants.Message.CompanyStatusChanged, companyName, companyStatus), Alert.Success); return(RedirectToAction(nameof(All), new { page = page, filter = filter })); }
public void NewCompany(ref BaseDbContext db) { Id = Guid.NewGuid(); Admin = db.Users.Find(Extensions.GetCurrentUser().Id); Time = DateTime.Now; Status = CompanyStatus.ToApprove; }
public void All_WithCorrectPageAndNonExistingFilterShouldRedirectToAllCompaniesAndSetFilterToAll(CompanyStatus filter) { //Arrange var controller = new AdminCompaniesController(null); //Act var result = controller.All(filter); //Assert result.Should().BeOfType <RedirectToActionResult>(); var model = result.As <RedirectToActionResult>(); model.ActionName.Should().Be(WebConstants.Action.AdminAllCompanies); model.RouteValues.Keys.Should().Contain(RouteValueKeyAdminCompaniesFilter); model.RouteValues.Values.Should().Contain(CompanyStatus.All); }
private async Task SaveReference(CompanyStatus CompanyStatus) { }
public async Task <bool> Delete(CompanyStatus CompanyStatus) { await DataContext.CompanyStatus.Where(x => x.Id == CompanyStatus.Id).DeleteFromQueryAsync(); return(true); }
internal CompanyCustomer(string industry, string name, string dateFounded, string regNo, string address, CompanyStatus status) { this.industry = industry; this.name = name; Age = dateFounded; this.status = status; Address = address; this.regNo = regNo; }
public CompanyStatus CompanyStatus_from_CompanyID(int ID) { Company company = (from c in db.Companies where c.CompanyID == ID select c).Single(); var users_in_company = from u in db.CUsers where u.CompanyID == ID select u; //THIS IS A SELECTED TABLE ACQUISITION FROM DATABASE var companyID_in_payHist = from r in db.CompanyPayHists where r.IsACompany == true where r.CompanyID == ID select r; //getting the paid value from the database table CompanyPayHistory int count = 0; int count_two = 0; decimal TotalIn_Transaction = 0; decimal TotalInDiscounted_Transaction = 0; decimal toPay_test = 0; decimal companyTemp = 0; //we going to try to get the amont from the Transaction table instead //so that TotalIn and TotalInDiscounted will not be used in here TotalFromTrans TotalIn_transaction_fromDB; foreach (CUser cu in users_in_company) { int temp = cu.CUserID; try { TotalIn_transaction_fromDB = Cuser_TotalFromTrans_CuserID(temp); TotalIn_Transaction = TotalIn_Transaction + TotalIn_transaction_fromDB.TotalIn; TotalInDiscounted_Transaction = TotalInDiscounted_Transaction+ TotalIn_transaction_fromDB.TotalInDiscounted; count = count + 1; } catch (Exception e) { log.Debug("The company user hasn't entered any transactions" + " Error occurs at '{0}' " + e); } } foreach (CompanyPayHist cp in companyID_in_payHist) { companyTemp = companyTemp + cp.Amount; count_two = count_two + 1; } toPay_test = TotalInDiscounted_Transaction - companyTemp; CompanyStatus cs = new CompanyStatus(); cs.CompanyID = company.CompanyID; cs.CompanyName = company.Name; cs.UserID = company.UserID; if (companyID_in_payHist == null) { cs.Paid = 0; } else { cs.Paid = companyTemp; } cs.TotalIn = TotalIn_Transaction; cs.TotalInDiscounted = TotalInDiscounted_Transaction; cs.toPay = toPay_test; cs.DealRate = company.DealRate; cs.CUserCount = count; cs.Forced = company.Forced; cs.Date = company.Date; return cs; }
public IQueryable<CompanyVerifyViewModel> GetVerifyList(CompanyStatus CompanyStatus) { int CompanyStatusValue = (int)CompanyStatus; return GetVerifyList().Where(x => x.Status == CompanyStatusValue); }
/// <summary> /// Description : Get Company Type from database. /// Created By : Shiva /// Created Date : 24 Nov 2014 /// Modified By : /// Modified Date: /// </summary> /// <returns></returns> public static List<CompanyStatus> GetCompanyStatus() { var data = new List<CompanyStatus>(); System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(); System.Reflection.MethodBase methodBase = stackFrame.GetMethod(); log.Debug("Start: " + methodBase.Name); try { var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpGetCSS1CompanyStatus"); var safe = new SafeDataReader(reader); while (reader.Read()) { var CompanyStatus = new CompanyStatus(); CompanyStatus.FetchCompanyStatus(CompanyStatus, safe); data.Add(CompanyStatus); } return data; } catch (Exception ex) { log.Error("Error: " + ex); return data; } finally { log.Debug("End: " + methodBase.Name); } }
public static ArrayList List(CompanyStatus status, string keywords, string industryCode, string areaCode, Pager pager) { return List((int)status, keywords, industryCode, areaCode, pager); }
public bool ChangeStatus(string CompangIds, CompanyStatus CompanyStatus) { var result = true; try { var IdsArray = CompangIds.Split(',').Select(x => Convert.ToInt32(x)); var CompanyStatusValue = (int)CompanyStatus; DB_Service.Set<Company>().Where(x => IdsArray.Contains(x.CompanyID)).ToList().ForEach(x => x.Status = CompanyStatusValue); DB_Service.Commit(); var MemberIDs = GetCompanyMemberIDs(IdsArray); if (CompanyStatus == CompanyStatus.CompanyFailed) { memberService.ChangeStatus(MemberIDs, MemberStatus.CompanyFailed); } else if (CompanyStatus == CompanyStatus.CompanyAuth) { memberService.ChangeStatus(MemberIDs, MemberStatus.CompanyAuth); foreach (var id in IdsArray) { member_CreditIndexService.AddCreditIndex(id, 3, "001"); } } } catch (DbEntityValidationException ex) { result = false; } return result; }
private CompanyStatus FetchCompanyStatus(CompanyStatus CompanyStatus, SafeDataReader dr) { CompanyStatus.StatusID = dr.GetInt32("StatusID"); CompanyStatus.Status = dr.GetString("Status"); return CompanyStatus; }
public IQueryable<CompanyVerifyViewModel> GetVerifyList(CompanyStatus CompanyStatus) { int CompanyStatusValue = (int)CompanyStatus; return db.Set<Company>().Select(x => new CompanyVerifyViewModel() { MemberID = x.MemberID, Name = x.Name, Description = x.Description, LinkMan = x.LinkMan, Contact = (string.IsNullOrEmpty(x.Mobile) ? "" : "手机:" + x.Mobile) + (string.IsNullOrEmpty(x.Phone) ? "" : "电话:" + x.Phone), Status = x.Status, AddTime = x.AddTime, LastTime = x.LastTime }).Where(x => x.Status == CompanyStatusValue); }
/// <summary> /// 更新公司状态 /// </summary> /// <param name="companyId"></param> /// <param name="status"></param> /// <returns></returns> public static int SetCompanyStatus(int companyId, int userId, CompanyStatus status) { return MemberManage.SetCompanyStatus(companyId,userId,status); }
public async Task <bool> Create(CompanyStatus CompanyStatus) { return(CompanyStatus.IsValidated); }
/// <summary> /// 更新公司状态 /// </summary> /// <param name="companyId"></param> /// <param name="status"></param> /// <returns>影响的行数</returns> public static int SetCompanyStatus(int companyId,int userId,CompanyStatus status) { StringBuilder sbSQL = new StringBuilder(); if (status == CompanyStatus.Pass) { //通过 sbSQL.AppendFormat("UPDATE Companies SET CompanyStatus = {0},LastPassDateTime = GETDATE() WHERE CompanyId = {1} AND UserId = {2};", (int)status, companyId, userId); //更新用户类型 //sbSQL.AppendFormat("UPDATE Members SET [Type] = {0}/*公司类型*/ WHERE Id = (SELECT UserId FROM Companies WHERE CompanyId = {1} AND UserId = {2});", (int)MemberType.Enterprise, companyId, userId); } else { //不通过 或 申请中 sbSQL.AppendFormat("UPDATE Companies SET CompanyStatus = {0} WHERE CompanyId = {1} AND UserId = {2};", (int)status, companyId, userId); //更新用户类型 //sbSQL.AppendFormat("UPDATE Members SET [Type] = {0}/*个人用户类型*/ WHERE Id = (SELECT UserId FROM Companies WHERE CompanyId = {1} AND UserId = {2});", (int)MemberType.Common, companyId, userId); } return SQLPlus.ExecuteNonQuery(CommandType.Text,sbSQL.ToString()); }
/// <summary> /// 更新公司状态 /// </summary> /// <param name="companyId"></param> /// <param name="status"></param> /// <returns></returns> public static int SetCompanyStatus(int companyId, int userId, CompanyStatus status) { return(MemberManage.SetCompanyStatus(companyId, userId, status)); }
public static List <Company> GetCompanys(CompanyStatus comStatus, CompanyType comType, string comName) { return(GetCompanys((int)comStatus, (int)comType, comName)); }