//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; } }
//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; } }
//linq query used to retrive employee details from (ImSS_Master_Emp_List) public List <customer> GetCustomerList() { try { using (var context = new Billing_StagingEntities1()) { var CustomerList = (from a in context.ImSS_Master_Client join b in context.ImSS_Cust_Emp_Details on a.Emp_Name equals b.Emp_Number select new customer { ID = a.ID, Emp_Name = a.Emp_Name, Client_Name = a.Client_Name, Email = a.Email, Reporting_Manager_at_client_place = a.Reporting_Manager_at_client_place, Cilent_Start_Date = b.Cilent_Start_Date, Shadow = a.Shadow, Location = a.Location, Status = a.Status }).ToList(); return(CustomerList); } } catch (Exception e) { throw e; } }
//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; } }
//ling query used to get bussinessunit(ImSS_Business_Unit) public List <ImSS_Business_Unit> GetBussinessUnitList() { try { using (var context = new Billing_StagingEntities1()) { var list = (from a in context.ImSS_Business_Unit select a).ToList(); return(list); } } catch (Exception e) { throw e; } }
//ling query used to get status(ImSS_Status) public List <ImSS_Status> GetStatusList() { try { using (var context = new Billing_StagingEntities1()) { var list = (from a in context.ImSS_Status where a.ID != 5 select a).ToList(); return(list); } } catch (Exception e) { throw e; } }
//ling query used to get payment(ImSS_Payment_Mode) public List <ImSS_Payment_Mode> GetPayment() { try { using (var context = new Billing_StagingEntities1()) { var list = (from a in context.ImSS_Payment_Mode select a).ToList(); return(list); } } catch (Exception e) { throw e; } }
//ling query used to get employee name(ImSS_Master_Emp_List) public List <ImSS_Master_Emp_List> GetEmployeeNameList() { try { using (var context = new Billing_StagingEntities1()) { var list = (from a in context.ImSS_Master_Emp_List select a).ToList(); return(list); } } catch (Exception e) { throw e; } }
//ling query used to get category(ImSS_Category) public List <ImSS_Category> GetcategoryList() { try { using (var context = new Billing_StagingEntities1()) { var list = (from a in context.ImSS_Category select a).ToList(); return(list); } } catch (Exception e) { throw e; } }
//linq query used to delete employee details of (ImSS_Master_Emp_List) //public List<ImSS_Master_Emp_List> Delete(string empno) //{ // try // { // using (var context = new Billing_StagingEntities1()) // { // ImSS_Master_Emp_List DeleteEmployee = (from c in context.ImSS_Master_Emp_List where c.Emp_Number == empno select c).FirstOrDefault(); // if (DeleteEmployee != null) // { // context.ImSS_Master_Emp_List.Remove(DeleteEmployee); // context.SaveChanges(); // } // return (from a in context.ImSS_Master_Emp_List select a).ToList(); // } // } // catch (Exception e) // { // throw e; // } //} //ling query used to get who to report(ImSS_Reporting_Head) public List <ImSS_Reporting_Head> GetReportingList() { try { using (var context = new Billing_StagingEntities1()) { var list = (from a in context.ImSS_Reporting_Head select a).ToList(); return(list); } } catch (Exception e) { throw e; } }
//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; } }
//linq query used to retrive POMaster details from (ImSS_Master_Emp_List) public List <ImSS_Master_PO> GetPOList() { try { using (var context = new Billing_StagingEntities1()) { var polist = (from po in context.ImSS_Master_PO select po).ToList(); return(polist); } } catch (Exception e) { throw e; } }
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; } }
//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; } }
//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; } }
//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; } }
//linq query used to retrive employee details from (ImSS_Master_Emp_List) public List <employee> GetEmployeeList() { try { using (var context = new Billing_StagingEntities1()) { var employeeList = (from a in context.ImSS_Master_Emp_List join b in context.ImSS_Emp_Details on a.Emp_Number equals b.Employee_ID where b.End_Date == null select new employee { ID = a.ID, Emp_Number = a.Emp_Number, Emp_Name = a.Emp_Name, DOJ = a.DOJ, Previous_Exp = a.Previous_Exp, ImSS_Exp = a.ImSS_Exp, Total_Exp = a.Total_Exp, Domain = a.Domain, Business_Unit = a.Business_Unit, Reporting = a.Reporting, Start_Date = b.Start_Date, Primary_Skills = a.Primary_Skills, Secondary_Skills = a.Secondary_Skills, Category = a.Category, Status = a.Status, Mobile_Number = a.Mobile_Number, Replaced_by = a.Replaced_by, Relived_Date = a.Relived_Date }).ToList(); return(employeeList); } } catch (Exception e) { throw e; } }
//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; } }