Exemple #1
0
        //linq query used to insert employee details into (ImSS_Master_Emp_List)
        public ImSS_Master_Client AddCustomer(ImSS_Master_Client Addcust)
        {
            try
            {
                using (var context = new Billing_StagingEntities1())
                {
                    ImSS_Cust_Emp_Details lst = new ImSS_Cust_Emp_Details();
                    lst.Cilent_Start_Date = DateTime.Now;
                    lst.Emp_Number        = Addcust.Emp_Name;
                    lst.Cilent_ID         = Addcust.Client_Name;
                    if (Addcust.Status == "Active")
                    {
                        ImSS_Master_Emp_List UpdateEmployee = (from c in context.ImSS_Master_Emp_List where c.Emp_Name == Addcust.Emp_Name select c).FirstOrDefault();
                        UpdateEmployee.Status = "Assigned";
                    }

                    context.ImSS_Master_Client.Add(Addcust);
                    context.ImSS_Cust_Emp_Details.Add(lst);
                    context.SaveChanges();
                    return(Addcust);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #2
0
        //linq query used to update employee details of (ImSS_Master_Emp_List)
        public List <ImSS_Master_Emp_List> UpdateEmployee(ImSS_Master_Emp_List empl)
        {
            try
            {
                using (var context = new Billing_StagingEntities1())
                {
                    ImSS_Master_Emp_List UpdateEmployee = (from c in context.ImSS_Master_Emp_List where c.ID == empl.ID select c).FirstOrDefault();
                    UpdateEmployee.Emp_Number       = empl.Emp_Number;
                    UpdateEmployee.Emp_Name         = empl.Emp_Name;
                    UpdateEmployee.DOJ              = empl.DOJ;
                    UpdateEmployee.Previous_Exp     = empl.Previous_Exp;
                    UpdateEmployee.ImSS_Exp         = empl.ImSS_Exp;
                    UpdateEmployee.Total_Exp        = empl.Total_Exp;
                    UpdateEmployee.Domain           = empl.Domain;
                    UpdateEmployee.Business_Unit    = empl.Business_Unit;
                    UpdateEmployee.Reporting        = empl.Reporting;
                    UpdateEmployee.Primary_Skills   = empl.Primary_Skills;
                    UpdateEmployee.Secondary_Skills = empl.Secondary_Skills;
                    UpdateEmployee.Category         = empl.Category;
                    UpdateEmployee.Status           = empl.Status;
                    UpdateEmployee.Mobile_Number    = empl.Mobile_Number;
                    UpdateEmployee.Replaced_by      = empl.Replaced_by;
                    UpdateEmployee.Relived_Date     = empl.Relived_Date;

                    context.SaveChanges();
                    var val = (from e in context.ImSS_Emp_Details
                               where e.Employee_ID == empl.Emp_Number && e.Manager_ID == empl.Reporting &&
                               e.End_Date == null
                               select e).Count();
                    if (val == 0)
                    {
                        ImSS_Emp_Details Empdet = (from c in context.ImSS_Emp_Details where c.Employee_ID == empl.Emp_Number && c.End_Date == null select c).FirstOrDefault();
                        Empdet.End_Date = DateTime.Now;



                        ImSS_Emp_Details lst = new ImSS_Emp_Details();
                        lst.Start_Date  = DateTime.Now;
                        lst.Employee_ID = empl.Emp_Number;
                        lst.Manager_ID  = empl.Reporting;

                        context.ImSS_Emp_Details.Add(lst);
                        context.SaveChanges();
                    }

                    return((from a in context.ImSS_Master_Emp_List select a).ToList());
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #3
0
 public ActionResult Edit(ImSS_Master_Emp_List emp)
 {
     try
     {
         if (ModelState.IsValid)
         {
             CBL.UpdateEmployee(emp);
         }
         return(Json(emp));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #4
0
        public List <ImSS_Master_Emp_List> UpdateEmployee(ImSS_Master_Emp_List empl)
        {
            try
            {
                using (var context = new Billing_StagingEntities1())
                {
                    ImSS_Master_Emp_List UpdateEmployee = (from c in context.ImSS_Master_Emp_List where c.ID == empl.ID select c).FirstOrDefault();
                    UpdateEmployee.Status = empl.Status;
                    context.SaveChanges();
                    return((from a in context.ImSS_Master_Emp_List select a).ToList());
                }
            }

            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #5
0
        //linq query used to insert employee details into (ImSS_Master_Emp_List)
        //public ImSS_Master_Emp_List AddEmployee(ImSS_Master_Emp_List Addemp)
        //{
        //    try
        //    {
        //        using (var context = new Billing_StagingEntities1())
        //        {
        //            ImSS_Emp_Details lst=new ImSS_Emp_Details();
        //            lst.Start_Date = DateTime.Now;
        //            lst.Employee_ID = Addemp.Emp_Number;
        //            lst.Manager_ID = Addemp.Reporting;
        //            context.ImSS_Master_Emp_List.Add(Addemp);
        //            context.ImSS_Emp_Details.Add(lst);
        //            context.SaveChanges();
        //            return Addemp;
        //        }
        //    }
        //    catch (Exception e)
        //    {
        //        throw e;
        //    }

        //}

        public ImSS_Master_Emp_List AddEmployee(ImSS_Master_Emp_List Addemp)
        {
            try
            {
                using (var context = new Billing_StagingEntities1())
                {
                    ImSS_Emp_Details lst = new ImSS_Emp_Details();
                    lst.Start_Date  = DateTime.Now;
                    lst.Employee_ID = Addemp.Emp_Number;
                    lst.Manager_ID  = Addemp.Reporting;
                    context.ImSS_Master_Emp_List.Add(Addemp);
                    context.ImSS_Emp_Details.Add(lst);
                    context.SaveChanges();
                    return(Addemp);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #6
0
        //linq query used to update employee details of (ImSS_Master_Emp_List)
        public List <ImSS_Master_Client> UpdateCilent(ImSS_Master_Client cust)
        {
            try
            {
                using (var context = new Billing_StagingEntities1())
                {
                    ImSS_Master_Client UpdateCustomer = (from c in context.ImSS_Master_Client where c.ID == cust.ID select c).FirstOrDefault();
                    UpdateCustomer.Emp_Name    = cust.Emp_Name;
                    UpdateCustomer.Client_Name = cust.Client_Name;
                    UpdateCustomer.Email       = cust.Email;
                    UpdateCustomer.Reporting_Manager_at_client_place = cust.Reporting_Manager_at_client_place;
                    UpdateCustomer.Shadow   = cust.Shadow;
                    UpdateCustomer.Location = cust.Location;
                    UpdateCustomer.Status   = cust.Status;

                    if (UpdateCustomer.Status == "Active")
                    {
                        ImSS_Master_Emp_List UpdateEmployee = (from c in context.ImSS_Master_Emp_List where c.Emp_Name == cust.Emp_Name select c).FirstOrDefault();
                        UpdateEmployee.Status = "Assigned";
                    }
                    else
                    {
                        ImSS_Master_Emp_List UpdateEmployee = (from c in context.ImSS_Master_Emp_List where c.Emp_Name == cust.Emp_Name select c).FirstOrDefault();
                        UpdateEmployee.Status = "Avalible";
                        ImSS_Cust_Emp_Details Update = (from c in context.ImSS_Cust_Emp_Details where c.Emp_Number == cust.Emp_Name select c).FirstOrDefault();
                        Update.Cilent_End_Date = DateTime.Now;
                    }
                    context.SaveChanges();


                    return((from a in context.ImSS_Master_Client select a).ToList());
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }