public tb_company ToDbModel(CompanyModel company) { tb_company tbCompany = new tb_company(); tbCompany.ds_name = company.Name; tbCompany.ds_token = company.Token; return tbCompany; }
public CompanyModel ToModel(tb_company tbCompany) { CompanyModel company = new CompanyModel(); company.Id = tbCompany.id_company; company.Name = tbCompany.ds_name; company.Token = tbCompany.ds_token; return company; }
public CompanyModel Add(CompanyModel company) { using (var appontoContext = new AppontoContext()) { tb_company tbCompany = ToDbModel(company); appontoContext.tb_company.Add(tbCompany); appontoContext.SaveChanges(); CompanyModel ret = ToModel(tbCompany); return ret; } }
public async Task <bool> AddCompany(CompanyModel cmp) { try { var httpClient = new HttpClient(); var json = JsonConvert.SerializeObject(cmp); HttpContent httpContent = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = null; response = await httpClient.PostAsync(ConfigurationManager.AppSettings["MySeverUrl"] + "/api/CreateCompany/", httpContent); if (response.IsSuccessStatusCode) { return(true); } else { return(false); } } catch (Exception e) { return(false); } }
// GET: Admin/Companies/Delete/5 public async Task <IActionResult> Delete(int?id) { if (id == null) { return(NotFound()); } Company company = await _context.Companies.FindAsync(id); CompanyModel model = new CompanyModel { Name = company.Name, Id = company.Id, Address = company.Address, Description = company.Address, EndDate = company.EndDate, StartDate = company.StartDate, Fax = company.Fax, PictureId = company.PictureId, Phone = company.Phone, Gsm = company.Gsm, Published = company.Published, VideoEmbedCode = company.VideoEmbedCode, Www = company.Www, StateProvenceId = company.StateProvincesId, CompanyCategoryId = company.CompanyCategoryId }; if (model.Id == 0) { return(NotFound()); } PrepareCompanyList(model.AvailableCatagories, true, "Katgeori Seçiniz"); PrepareStateProvinceList(model.AvailableStateProvince, true, "Şehir Şeçiniz"); return(View(model)); }
public async Task <IActionResult> Create(CompanyModel model) { if (ModelState.IsValid) { Company company = new Company { Name = model.Name, Address = model.Address, Description = model.Description, Fax = model.Fax, Gsm = model.Gsm, Phone = model.Phone, EndDate = model.EndDate, StartDate = model.StartDate, Published = model.Published, VideoEmbedCode = model.VideoEmbedCode, Www = model.Www, PictureId = model.PictureId, CompanyCategoryId = model.CompanyCategoryId, StateProvincesId = model.StateProvenceId }; await _context.AddAsync(company); await _context.SaveChangesAsync(); string seName = _urlRecordService.ValidateSeName(company, model.SeName, model.Name, true); _urlRecordService.SaveSlug(company, seName); _eventPublisher.EntityInserted(company); SuccessNotification("Firma Eklendi."); return(RedirectToAction(nameof(Index))); } return(View(model)); }
protected void AddCompanyButton_Click(object sender, EventArgs e) { try { CompanyModel companymodel = new CompanyModel() { Employer_Name = Employer_NameTextBox.Text, Contact_Number = Convert.ToInt64(Contact_NumberTextBox.Text), Location = LocationTextBox.Text, Website = WebsiteTextBox.Text, }; CompanyAccess companydata = new CompanyAccess(); string SaveComp = companydata.SaveCompany1(companymodel); if (SaveComp.Equals("Success")) { Response.Write("<script>alert('Details have been saved successfully');</script>"); } } catch (Exception ex) { Response.Write("<script>alert(('Please enter the values: '" + ex.Message + ");/script>"); } }
public RequestResult <object> AddCompany(CompanyModel model, PersonModel person = null) { if (person == null) { return(InsUpd(model)); } TransactionOptions scp = new TransactionOptions(); scp.IsolationLevel = IsolationLevel.ReadCommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scp)) { try { var response = InsUpd(model); if (response.Status != Status.Success) { throw new Exception("CompanyServices.AddCompany: Error to register company"); } if (response != null && response.Data != null) { person.CompanyId = ((CompanyModel)response.Data).CompanyId; } PersonServices psrv = new PersonServices(); var p = psrv.insUpdPerson(person); UpdateRolePerson(person.UserId, "RolAdminCompany"); ts.Complete(); return(response); } catch (Exception ex) { ts.Dispose(); throw new Exception("CompanyServices.AddCompany: Error to register company"); } } }
public async Task <ActionResult> Add(CompanyModel model) { try { if (ModelState.IsValid) { Company com = new Company(); com.Name = model.Name; await _context.Companies.AddAsync(com); await _context.SaveChangesAsync(); } else { TempData["message"] = ModelState.ErrorGathering(); } return(RedirectToAction(nameof(Index))); } catch (Exception ex) { TempData["message"] = ex.Message; return(RedirectToAction(nameof(Index))); } }
// POST company/create public long Create(CompanyModel comp) { using (pumoxEntities ent = new pumoxEntities()) { var c = new Company(); c.Name = comp.Name; c.EstabilishmentYear = comp.EstabilishmentYear; comp.Employees = comp.Employees ?? new List <EmployeeModel>(); foreach (var item in comp.Employees) { var emp = new Employee(); emp.Company = c; emp.Firstname = item.FirstName; emp.Lastname = item.LastName; emp.DateOfBirth = item.DateOfBirth; emp.JobTitle = (int?)item.JobTitle; ent.Employee.Add(emp); } ent.Company.Add(c); ent.SaveChanges(); return(c.Id); } }
public async Task <Result> DeleteCompanyAsync(CompanyModel model) { var Company = new Company { CompanyID = model.CompanyID }; using (var dataService = DataServiceFactory.CreateDataService()) { try { await dataService.DeleteCompanyAsync(Company); } catch (DbUpdateException ex) when(ex.InnerException is SqlException sqlException && (sqlException.Number == 547)) { return(Result.Error("Company is already in use")); } catch (Exception ex) { throw ex; } return(Result.Ok()); } }
public void OnInsertOfPositionRecord(PositionModel model) { try { // Update the Companies Rating based on the Position Rating if (model == null) { return; } IEnumerable <PositionModel> positionList = _dbContext.Position.Where(x => x.companyid == model.companyid); int calculatedRating = Convert.ToInt32((positionList.Average(x => x.overallrating) + model.overallrating) / 2); // Get the Company Record CompanyModel companyModel = _dbContext.Company.Where(comp => comp.id == model.companyid).FirstOrDefault(); if (companyModel != null) { companyModel.overallrating = calculatedRating; _dbContext.SaveChanges(); } } catch (Exception ex) { } }
public async Task Read_ValidInput_ReturnsCorrectData(int id) { #region Arrange var dbContext = new ApplicationDbContext(_dbContextOptions); await dbContext.Database.EnsureDeletedAsync(); var company = new Domain.Company { ID = id, Name = "Name", Type = CompanyTypes.Distributor }; dbContext.Companies.Add(company); await dbContext.SaveChangesAsync(); var expectedCompany = new CompanyModel { ID = id, Name = company.Name, Type = company.Type.ToString() }; var appCompany = new Company(dbContext); #endregion #region Act var actualCompany = await appCompany.Read(id); #endregion #region Assert Assert.Equal(expectedCompany.ID, actualCompany.ID); Assert.Equal(expectedCompany.Name, actualCompany.Name); Assert.Equal(expectedCompany.Type, actualCompany.Type); #endregion }
public CompanyModel GetCompanyCode(int employeeid) { var companyModel = new CompanyModel(); var connectionstring = "Data Source=BAIBHAV;Initial Catalog=PioneerConsultancyDatabase;" + " Integrated Security=True"; var mysqlconnection = new SqlConnection(connectionstring); mysqlconnection.Open(); var sqlquery = ("Select * FROM CompanyDetail WHERE EmployeeID=" + employeeid); SqlCommand command; command = new SqlCommand(sqlquery, mysqlconnection); SqlDataReader employeedatareader = command.ExecuteReader(); while (employeedatareader.Read()) { companyModel.EmployerName = employeedatareader.GetString(employeedatareader.GetOrdinal("EmployerName")); companyModel.ContactNumber = employeedatareader.GetString(employeedatareader.GetOrdinal("ContactNumber")); companyModel.Place = employeedatareader.GetString(employeedatareader.GetOrdinal("[Location]")); companyModel.Website = employeedatareader.GetString(employeedatareader.GetOrdinal("Website")); } return(companyModel); }
public ActionResult Edit(int id) { CompanyModel objModel = new CompanyModel(); CompanyService objService = new CompanyService(); List <CompanyModel> lstComp = new List <CompanyModel>(); int uid = 0; int rid = 0; int cid = 0; if (Session["UID"] != null) { uid = Convert.ToInt32(Session["UID"].ToString()); rid = Convert.ToInt32(Session["RoleID"].ToString()); cid = Convert.ToInt32(Session["CompID"].ToString()); } objModel = objService.getByID(id); lstComp = objService.getComp(rid, cid); objModel.ListComp = new List <CompanyModel>(); objModel.ListComp.AddRange(lstComp); List <CompanyModel> lstPComp = new List <CompanyModel>(); lstPComp = objService.getPComp(); objModel.ListPComp = new List <CompanyModel>(); objModel.ListPComp.AddRange(lstPComp); //List<AccountingYearModel> lstAcYr = new List<AccountingYearModel>(); //lstAcYr = objService.getAcYr(); //objModel.ListAcYr = new List<AccountingYearModel>(); //objModel.ListAcYr.AddRange(lstAcYr); ViewBag.Action = "Edit"; return(View("Index", objModel)); }
public Company Build(CompanyModel companyModel) { Company company = new Company { Name = companyModel.Name, OrganisationId = companyModel.OrganisationId, RegisteredName = companyModel.RegisteredName, TradingName = companyModel.TradingName, NatureOfBusiness = companyModel.NatureOfBusiness, CompanyRegistrationNumber = companyModel.CompanyRegistrationNumber, TaxNumber = companyModel.TaxNumber, UifReferenceNumber = companyModel.UifReferenceNumber, PayeReferenceNumber = companyModel.PayeReferenceNumber, UifCompanyReferenceNumber = companyModel.UifCompanyReferenceNumber, SarsUifNumber = companyModel.SarsUifNumber, PaysdlInd = companyModel.PaysdlInd, FaxNumber = companyModel.FaxNumber, EmailAddress = companyModel.EmailAddress, ContactNumber = companyModel.ContactNumber, LogoFileName = companyModel.LogoFileName }; return(company); }
public override async Task OnActionExecutingAsync(HttpActionContext actionContext, CancellationToken cancellationToken) { await base.OnActionExecutingAsync(actionContext, cancellationToken); var model = default(IModel); var attribute = default(Validator); var validator = default(IModelValidatorBase); var result = new ValidationResult(); foreach (var parameter in actionContext.ActionDescriptor.GetParameters().Where(x => x.GetCustomAttributes <object>().OfType <Validator>().Any())) { attribute = parameter.GetCustomAttributes <object>().OfType <Validator>().FirstOrDefault(); if (parameter.ParameterName == "email") { model = new UserModel() { Username = actionContext.ActionArguments[parameter.ParameterName]?.ToString() }; validator = _validatorStore.GetValidator(attribute.Mode, typeof(UserModel)); result = await validator.ValidateAsync((UserModel)model); } else if (parameter.ParameterName == "companyId") { model = new CompanyModel() { Id = (int)actionContext.ActionArguments[parameter.ParameterName] }; validator = _validatorStore.GetValidator(attribute.Mode, typeof(CompanyModel)); result = await validator.ValidateAsync((CompanyModel)model); } if (!result.IsValid) { throw new ApiValidationException(string.Join(Environment.NewLine, result.Errors)); } } }
public ResponseModel InsertCompany([FromBody] CompanyModel companyModel) { TenantCaller newTenantCaller = new TenantCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { ////Get token (Double encrypted) and get the tenant id string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); companyModel.CreatedBy = authenticate.UserMasterID; companyModel.TenantID = authenticate.TenantId; int result = newTenantCaller.InsertCompany(new TenantService(Cache, Db), companyModel); statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
//SQLiteConnection sqlconnection = new SQLiteConnection(@"Data Source=.\Data.db;Initial Catalog=T_Company;Persist Security Info=True;"); //private static string connectionString = "Data Source=222.73.236.182;Initial Catalog=SOHOBuilding_New;uid=sa;pwd=wyl150709"; //SqlConnection sqlconnection = new SqlConnection(connectionString); public ObservableCollection <CompanyModel> GetCompanyList() { ObservableCollection <CompanyModel> list = new ObservableCollection <CompanyModel>(); string buildStr = GetConfigBuild(); ////////////////////////////////////////////////////////////////////////// //Edit by Ron.shen 修改SQL语句,将查出来的公司集合按楼栋和房间名排序后输出 ////////////////////////////////////////////////////////////////////////// // string sql = string.Format("select ID,CompanyName_CN,CompanyName_EN,RoomNum,Building,Introduction,Floor from T_Company {0} ORDER BY Floor,CAST(RoomNum AS int)", buildStr); string sql = string.Format("select ID,CompanyName,EnglishName,RoomNum,BeamNum,CompanyInfo,FloorNum from dt_Company {0} ORDER BY FloorNum,CAST(RoomNum AS int)", buildStr); DataSet ds = SQLiteHelper.Query(sql); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { CompanyModel cm = new CompanyModel(); cm.CompanyID = Int32.Parse(dr["ID"].ToString()); cm.CompanyName_CN = dr["CompanyName"].ToString(); cm.CompanyName_EN = dr["EnglishName"].ToString(); cm.Content = dr["CompanyInfo"].ToString(); //string room = dr["BeamNum"].ToString() + dr["RoomNum"].ToString(); string room = dr["RoomNum"].ToString(); if (room.Contains("F")) { room = dr["BeamNum"].ToString() + dr["FloorNum"].ToString() + dr["RoomNum"].ToString(); } cm.RoomNum = room; list.Add(cm); } } return(list); }
//public void BindCompanyCMB() //{ // this.cmbCompanyName.ItemsSource = _companies; // this.cmbCompanyName.DisplayMemberPath = "Name"; // this.cmbCompanyName.SelectedValue = "Id"; // foreach (var items in _companies) // { // if (items.IsDefault) // { // this.cmbCompanyName.Text = items.Name; // } // } //} public void BindCompanyCMBFiltered() { try { this.cmbCompanyName.ItemsSource = null; CompanyModel obj = new CompanyModel(0, (string)Application.Current.Resources["Combo_Select"]); IList <CompanyModel> companies = controller.GetActiveCompanies().ToList(); companies = companies.Where(item => item.IsActive == true).ToList(); companies.Insert(0, obj); this.cmbCompanyName.ItemsSource = companies; this.cmbCompanyName.DisplayMemberPath = "Name"; this.cmbCompanyName.SelectedValue = "Id"; foreach (var items in companies) { if (items.IsDefault) { this.cmbCompanyName.Text = items.Name; } } } catch (Exception ex) { } }
private void CompanyDetailsSaveButton_Click(object sender, EventArgs e) { CompanyModel companyModel = new CompanyModel() { EmployerName = EmployerNameTextBox.Text, EmployerContactNumber = Convert.ToInt64(EmployerContactNumberTextBox.Text), EmployerAddress = EmployerLocationTextBox.Text, Website = EmployerWebsiteTextBox.Text, EmployeeId = Convert.ToInt32(Employee_CompanyComboBox.Text) }; EmployeeDataAccessLayer EmployeeDAL = new EmployeeDataAccessLayer(); int NoOfRowsAffected = EmployeeDAL.SaveCompanyData(companyModel); if (NoOfRowsAffected > 0) { MessageBox.Show("Succesfully saved Company Detail"); } else { MessageBox.Show("Could Not Save"); } }
static void Main(string[] args) { try { Console.WriteLine("欢迎来到.Net架构班,一起来撸码吧~"); SqlHelper helper = new SqlHelper(); CompanyModel company1 = helper.Find <CompanyModel>(1); CompanyModel company2 = helper.Find <CompanyModel>(2); helper.Insert <CompanyModel>(company1); helper.Insert <CompanyModel>(company2); User user1 = helper.Find <User>(1); User user7 = helper.Find <User>(7); CompanyModel company3 = helper.Find <CompanyModel>(3); CompanyModel company7 = helper.Find <CompanyModel>(7); User user8 = helper.Find <User>(8); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadLine(); }
public ActionResult Company(CompanyModel CompanyModel1) { if (ModelState.IsValid) { Company Company1 = UsersServices1.getCompanyById(CompanyModel1.Id); if (Company1 != null) { UsersServices1.updateCompany(CompanyModel1); } else { CompanyModel1.Id = 0; UsersServices1.insertCompany(CompanyModel1); } } else { ViewData["ModifyCom"] = "ModifyCom"; } IEnumerable <Company> CompanyList1 = UsersServices1.getAllCompany(); ViewData["CompanyList1"] = CompanyList1; return(View(CompanyModel1)); }
//create new project for existing customer public static bool SaveProjectForCompany(ProjectModel projectModel, CompanyModel companyModel) { //setup request RestRequest SaveProjectRequest = new RestRequest("/project", Method.POST) { RequestFormat = DataFormat.Json }; //add parameters SaveProjectRequest.AddParameter("name", projectModel.ProjectName); SaveProjectRequest.AddParameter("notes", projectModel.ProjectNotes); SaveProjectRequest.AddParameter("startDate", projectModel.StartDate); SaveProjectRequest.AddParameter("endDate", projectModel.EndDate); SaveProjectRequest.AddParameter("statusID", 2); SaveProjectRequest.AddParameter("companyID", companyModel.CompanyID); //post project var SaveProjectResponse = RestClient.Execute <ProjectModel>(SaveProjectRequest); if (SaveProjectResponse.StatusCode == CreatedCode) { return(true); } return(false); }
public void ShouldMapUsingModule() { // arrange var model = new CompanyModel { Id = 1, Person = new PersonModel { Name = "Test Name", Active = true } }; Mapper.RegisterModule <CompanyModule>(); // act var result = Mapper.Map <CompanyDto>(model); // assert Assert.Equal(model.Id, result.Id); Assert.Equal("Test", result.CompanyName); Assert.Equal(model.CompanyGuid.ToString(), result.CompanyGuid); Assert.Equal(model.Person.Name, result.PersonName); }
public SalesOrderDetailTempModel FindSalesOrderDetailTempModel(int id, CompanyModel company, bool bCreateEmptyIfNotfound = true) { SalesOrderDetailTempModel model = null; var p = db.FindSalesOrderDetailTemp(id); if (p == null) { if (bCreateEmptyIfNotfound) { model = new SalesOrderDetailTempModel { CompanyId = company.Id, LineStatusId = db.FindSalesOrderHeaderSubStatus(SalesOrderHeaderSubStatus.Unpicked).Id } } ; } else { model = MapToModel(p); } return(model); }
public ActionResult Index() { SystemVariableServices SystemVariableServ = new SystemVariableServices(); UserServices userServ = new UserServices(); var role = userServ.GetRole(new User { UserId = (int)SessionWeb.User.UserId }); CompanyServices CompServ = new CompanyServices(); CompanyModel company = new CompanyModel(); ViewData["isOwner"] = role != null?role.RoleId.ToString().Equals(SystemVariableServ.GetSystemVariableValue("RolAdminCompany")) : false; ViewData["invitations"] = UserPerson.InvitationsCompanies; if (HasCompany()) { company = CompServ.Get(new CompanyModel() { CompanyId = UserCompanyId }).FirstOrDefault(); } return(View(company)); }
public List <CompanyModel> getCompany() { try { DBResource newConnection = new DBResource(); List <CompanyModel> listModel = new List <CompanyModel>(); CompanyModel CompanyModel; using (SqlConnection myConnection = new SqlConnection(newConnection.connectionString.ToString())) { string query = "dbo.GetCompany"; SqlCommand cmd = new SqlCommand(query, myConnection); myConnection.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { CompanyModel = new CompanyModel(); CompanyModel.CompanyID = Convert.ToInt32(dr["company_id"]); CompanyModel.Company = dr["company"].ToString(); listModel.Add(CompanyModel); } myConnection.Close(); } } return(listModel); } catch (Exception ex) { throw ex; } }
private Error createRevisedPurchaseOrder(int pohId, CompanyModel company, UserModel sender, string subject) { var error = new Error(); var poh = db.FindPurchaseOrderHeader(pohId); string pdfFile = ""; error = CreatePurchaseOrderPdf(poh, company.POSupplierTemplateId, //DocumentTemplateType.PurchaseOrder, null, ref pdfFile); if (!error.IsError) { NoteService.NoteService noteService = new NoteService.NoteService(db); error = noteService.AttachNoteToPurchaseOrder(poh, sender, subject, "", pdfFile.ToStringList(), FileCopyType.Copy); } return(error); }
public virtual IActionResult Create(CompanyModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCategories)) { return(AccessDeniedView()); } if (ModelState.IsValid) { var company = model.ToEntity <Company>(); company.CreatedOnUtc = DateTime.UtcNow; company.UpdatedOnUtc = DateTime.UtcNow; _companyService.InsertCompany(company); //_categoryService.UpdateCategory(category); //activity log _customerActivityService.InsertActivity("AddNewCompany", string.Format(_localizationService.GetResource("ActivityLog.AddNewCompany"), company.Name), company); _notificationService.SuccessNotification(_localizationService.GetResource("Admin.Catalog.Companies.Added")); if (!continueEditing) { return(RedirectToAction("List")); } return(RedirectToAction("Edit", new { id = company.Id })); } //prepare model model = _companyModelFactory.PrepareCompanyModel(model, null, true); //if we got this far, something failed, redisplay form return(View(model)); }
// GET: Company public ActionResult Index(string id) { if (id == null) { ViewBag.Title = "No details found"; return(RedirectToActionPermanent("Index", "Explore", new object { })); } else { //Retrieve the Company from Database CompanyModel getCompany = null; using (ExploreDbContext context = new ExploreDbContext()) { getCompany = context.Company.Where(x => x.id.Equals(id)).FirstOrDefault(); //Get the Relevant Job Positions IList <PositionModel> companyPositions = context.Position.Where(x => x.companyid == id).ToList(); getCompany.Positions = companyPositions != null ? companyPositions : new List <PositionModel>(); } return(View(getCompany)); } }
public CompanyViewModel() { try { SelectedCompany = new CompanyModel(); if (App.Current.Properties["EditCompany"] == "CompanyEdit") { CreatVisible = "Collapsed"; UpdVisible = "Visible"; int cID = Convert.ToInt32(App.Current.Properties["Company_Id"]); EditComapny(cID); SelectedCompany = App.Current.Properties["EditComapnyS"] as CompanyModel; } else { CreatVisible = "Visible"; UpdVisible = "Collapsed"; OprModel = _CompanyModel; GetCompany(); if (data.Length > 0) { // Main mn = new Main(); //mn.Show(); // this.Close(); // Close(); } else { InsertCompany = new DelegateCommand(Insert_Company); } } } catch (Exception ex) { } }
// method converts Company into CompanyModel for both Update and Add methods public static Company ToCompany(this CompanyModel company, CompanyAction action) { Company convertedCompany; if (action == CompanyAction.Add) { convertedCompany = new Company(); } else { convertedCompany = MvcApplication.CompanyBusinessLogic.GetById(company.Id); } convertedCompany.Name = company.Name; convertedCompany.AnnualEarnings = company.Earnings; convertedCompany.CompanyType = MvcApplication.CompanyBusinessLogic.GetCompanyType(company.Type); if (company.ParentCompanyId != null) { convertedCompany.ParentCompany = MvcApplication.CompanyBusinessLogic.GetParentCompany(company.ParentCompanyId); } return(convertedCompany); }
public override CompanyModel[] GetEgality(bool bj_child, bool bj_father, bool bj_branch, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (base.Grade >= 0) { builder.Append(" where Grade='" + base.Grade + "'"); } else { if (base.pk_corp == "") { throw new Exception("条件不足."); } builder.Append(" where Grade=(select Grade from DB_Company where pk_corp='" + base.pk_corp + "')"); } builder.Append(" order by pk_corp"); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count <= 0) { return null; } CompanyModel[] modelArray = new CompanyModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new CompanyModel(); modelArray[i] = this.Getcm(set.Tables[0].Rows[i], bj_child, bj_father, bj_branch, dbo); } return modelArray; }
public bool checkCompany(string strWhere) { this.cm = new CompanyDal(); this.dbo = new DB_OPT(); return (this.cm.GetList(strWhere, this.dbo).Tables[0].Rows.Count > 0); }
private Dictionary<int, CompanyModel> GetSqlcCompany(DataTable table) { Dictionary<int, CompanyModel> dic = new Dictionary<int, CompanyModel>(); foreach (DataRow dr in table.Rows) { CompanyModel compnaymodel = new CompanyModel(); compnaymodel.CompanyName_CN = dr["CompanyName"].ToString(); compnaymodel.CompanyName_EN = dr["EnglishName"].ToString(); compnaymodel.CompanyID = Int32.Parse(dr["ID"].ToString()); compnaymodel.CompanyFloor = dr["FloorNum"].ToString(); compnaymodel.CompanyContent = dr["CompanyInfo"].ToString(); compnaymodel.CompanyBuild = dr["BeamNum"].ToString(); compnaymodel.CompanySearch = dr["Pingying"].ToString(); compnaymodel.CompanyRoomNum = dr["RoomNum"].ToString(); compnaymodel.CompnayUpdateTime = ((DateTime)dr["Update_Time"]).ToString("yyyy/MM/dd HH:mm:ss.fff "); dic.Add(Int32.Parse(dr["Id"].ToString()), compnaymodel); } return dic; }
public override CompanyModel[] GetChilds(string parentpk, bool bj_branch, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (parentpk != "") { builder.Append(" where FatherPK='" + parentpk + "' and FatherPK!=PK_CORP"); } builder.Append(" order by pk_corp"); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count <= 0) { return null; } CompanyModel[] modelArray = new CompanyModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new CompanyModel(); modelArray[i] = this.Getcm(set.Tables[0].Rows[i], true, false, bj_branch, dbo); } return modelArray; }
public override CompanyModel[] GetParents(bool bj_branch, DB_OPT dbo) { string[] strArray; string str; int num; StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (base.PKPath != "") { strArray = base.PKPath.Split(new char[] { '|' }); str = ""; for (num = 0; num < strArray.Length; num++) { str = str + "'" + strArray[num] + "',"; } str = str.Substring(0, str.Length - 1); builder.Append(" where pk_corp in (" + str + ")"); } else { if (!(base.pk_corp != "")) { throw new Exception("条件不足."); } string strSql = "select PKPath from DB_Company where pk_corp='" + base.pk_corp + "'"; DataSet set = dbo.BackDataSet(strSql, null); if (!(set.Tables[0].Rows[0][0].ToString() != "")) { throw new Exception("没有上级."); } strArray = set.Tables[0].Rows[0][0].ToString().Split(new char[] { '|' }); str = ""; for (num = 0; num < strArray.Length; num++) { str = str + "'" + strArray[num] + "',"; } builder.Append(" where pk_corp in (" + str.Substring(0, str.Length - 1) + ")"); } builder.Append(" order by pk_corp"); DataSet set2 = dbo.BackDataSet(builder.ToString(), null); if (set2.Tables[0].Rows.Count <= 0) { return null; } CompanyModel[] modelArray = new CompanyModel[set2.Tables[0].Rows.Count]; for (num = 0; num < set2.Tables[0].Rows.Count; num++) { modelArray[num] = new CompanyModel(); modelArray[num] = this.Getcm(set2.Tables[0].Rows[num], false, true, bj_branch, dbo); } return modelArray; }
public override CompanyModel[] GetModels(string strwhere, bool bj_child, bool bj_father, bool bj_branch, DB_OPT dbo) { CompanyModel[] modelArray = null; StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (strwhere.Trim() != "") { builder.Append(" where " + strwhere); } builder.Append(" order by pk_corp"); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count > 0) { modelArray = new CompanyModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new CompanyModel(); modelArray[i] = this.Getcm(set.Tables[0].Rows[i], bj_child, bj_father, bj_branch, dbo); } } return modelArray; }
private DbParameter[] ExecutionSelectCompany(CompanyModel DataPar) { DbParameter[] sqliteparList = new DbParameter[9]; sqliteparList[0] = Db_Sqlite.CreateDbParameter("@UpdateTime", DataPar.CompnayUpdateTime); sqliteparList[1] = Db_Sqlite.CreateDbParameter("@Id", DataPar.CompanyID); sqliteparList[2] = Db_Sqlite.CreateDbParameter("@CompanyName_EN", DataPar.CompanyName_EN); sqliteparList[3] = Db_Sqlite.CreateDbParameter("@RoomNum", DataPar.CompanyRoomNum); sqliteparList[4] = Db_Sqlite.CreateDbParameter("@CompanyName_CN", DataPar.CompanyName_CN); sqliteparList[5] = Db_Sqlite.CreateDbParameter("@Floor", DataPar.CompanyFloor); sqliteparList[6] = Db_Sqlite.CreateDbParameter("@Introduction", DataPar.CompanyContent); sqliteparList[7] = Db_Sqlite.CreateDbParameter("@Building", DataPar.CompanyBuild); sqliteparList[8] = Db_Sqlite.CreateDbParameter("@SearchLetter", DataPar.CompanySearch); return sqliteparList; }
public ActionResult AddOrUpdate(CompanyModel model) { var compObj = Mapper.Map<CompanyModel, Company>(model); _repository.Update(compObj); _repository.Save(); return null; }
private void DataDelete(string strPK) { try { this.mm = new CompanyDal(); this.dbo = new DB_OPT(); this.dbo.Open(); this.mm.pk_corp = strPK.Trim(); if (this.mm.Delete(this.dbo) > 0) { if (this.Master.PageIndex > 1) { this.pageind = this.Master.PageIndex; } this.ShowData(this.Master.StrSelect); } } catch (Exception exception) { this.el = new ExceptionLog.ExceptionLog(); this.el.ErrClassName = base.GetType().ToString(); this.el.ErrMessage = exception.Message.ToString(); this.el.ErrMethod = "DataDelete()"; this.el.WriteExceptionLog(true); Const.OpenErrorPage("操作失败,请联系系统管理员!", this.Page); } finally { if (this.dbo != null) { this.dbo.Close(); } } }
public AXACompanyController(IUnityContainer container, IdPayloadManager idManager, ApplicationModel applicationModel, IInsuranceDirectoryServiceHandler insuranceDirectoryService, CompanyModel createCompanyModel, IdRetrievalManager retrievalManager, AppModel appModel, IInsuranceDirectoryViewResolver viewresolver, IShellRulesHelper rulesHelper, IMetadataClientService metadataService) : base(idManager, applicationModel, insuranceDirectoryService, createCompanyModel, retrievalManager, appModel, viewresolver, rulesHelper, container, metadataService, null) { }