コード例 #1
0
        public int SaveCompany(CompanyDetailsModel company)
        {
            int result = 0;

            try
            {
                string        connectionstring = "Data Source=RAKI;Initial Catalog=PioneerEmployeeDB;" + "Integrated Security=True";
                SqlConnection mysqlconnection  = new SqlConnection(connectionstring);
                mysqlconnection.Open();
                string     sqlcompanydetails = @"INSERT INTO Company_Details(Employer_Name,Contact_Number,Location,Website)VALUES('" + company.Employer_Name + "'," + "" + company.Contact_Number + "," + "'" + company.Location + "'," + "'" + company.Website + "')";
                SqlCommand command;
                command = new SqlCommand(sqlcompanydetails, mysqlconnection);
                result  = command.ExecuteNonQuery();
                if (result > 0)
                {
                    MessageBox.Show("Details have been saved Successfully:");
                }
                mysqlconnection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has been occured, please contact the administartor: " + ex.Message);
            }
            return(result);
        }
コード例 #2
0
        public string EditCompany(CompanyDetailsModel companydetails)
        {
            int result = 0;

            try
            {
                sqlConnection          = OpenConnection();
                sqlCommand             = new SqlCommand();
                sqlCommand.Connection  = sqlConnection;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.CommandText = "uspEditCompanyDetails";
                sqlCommand.Parameters.Add("@EmployeeID", SqlDbType.Int).Value         = companydetails.EmployeeID.ToString();
                sqlCommand.Parameters.Add("@Employer_Name", SqlDbType.VarChar).Value  = companydetails.Employer_Name;
                sqlCommand.Parameters.Add("@Contact_Number", SqlDbType.VarChar).Value = companydetails.Contact_Number;
                sqlCommand.Parameters.Add("@Location", SqlDbType.VarChar).Value       = companydetails.Location;
                sqlCommand.Parameters.Add("@Website", SqlDbType.VarChar).Value        = companydetails.Website;
                result = sqlCommand.ExecuteNonQuery();
                if (result > 0)
                {
                    return("success");
                }
                return("failed");
            }
            catch (Exception ex)
            {
                return("An error has been occured, please contact administrator:" + ex.Message);
            }
            finally
            {
                CloseConncetion(sqlConnection);
            }
        }
コード例 #3
0
        private void Savebutton3_Click(object sender, EventArgs e)
        {
            try
            {
                CompanyDetailsModel com = new CompanyDetailsModel();
                com.EmployeeID    = Convert.ToInt32(employeeidtextbox10.Text);
                com.Employeename  = Employeenametextbox.Text;
                com.Contactnumber = Convert.ToInt64(contactnumbertextbox.Text);
                com.Location      = LocationtextBox.Text;
                com.Website       = Websitetextbox.Text;
                EmployeeDataAcessLayer objcompanydetails = new EmployeeDataAcessLayer();
                objcompanydetails.SaveCompany(com);

                /*string connectionstring = @"Data Source=DINESH-COMPUTER\MYSQL;Initial Catalog = pioneerdb;" +
                 *  "Integrated Security=True";
                 * SqlConnection mysqlconnection = new SqlConnection(connectionstring);
                 * mysqlconnection.Open();
                 * string COMMAND = "INSERT INTO COMPANY_DETAILS(EmployeeID,Employeename,contactnumber,Location,Website)VALUES("+EmployeeID+","+"'"+Employeename+"',"+Contactnumber+","+"'"+Location+"',"+"'"+Website+"')";
                 * SqlCommand cmd = new SqlCommand(COMMAND, mysqlconnection);
                 * cmd.ExecuteNonQuery();
                 * mysqlconnection.Close();*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        protected void Save_Click(object sender, EventArgs e)
        {
            CompanyDetailsModel companyDetailobj = new CompanyDetailsModel
            {
                EmployerName  = EmployerNameTextBox.Text,
                ContactNumber = Convert.ToInt64(ContactNumberTextBox.Text),
                Location      = LocationTextBox.Text,
                Website       = WebsiteTextBox.Text,
                EmployeeId    = Convert.ToInt32(EmployeeIDTextBox.Text)
            };

            EmployeeDataAccessLayer companyDataAccessobj = new EmployeeDataAccessLayer();
            long RowsAffected = companyDataAccessobj.CompanySqlConnection(companyDetailobj);

            if (RowsAffected > 0)
            {
                string display = "Successful!";
                ClientScript.RegisterStartupScript(this.GetType(), "Operation was", "alert('" + display + "');", true);
            }
            else
            {
                string display = "UnSuccessful!";
                ClientScript.RegisterStartupScript(this.GetType(), "Operation was", "alert('" + display + "');", true);
            }
        }
コード例 #5
0
        public ActionResult Details(int id)
        {
            var company = companyRepository.Get(id);
            var model   = new CompanyDetailsModel()
            {
                Id          = company.Id,
                Name        = company.Name,
                FantasyName = company.FantasyName,
                Register    = company.Register,
                Incomes     = new List <Income>()
                {
                    new Income()
                    {
                        Title = "Projeto xpto", Amount = 400m, Date = new DateTime(2015, 03, 27)
                    },
                    new Income()
                    {
                        Title = "Projeto z", Amount = 600m, Date = new DateTime(2016, 03, 27)
                    },
                    new Income()
                    {
                        Title = "Investimento", Amount = 1000m, Date = new DateTime(2017, 03, 27)
                    }
                },
                Projects = new List <Project>(),
                Costs    = new List <Cost>()
            };

            return(View(model));
        }
        protected void EditButton_Click(object sender, EventArgs e)
        {
            CompanyDetailsModel model = new CompanyDetailsModel
            {
                EmployerName  = EmployerNameTextBox.Text,
                ContactNumber = Convert.ToInt32(ContactNumberTextBox.Text),
                Location      = LocationTextBox.Text,
                Website       = WebsiteTextBox.Text,
                EmployeeId    = Convert.ToInt32(EmployeeIDTextBox.Text)
            };

            //int Edit_CompanyId = Convert.ToInt32(EmployeeIDDropDownList.Text);
            SqlConnection mysqlconnection = new SqlConnection();

            mysqlconnection.ConnectionString = "Data Source = DESKTOP-6T65F42;" +
                                               "database = PioneerTechConsultancy_Database;Integrated security = SSPI";

            SqlCommand companyDetail_cmd = new SqlCommand("UPDATE [CompanyDetail] SET[EmployerName] = " +
                                                          "'" + model.EmployerName + "',[ContactNumber] = " + model.ContactNumber + ",[Location] = '" + model.Location + "',[Website] =' " + model.Website +
                                                          "',[EmployeeID] = " + model.EmployeeId + "WHERE CompanyID = " + DropDownList1.Text, mysqlconnection);

            mysqlconnection.Open();

            int result = companyDetail_cmd.ExecuteNonQuery();

            ClientScript.RegisterStartupScript(this.GetType(), "Operation was", "alert(' Company Details SUCCESSFULLY Edited');", true);
        }
コード例 #7
0
        public ActionResult Edit(int id)
        {
            CompanyDetailsModel cmmod     = new CompanyDetailsModel();
            DataTable           dbcompany = new DataTable();

            using (SqlConnection sqlcon = new SqlConnection(connectionstring))
            {
                sqlcon.Open();
                string         editquery = "SELECT * FROM Company_Details WHERE EmployeeID=@EmployeeID";
                SqlDataAdapter sqladp    = new SqlDataAdapter(editquery, sqlcon);
                sqladp.SelectCommand.Parameters.AddWithValue("@EmployeeID", id);
                sqladp.Fill(dbcompany);
            }
            if (dbcompany.Rows.Count == 1)
            {
                cmmod.EmployeeID     = Convert.ToInt32(dbcompany.Rows[0][0].ToString());
                cmmod.Employer_Name  = dbcompany.Rows[0][1].ToString();
                cmmod.Contact_Number = dbcompany.Rows[0][2].ToString();
                cmmod.Location       = dbcompany.Rows[0][3].ToString();
                cmmod.Website        = dbcompany.Rows[0][4].ToString();
                return(View(cmmod));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
コード例 #8
0
        public async Task <List <CompanyDetailsModel> > GetCompanyDetails()
        {
            List <CompanyDetailsModel> companyDetails = new List <CompanyDetailsModel>();
            var result = await _companyManagementRepository.GetCompanyDetails();

            var statusCode = await _companyManagementRepository.GetStatusCode();

            var DataSets = (from r in result
                            join
                            s in statusCode on r.StatusId equals s.StatusId
                            select new {
                r.Address, r.City, r.CompanyId, r.CompanyName, r.State, r.StatusId, s.StatusDescription
            }).ToList();

            if (DataSets != null)
            {
                DataSets.ForEach(res =>
                {
                    CompanyDetailsModel mapped = new CompanyDetailsModel();
                    mapped.CompanyId           = res.CompanyId;
                    mapped.CompanyName         = res.CompanyName;
                    mapped.City              = res.City;
                    mapped.Address           = res.Address;
                    mapped.StatusId          = res.StatusId;
                    mapped.StatusDescription = res.StatusDescription;
                    mapped.State             = res.State;


                    companyDetails.Add(mapped);
                });
                return(companyDetails);
            }
            return(null);
        }
コード例 #9
0
        private CompanyDetailsModel GetCompanyDetails(int companyId)
        {
            var model = new CompanyDetailsModel();

            model.Company   = CompanyFacade.GetCompanyById(companyId);
            model.Discounts = CompanyFacade.ListDiscountsOfCompany(null, companyId);
            return(model);
        }
        public ActionResult Details(CompanyDetailsModel searchCompanyModel, int id)
        {
            var company = ServiceLocator.Resolve<CompanyDetailsModel2Entity>().Run(searchCompanyModel, id);
            _companyRepo.Update(company);

            searchCompanyModel.Message = new SuccessMessage("\""+ company.Name +"\" wurde gespeichert");

            return View(searchCompanyModel);
        }
コード例 #11
0
        protected void EmployeeIDDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            CompanyDetailsModel companymodel  = new CompanyDetailsModel();
            CompanyDataAccess   companyaccess = new CompanyDataAccess();

            companymodel = companyaccess.GetCompanyDetails(Convert.ToInt32(EmployeeIDDropDownList.SelectedValue));
            Employer_NameTextBox.Text  = companymodel.Employer_Name;
            Contact_NumberTextBox.Text = companymodel.Contact_Number;
            LocationTextBox.Text       = companymodel.Location;
            WebsiteTextBox.Text        = companymodel.Website;
        }
コード例 #12
0
        public CompanyDetailsModel GetCompanyName()
        {
            var companyDetailsModel = new CompanyDetailsModel
            {
                CompanyName = "Sandwich Factory",
                CompanyMoto = "Socialization and food is pretty much inseparable",
                StartDate   = DateTime.Now
            };

            return(companyDetailsModel);
        }
コード例 #13
0
        public Response <CompanyDetailsModel> GetCompanyByID(long companyID)
        {
            var companyResponse = new Response <CompanyDetailsModel>()
            {
                DataItems  = new List <CompanyDetailsModel>(),
                ResultCode = 0
            };

            var companyDetails = new CompanyDetailsModel();

            var company = _organizationStructureDataProvider.GetOrganizationStructureByID(companyID);

            if (company.ResultCode != 0)
            {
                companyResponse.ResultCode    = company.ResultCode;
                companyResponse.ResultMessage = company.ResultMessage;
                return(companyResponse);
            }
            else
            {
                companyDetails.Company = company.DataItems.FirstOrDefault();
            }

            var organizationIdentifiers = _organizationIdentifiersDataProvider.GetOrganizationIdentifiersByID(companyID, OrganizationType.Company.ToString());

            if (organizationIdentifiers.ResultCode != 0)
            {
                companyResponse.ResultCode    = organizationIdentifiers.ResultCode;
                companyResponse.ResultMessage = organizationIdentifiers.ResultMessage;
                return(companyResponse);
            }
            else
            {
                companyDetails.CompanyIdentifiers = organizationIdentifiers.DataItems;
            }

            var companyAddresses = _organizationStructureDataProvider.GetOrganizationAddressByID(companyID);

            if (companyAddresses.ResultCode != 0)
            {
                companyResponse.ResultCode    = companyAddresses.ResultCode;
                companyResponse.ResultMessage = companyAddresses.ResultMessage;
                return(companyResponse);
            }
            else
            {
                companyDetails.Addresses = companyAddresses.DataItems;
            }

            companyResponse.DataItems.Add(companyDetails);
            return(companyResponse);
        }
コード例 #14
0
        protected void CompanyDetails_AddCompanyButtonID_Click(object sender, EventArgs e)
        {
            CompanyDetailsModel comp_details = new CompanyDetailsModel
            {
                EmployeeName    = CompanyNameTextBox.Text,
                Contact         = Convert.ToInt64(CompanyContactTextBox.Text),
                CompanyLocation = CompanyLocationTextBox.Text,
                CompanyWebsite  = CompanyWebSiteTextBox.Text,
                EmployeeID      = Convert.ToInt16(CompanyEmployeeIDTextBox.Text)
            };
            EmployeeDataAccessLayer employeeDataAccessLayer = new EmployeeDataAccessLayer();

            employeeDataAccessLayer.UpdateToCompanyDetails(comp_details);
        }
    public Company Run(CompanyDetailsModel companyDetailsModel, int companyId)
    {
        var company = _companyRepository.GetById(companyId);
        company.Name = companyDetailsModel.CompanyName;
        company.Industry = companyDetailsModel.Industry;
        company.Size = companyDetailsModel.Size;
        company.Url = companyDetailsModel.Url;
        company.Location = companyDetailsModel.Location;
        company.ZipCode = companyDetailsModel.ZipCode;
        company.Email = companyDetailsModel.Email;
        company.WelfareBalanceFor2012 = companyDetailsModel.WelfareBalanceFor2012;

        return company;
    }
コード例 #16
0
        public long CompanySqlConnection(CompanyDetailsModel CompanyDetailsmodel)
        {
            SqlConnection mysqlconnection = new SqlConnection();

            mysqlconnection.ConnectionString = "Data Source = DESKTOP-6T65F42;" +
                                               "database = PioneerTechConsultancy_Database;Integrated security = SSPI";

            mysqlconnection.Open();
            SqlCommand CompanyDetailCommand = new SqlCommand("INSERT INTO CompanyDetail VALUES(" +
                                                             "'" + CompanyDetailsmodel.EmployerName + "'," + CompanyDetailsmodel.ContactNumber + ",'" + CompanyDetailsmodel.Location + "','" + CompanyDetailsmodel.Website + "'," + CompanyDetailsmodel.EmployeeId + ")", mysqlconnection);
            long CompanyConnection = CompanyDetailCommand.ExecuteNonQuery();

            mysqlconnection.Close();
            return(CompanyConnection);
        }
コード例 #17
0
 public ActionResult Create(CompanyDetailsModel cmpmodel)
 {
     using (SqlConnection sqlcon = new SqlConnection(connectionstring))
     {
         sqlcon.Open();
         string     query = "INSERT INTO Company_Details VALUES(@Employer_Name,@Contact_Number,@Location,@Website)";
         SqlCommand cmd   = new SqlCommand(query, sqlcon);
         cmd.Parameters.AddWithValue("@Employer_Name", cmpmodel.Employer_Name);
         cmd.Parameters.AddWithValue("@Contact_Number", cmpmodel.Contact_Number);
         cmd.Parameters.AddWithValue("@Location", cmpmodel.Location);
         cmd.Parameters.AddWithValue("@Website", cmpmodel.Website);
         cmd.ExecuteNonQuery();
     }
     return(RedirectToAction("Index"));
 }
コード例 #18
0
        public int AddtoCompanyDetails(CompanyDetailsModel comp_details)
        {
            sqlConnection = OpenConnection();
            sqlConnection.Open();
            sqlCommand = new SqlCommand("INSERT INTO [Company Details] VALUES(" +
                                        "'" + comp_details.EmployeeName + "','" + comp_details.Contact + "','" + comp_details.CompanyLocation + "','" +
                                        comp_details.CompanyWebsite + "'," + comp_details.EmployeeID + ")", sqlConnection);



            int result = sqlCommand.ExecuteNonQuery();

            sqlConnection.Close();
            return(result);
        }
コード例 #19
0
        public ActionResult Details(int id)
        {
            CompanyDetailsModel model   = new CompanyDetailsModel();
            Company             company = ContextManager.GetCompanyById(id);

            model.Id          = company.Id;
            model.CompanyId   = company.CompanyId;
            model.Name        = company.Name;
            model.OwnerId     = company.OwnerId;
            model.Budget      = company.Budget;
            model.AddressLine = company.AddressLine;

            model.Employees = ContextManager.GetAllCompanyEmployees(model.Id);

            return(View(model));
        }
コード例 #20
0
 public ActionResult Edit(CompanyDetailsModel cmpmodel)
 {
     using (SqlConnection sqlcon = new SqlConnection(connectionstring))
     {
         sqlcon.Open();
         string     edquery = "UPDATE Company_Details SET Employer_Name=@Employer_Name,Contact_Number=@Contact_Number,Location=@Location,Website=@Website WHERE EmployeeID=@EmployeeID";
         SqlCommand cmd     = new SqlCommand(edquery, sqlcon);
         cmd.Parameters.AddWithValue("@EmployeeID", cmpmodel.EmployeeID);
         cmd.Parameters.AddWithValue("@Employer_Name", cmpmodel.Employer_Name);
         cmd.Parameters.AddWithValue("@Contact_Number", cmpmodel.Contact_Number);
         cmd.Parameters.AddWithValue("@Location", cmpmodel.Location);
         cmd.Parameters.AddWithValue("@Website", cmpmodel.Website);
         cmd.ExecuteNonQuery();
     }
     return(RedirectToAction("Index"));
 }
コード例 #21
0
        public async Task <IActionResult> Edit(CompanyDetailsModel model)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(model.Id));
            }

            var result = await this.companies.EditAsync(model.Id, model.Name, model.Bulstat, model.AccountablePerson, model.Address);

            if (!result)
            {
                return(BadRequest());
            }

            TempData.AddSuccessMessage("Компанията беше редактирана успешно!");
            return(Redirect("/Companies/Index"));
        }
コード例 #22
0
 public void SaveCompany(CompanyDetailsModel com)
 {
     try
     {
         string connectionstring = @"Data Source=DINESH-COMPUTER\MYSQL;Initial Catalog = pioneerdb;" +
                                   "Integrated Security=True";
         SqlConnection mysqlconnection = new SqlConnection(connectionstring);
         mysqlconnection.Open();
         string     COMMAND = "INSERT INTO COMPANY_DETAILS(EmployeeID,Employeename,contactnumber,Location,Website)VALUES(" + com.EmployeeID + "," + "'" + com.Employeename + "'," + com.Contactnumber + "," + "'" + com.Location + "'," + "'" + com.Website + "')";
         SqlCommand cmd     = new SqlCommand(COMMAND, mysqlconnection);
         cmd.ExecuteNonQuery();
         mysqlconnection.Close();
     }
     finally
     {
     }
 }
        public async Task OnGet_GoodTempData_GoodContext_ReturnsResult()
        {
            var portFreightUser = new PortFreightUser
            {
                Id       = "1",
                Email    = "*****@*****.**",
                SenderId = "DFT007"
            };

            actualUserContext.Users.Add(portFreightUser);
            await actualUserContext.SaveChangesAsync();

            var senderType = new List <SenderType>()
            {
                new SenderType {
                    SenderId = "DFT007", IsAgent = true, IsLine = false, IsPort = true
                }
            };

            actualContext.SenderType.AddRange(senderType);
            await actualContext.SaveChangesAsync();

            MSD1 Msd1 = new MSD1();

            tempData["MSD1Key"] = JsonConvert.SerializeObject(Msd1);

            pageModel = new CompanyDetailsModel(actualContext, CommonFunction, mockUserManager.Object)
            {
                PageContext = pageContext,
                TempData    = tempData,
                Url         = new UrlHelper(actionContext)
            };

            mockUserManager.Setup(p => p.GetUserAsync(httpContext.User)).ReturnsAsync(portFreightUsers.FirstOrDefault(x => x.Id == "1"));

            var result = await pageModel.OnGetAsync();

            Assert.IsNotNull(result);
            Assert.IsNotNull(pageModel.AgentSenders);
            Assert.IsNotNull(pageModel.LineSenders);
            Assert.IsNotNull(pageModel.Input.AgentSenderId);
            Assert.IsNull(pageModel.Input.LineSenderId == "" ? null : pageModel.Input.LineSenderId);
            Assert.IsNotNull(pageModel.User);
            Assert.AreEqual(pageModel.loggedInUser.Email, portFreightUser.Email);
        }
コード例 #24
0
 private void button9_Click(object sender, EventArgs e)
 {
     try
     {
         CompanyDetailsModel com = new CompanyDetailsModel()
         {
             Employer_Name  = Employertextbox.Text,
             Contact_Number = Convert.ToInt64(ContactNumbertextbox.Text),
             Location       = Locationtextbox.Text,
             Website        = Websitetextbox.Text,
         };
         CompanyDataAccess company = new CompanyDataAccess();
         company.SaveCompany(com);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please enter the values:");
     }
 }
コード例 #25
0
 public IHttpActionResult CompanyRegistration(CompanyDetailsModel companydetail)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var companyexs = db.CompanyDetails.Where(s => s.CompanyName.ToLower() == companydetail.CompanyName.ToLower()).FirstOrDefault();
             if (companyexs == null)
             {
                 var company = new CompanyDetail();
                 company.CompanyName    = companydetail.CompanyName;
                 company.Address        = companydetail.Address;
                 company.City           = companydetail.City;
                 company.StateName      = companydetail.StateName;
                 company.PostalCode     = companydetail.PostalCode;
                 company.Phone          = companydetail.Phone;
                 company.Website        = companydetail.Website;
                 company.ContactName    = companydetail.ContactName;
                 company.Title          = companydetail.Title;
                 company.EmailAddress   = companydetail.EmailAddress;
                 company.PhoneNumber    = companydetail.PhoneNumber;
                 company.SiteInfo       = companydetail.SiteInfo;
                 company.SiteName       = companydetail.SiteName;
                 company.OrganizationId = companydetail.OrganizationId;
                 db.CompanyDetails.Add(company);
                 db.SaveChanges();
                 return(Ok(company));
             }
             else
             {
                 return(Ok("Company Name Already Taken."));
             }
         }
         else
         {
             return(Ok("Need to Fill All the Field Except CompanyId "));
         }
     }
     catch (Exception ex)
     {
         return(Ok("" + ex.Message + ""));
     }
 }
        public async Task OnPost_ModelStateInvalid_ReturnsPageResult()
        {
            var portFreightUser = new PortFreightUser
            {
                Id       = "1",
                Email    = "*****@*****.**",
                SenderId = "DFT007"
            };

            actualUserContext.Users.Add(portFreightUser);
            await actualUserContext.SaveChangesAsync();

            var senderType = new List <SenderType>()
            {
                new SenderType {
                    SenderId = "DFT007", IsAgent = true, IsLine = false, IsPort = true
                }
            };

            actualContext.SenderType.AddRange(senderType);
            actualContext.SaveChanges();

            MSD1 Msd1 = new MSD1();

            tempData["MSD1Key"] = JsonConvert.SerializeObject(Msd1);

            pageModel = new CompanyDetailsModel(actualContext, CommonFunction, mockUserManager.Object)
            {
                PageContext = pageContext,
                TempData    = tempData,
                Url         = new UrlHelper(actionContext)
            };

            mockUserManager.Setup(p => p.GetUserAsync(httpContext.User)).ReturnsAsync(portFreightUsers.FirstOrDefault(x => x.Id == "1"));

            pageModel.ModelState.AddModelError("LineSenderId", "Line's Sender Id is required.");
            var result = pageModel.OnPost();

            Assert.IsNotNull(result);
            Assert.IsNull(pageModel.Input.LineSenderId == "" ? null : pageModel.Input.LineSenderId);
            Assert.IsInstanceOfType(result, typeof(PageResult));
        }
コード例 #27
0
        public async Task <CompanyDetailModel> UpdateStatus(CompanyDetailsModel companyDetails)
        {
            var  mappedObject = _mapper.Map <CompanyDetails>(companyDetails);
            bool result       = await _companyManagementRepository.UpdateStatus(mappedObject);

            if (result)
            {
                var company = await CompanyDetailById(companyDetails.CompanyId);

                //  return result != null ? result : null;
                if (company != null)
                {
                    return(company);
                }
                return(null);
            }
            else
            {
                return(null);
            }
        }
コード例 #28
0
        private CompanyDetailsModel CreateCompanyModel(object company)
        {
            var model = new CompanyDetailsModel()
            {
                Location = new Location {
                    Country = "NL"
                },
                Risks = new Risks
                {
                    CorruptionIndexScore         = "54",
                    CorruptionIndexScore_Flagged = true,
                    COVID_19_Flagged             = true,
                    COVID_19_riskscore           = "19%",
                    DeforestationRisk            = "yes",
                    DeforestationRisk_Flagged    = true
                },
                Name = "Test"
            };

            return(model);
        }
コード例 #29
0
        public async Task <IActionResult> UpdateStatus(CompanyDetailsModel companyDetailModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new CompanyDetailModel()
                {
                    Message = "Object is Not Valid", IsSuccess = false
                }));
            }
            var result = await _companyManagementManager.UpdateStatus(companyDetailModel);

            if (result != null)
            {
                result.Message = "Status has been Successfull changed to " + result.companyDetails.StatusDescription;
                return(Ok(result));
            }
            else
            {
                return(StatusCode(500, new CompanyDetailModel {
                    Message = "Internal Server Error", IsSuccess = false
                }));
            }
        }
コード例 #30
0
        public CompanyDetailsModel GetCompanyDetails(int employeeid)
        {
            CompanyDetailsModel details = new CompanyDetailsModel();

            sqlConnection          = OpenConnection();
            sqlCommand             = new SqlCommand();
            sqlCommand.Connection  = sqlConnection;
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "uspGetCompanyDetails";
            sqlCommand.Parameters.Add("@EmployeeID", SqlDbType.Int).Value = Convert.ToInt32(employeeid);
            SqlDataReader companydatareader = sqlCommand.ExecuteReader();

            while (companydatareader.Read())
            {
                details.EmployeeID     = companydatareader.GetInt32(companydatareader.GetOrdinal("EmployeeID"));
                details.Employer_Name  = companydatareader.GetString(companydatareader.GetOrdinal("Employer_Name"));
                details.Contact_Number = companydatareader.GetString(companydatareader.GetOrdinal("Contact_Number"));
                details.Location       = companydatareader.GetString(companydatareader.GetOrdinal("Location"));
                details.Website        = companydatareader.GetString(companydatareader.GetOrdinal("Website"));
            }
            CloseConncetion(sqlConnection);
            return(details);
        }
コード例 #31
0
 protected void CompanyDetailsSave_Click(object sender, EventArgs e)
 {
     try
     {
         CompanyDetailsModel companymodel = new CompanyDetailsModel()
         {
             Employer_Name  = Employer_NameTextBox.Text,
             Contact_Number = Contact_NumberTextBox.Text,
             Location       = LocationTextBox.Text,
             Website        = WebsiteTextBox.Text,
         };
         CompanyDataAccess companydata = new CompanyDataAccess();
         string            cmpdata     = companydata.SaveCompany(companymodel);
         if (cmpdata.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>");
     }
 }
コード例 #32
0
        public async Task <IActionResult> GetCompanyDetails()
        {
            var companyDetails  = new CompanyDetailsModel();
            var currentCustomer = await _workContext.GetCurrentCustomerAsync();

            var company = await _companyService.GetCompanyByCustomerIdAsync(currentCustomer.Id);

            if (company != null)
            {
                companyDetails.CompanyName = company.Name;
                companyDetails.AmoutLimit  = company.AmountLimit;
                var companyCustomerIds = await _companyService.GetCompanyCustomersByCompanyIdAsync(company.Id);

                if (companyCustomerIds.Any())
                {
                    var customers = await _customerService.GetCustomersByIdsAsync(companyCustomerIds.Select(x => x.CustomerId).ToArray());

                    if (customers.Any())
                    {
                        var addresses = new List <Address>();
                        foreach (var customer in customers)
                        {
                            foreach (var address in await _customerService.GetAddressesByCustomerIdAsync(customer.Id))
                            {
                                if (!addresses.Where(x => x.Id == address.Id).Any())
                                {
                                    addresses.Add(address);
                                }
                            }
                        }
                        companyDetails.Adresses = addresses;
                    }
                }
                return(Ok(new { success = true, companyDetails }));
            }
            return(Ok(new { success = false, message = await _localizationService.GetResourceAsync("Company.NotFound") }));
        }