Exemplo n.º 1
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            int rowindex = dataGridView1.CurrentRow.Index;

            ID         = int.Parse(dataGridView1.Rows[rowindex].Cells[0].Value.ToString());
            currentobj = currentobj.GetByID(ID);
            push();
        }
Exemplo n.º 2
0
 public static Entities.Company CompanyEntities(DAL.Company r)
 {
     return(new Entities.Company()
     {
         CompanyAreaId = r.CompanyAreaId,
         CompanyCityId = r.CompanyCityId,
         CompanyId = r.CompanyId,
         CompanyMail = r.CompanyMail,
         CompanyName = r.CompanyName,
         CompanyNumBuild = r.CompanyNumBuild,
         CompanyStreet = r.CompanyStreet,
         CompanyTel = r.CompanyTel,
     });
 }
Exemplo n.º 3
0
 public static DTO.CompanyDto ConvertDALtoDTO(DAL.Company company)
 {
     if (company == null)
     {
         return(null);
     }
     return(new DTO.CompanyDto()
     {
         CompanyId = company.CompanyId,
         CompanyName = company.CompanyName,
         Address = company.Address,
         Mail = company.Mail,
         Publishes = company.Publishes != null?DTO.converters.ConvertPublish.ConvertListDALtoDTO(company.Publishes.ToList()) : null
     });
 }
Exemplo n.º 4
0
        public static List <JobView> JobView(List <Job> job)
        {
            try
            {
                using (DAL.IdialEntities3 dbn = new DAL.IdialEntities3())
                {
                    //new connection to the database
                    dbn.Database.Connection.Open();
                    String diff2 = "";
                    List <Entities.JobView> jv = new List <JobView>();
                    DateTime temp;
                    foreach (var item in job)
                    {
                        DAL.Workspace    w          = dbn.Workspace.FirstOrDefault(p1 => p1.WSId == item.JobWorkspaceId);
                        DAL.SubjectJob   s          = dbn.SubjectJob.FirstOrDefault(p1 => p1.SubId == item.JobSubId);
                        DAL.OutNet       outNet     = dbn.OutNet.FirstOrDefault(o => o.OutNetId == item.JobPartOutNetId);
                        DAL.Company      company    = dbn.Company.FirstOrDefault(q => q.CompanyId == item.JobCompanyId);
                        DAL.City         city       = dbn.City.FirstOrDefault(c => c.CityId == company.CompanyCityId);
                        DAL.Area         area       = dbn.Area.FirstOrDefault(a => a.AreaId == company.CompanyAreaId);
                        DAL.SubjectJob   SubjectJob = dbn.SubjectJob.FirstOrDefault(o => o.SubId == item.JobSubId);
                        DAL.Part         p          = dbn.Part.FirstOrDefault(s2 => s2.PartId == item.JobPartId);
                        DAL.Job          job1       = dbn.Job.FirstOrDefault(j => j.JobId == item.JobId);
                        Entities.JobView v          = new JobView();
                        DateTime.TryParse(item.JobDateAdv.ToString(), out temp);
                        if (temp != null)
                        {
                            diff2 = Convert.ToInt32((DateTime.Today - temp).TotalDays).ToString();
                        }

                        v = Entities.JobView.CreateJobView(area, company, job1, SubjectJob, w, p, outNet, city, diff2);
                        jv.Add(v);
                    }
                    db.Database.Connection.Close();

                    return(jv);
                }
                //DAL.IdialEntities3.Connection.Open();
            }
            catch (Exception e)
            {
                BL.SendMail.SendEmail(e.ToString(), e.Message, "");
                BL.WriteLogError.WriteLogErrors(e.Message);
                return(null);
            }
        }
Exemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var User = Membership.GetUser().UserName;

            var context = new HireMeEntities();

            DAL.Company obj = new DAL.Company();
            obj.Name        = txtCompanyName.Text;
            obj.Industry    = Convert.ToInt32(ddlIndustry.SelectedValue);
            obj.PhoneNumber = Convert.ToInt32(txtPhoneNumber.Text);
            //obj.co = Convert.ToInt32(txtCompanyEmail.Text);
            obj.Country = Convert.ToInt32(ddlCountry.SelectedValue);
            obj.City    = Convert.ToInt32(ddlCity.SelectedValue);
            obj.WebSite = txtWebSite.Text;
            obj.UserId  = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().UserId;

            context.Companies.Add(obj);
            context.SaveChanges();
        }
Exemplo n.º 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Guid userId  = new Guid(Request.QueryString["UserId"]);
            var  context = new HireMeEntities();

            DAL.Company obj = new DAL.Company();
            obj.Name        = txtCompanyName.Text;
            obj.Industry    = Convert.ToInt32(ddlIndustry.SelectedValue);
            obj.PhoneNumber = Convert.ToInt32(txtPhoneNumber.Text);
            //obj.co = Convert.ToInt32(txtCompanyEmail.Text);
            obj.Country = Convert.ToInt32(ddlCountry.SelectedValue);
            obj.City    = Convert.ToInt32(ddlCity.SelectedValue);
            obj.WebSite = txtWebSite.Text;
            obj.UserId  = userId;

            context.Companies.Add(obj);
            context.SaveChanges();
            divSuccess.Visible = true;
        }
Exemplo n.º 7
0
 protected void butDelete_onClick(object sender, EventArgs e)
 {
     try
     {
         int id = int.Parse(((Button)sender).CommandName);
         //AdminHelper adminHelper = new AdminHelper();
         LimoEntitiesEntityFremwork limoEntities = new LimoEntitiesEntityFremwork();
         DAL.Company companyTemp = limoEntities.Companies.Where(xx => xx.CompanyID == id).FirstOrDefault();
         if (companyTemp != null)
         {
             limoEntities.Companies.DeleteObject(companyTemp);
             limoEntities.SaveChanges();
         }
         Response.Redirect("~/admin/Pages/ManageCompany.aspx");
     }
     catch (Exception ex)
     {
         divProblem.Visible = true;
     }
 }
Exemplo n.º 8
0
        //public JobView():base()
        //{

        //}
        public static Entities.JobView CreateJobView(DAL.Area a, DAL.Company c, DAL.Job j, DAL.SubjectJob s, DAL.Workspace w, DAL.Part p, DAL.OutNet o, DAL.City ci, string diff)
        {
            return(new Entities.JobView()
            {
                JobDateAdv = j.JobDateAdv,
                JobDateShow = diff,
                CompanyName = c.CompanyName,
                CompanyId = c.CompanyId,
                JobRole = j.JobRole,
                JobDateCaughtJob = j.JobDateCaughtJob,
                PartName = p.PartName,
                OutNetName = o.OutNetName,
                WSName = w.WSName,
                JobExperience = j.JobExperience,
                JobStars = j.JobStars,
                JobDescribe = j.JobDescribe,
                AreaName = a.AreaName,
                BossId = j.JobBossId,
                CityName = ci.CityName,
                SubjectName = s.SubName,
                JobRequire = j.JobRequire,
                JobId = j.JobId
            });
        }
Exemplo n.º 9
0
        public static void Init()
        {
            var CompanyList    = new List <DAL.Company>();
            var CompanyDetails = new DAL.Company();

            var db = new DAL.TargetFinancialDataContext();

            var CheckData = new List <CVTemp>();
            //vid_na_rabota_550.xlsx
            //listing
            var res = Workbook.Worksheets(@"C:\Nix\Project_Dev\Bonitet.ConsoleCSV\bin\Debug\vid_na_rabota_550.xlsx");

            foreach (var worksheet in res)
            {
                var AOP       = false;
                var Tekovna   = 0;
                var Prethodna = 0;
                var Oznaka    = 0;

                foreach (var row in worksheet.Rows)
                {
                    var cellCounter = 0;
                    foreach (var cell in row.Cells)
                    {
                        if (cell != null)
                        {
                            if (cell.Text == "*******")
                            //if (cell.Text == "ПРЕГЛЕД НА ПОДАТОЦИ ОД ГОДИШНА СМЕТКА ЗА 2016 ГОДИНА - ВИД НА РАБОТА 550")
                            {
                                CompanyList.Add(CompanyDetails);

                                if (CompanyDetails.EMBS != null)
                                {
                                    Console.WriteLine(CompanyList.Count());

                                    if (CheckData != null)
                                    {
                                        break;
                                    }
                                    DALHelper.InsertCompanyValues1Temp(CompanyDetails);
                                }

                                CompanyDetails = new DAL.Company();

                                CompanyDetails.CYTemps.Add(new DAL.CYTemp
                                {
                                    Company = CompanyDetails,
                                    Year    = 2014
                                });
                                CompanyDetails.CYTemps.Add(new DAL.CYTemp
                                {
                                    Company = CompanyDetails,
                                    Year    = 2013
                                });


                                AOP       = false;
                                Tekovna   = 0;
                                Prethodna = 0;
                                Oznaka    = 0;
                            }

                            if (cell.Text == "Назив на правното лице:")
                            {
                                CompanyDetails.Name = row.Cells[cellCounter + 1].Text;
                            }

                            if (cell.Text == "Место:")
                            {
                                CompanyDetails.Mesto = row.Cells[cellCounter + 1].Text;
                            }

                            if (cell.Text == "Матичен Број:")
                            {
                                CompanyDetails.EMBS = row.Cells[cellCounter + 1].Text.TrimStart('0');

                                CheckData = DALHelper.GetCompanyValuesByEMBSTemp(CompanyDetails.EMBS);
                                if (CheckData != null)
                                {
                                    break;
                                }
                            }
                            else
                            {
                                if (CheckData != null)
                                {
                                    break;
                                }
                            }

                            if (cell.Text == "Ознака за АОП")
                            {
                                Oznaka = cell.ColumnIndex;
                            }

                            if (cell.Text == "Тековна година")
                            {
                                Tekovna = cell.ColumnIndex;
                            }

                            if (cell.Text == "Претходна година")
                            {
                                Prethodna = cell.ColumnIndex;
                            }

                            if (AOP)
                            {
                                if (CompanyDetails.CYTemps.First().ID == 0)
                                {
                                    CompanyDetails        = DALHelper.InsertCompanyWithYearsTemp(CompanyDetails);
                                    CompanyDetails.CVTemp = new List <CVTemp>();
                                }

                                if (row.Cells[Oznaka] != null)
                                {
                                    var curOznaka = row.Cells[Oznaka].Text;

                                    var newValID = db.Values.Where(c => c.Type == 1 && c.Name == curOznaka).Select(c => c.ID).FirstOrDefault();

                                    var year4 = CompanyDetails.CYTemps.Where(c => c.Year == 2014).Select(c => c.ID).FirstOrDefault();
                                    var year3 = CompanyDetails.CYTemps.Where(c => c.Year == 2013).Select(c => c.ID).FirstOrDefault();

                                    if (CompanyDetails.CVTemp.Where(c => c.ValueID == newValID && c.YearID == year4).FirstOrDefault() == null)
                                    {
                                        if (row.Cells[Tekovna] != null)
                                        {
                                            var curValue = row.Cells[Tekovna].Text;

                                            if (string.IsNullOrEmpty(curValue) == false)
                                            {
                                                curValue = curValue.Replace(".", "");

                                                var newCompanyValue = new DAL.CVTemp();

                                                newCompanyValue.CompanyID = CompanyDetails.ID;
                                                newCompanyValue.YearID    = year4;


                                                double tmpVal = 0;
                                                if (double.TryParse(curValue, out tmpVal))
                                                {
                                                    newCompanyValue.Value = tmpVal;

                                                    newCompanyValue.ValueID = newValID;


                                                    CompanyDetails.CVTemp.Add(newCompanyValue);
                                                }
                                            }
                                        }
                                    }

                                    if (CompanyDetails.CVTemp.Where(c => c.ValueID == newValID && c.YearID == year3).FirstOrDefault() == null)
                                    {
                                        if (row.Cells[Prethodna] != null)
                                        {
                                            var curValue = row.Cells[Prethodna].Text;

                                            if (string.IsNullOrEmpty(curValue) == false)
                                            {
                                                curValue = curValue.Replace(".", "");

                                                var newCompanyValue = new DAL.CVTemp();

                                                newCompanyValue.CompanyID = CompanyDetails.ID;
                                                newCompanyValue.YearID    = year3;


                                                double tmpVal = 0;
                                                if (double.TryParse(curValue, out tmpVal))
                                                {
                                                    newCompanyValue.Value = tmpVal;

                                                    newCompanyValue.ValueID = newValID;


                                                    CompanyDetails.CVTemp.Add(newCompanyValue);
                                                }
                                            }
                                        }
                                    }
                                }
                            }



                            if (Tekovna > 0 && Prethodna > 0 && Oznaka > 0)
                            {
                                AOP = true;
                            }
                        }
                        cellCounter++;
                    }
                }
            }

            db.Dispose();
            db = null;
        }