コード例 #1
0
ファイル: EmployeeBl.cs プロジェクト: c5232936/mvc
        //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;
            }
        }
コード例 #2
0
 //linq query used to update po details of (ImSS_Master_PO)
 public List <ImSS_Master_PO> UpdatePO(ImSS_Master_PO po)
 {
     try
     {
         using (var context = new Billing_StagingEntities1())
         {
             ImSS_Master_PO UpdatePo = (from c in context.ImSS_Master_PO where c.ID == po.ID select c).FirstOrDefault();
             UpdatePo.Client_Name         = po.Client_Name;
             UpdatePo.Project_Name        = po.Project_Name;
             UpdatePo.PO_Number           = po.PO_Number;
             UpdatePo.Point_Of_Contact    = po.Point_Of_Contact;
             UpdatePo.Mode_Of_Payment     = po.Mode_Of_Payment;
             UpdatePo.Currency            = po.Currency;
             UpdatePo.PO_StartDate        = po.PO_StartDate;
             UpdatePo.PO_EndDate          = po.PO_EndDate;
             UpdatePo.PO_Initial_Amount   = po.PO_Initial_Amount;
             UpdatePo.PO_Duration         = po.PO_Duration;
             UpdatePo.PO_Renewed_Amount   = po.PO_Renewed_Amount;
             UpdatePo.PO_Renewed_Date     = po.PO_Renewed_Date;
             UpdatePo.Parent_PO           = po.Parent_PO;
             UpdatePo.PO_Status           = po.PO_Status;
             UpdatePo.PO_Total_Amount_INR = po.PO_Total_Amount_INR;
             UpdatePo.PO_Close_Date       = po.PO_Close_Date;
             context.SaveChanges();
             return((from a in context.ImSS_Master_PO select a).ToList());
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #3
0
ファイル: CustomerBl.cs プロジェクト: c5232936/mvc
        //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;
            }
        }
コード例 #4
0
 //linq query used to insert POMaster details into (ImSS_Master_Emp_List)
 public ImSS_Master_PO AddPOMaster(ImSS_Master_PO po)
 {
     try
     {
         using (var context = new Billing_StagingEntities1())
         {
             context.ImSS_Master_PO.Add(po);
             context.SaveChanges();
             return(po);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #5
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;
            }
        }
コード例 #6
0
 //linq query used to delete PO details of (ImSS_Master_PO)
 public List <ImSS_Master_PO> Delete(int?Id)
 {
     try
     {
         using (var context = new Billing_StagingEntities1())
         {
             ImSS_Master_PO DeleteCilent = (from c in context.ImSS_Master_PO where c.ID == Id select c).FirstOrDefault();
             if (DeleteCilent != null)
             {
                 context.ImSS_Master_PO.Remove(DeleteCilent);
                 context.SaveChanges();
             }
             return((from a in context.ImSS_Master_PO select a).ToList());
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #7
0
ファイル: EmployeeBl.cs プロジェクト: c5232936/mvc
        //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;
            }
        }
コード例 #8
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;

                    context.ImSS_Master_Client.Add(Addcust);
                    context.ImSS_Cust_Emp_Details.Add(lst);
                    context.SaveChanges();
                    return(Addcust);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #9
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;
            }
        }