Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
 public ActionResult CreateCustomer(ImSS_Master_Client emp)
 {
     try
     {
         ImSS_Master_Client Addcust = new ImSS_Master_Client();
         Addcust = CBL.AddCustomer(emp);
         return(Json(emp));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 3
0
 public ActionResult EditList(ImSS_Master_Client cl)
 {
     try
     {
         if (ModelState.IsValid)
         {
             CBL.UpdateCilent(cl);
         }
         return(Json(cl));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 4
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;
            }
        }
Exemplo n.º 5
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;
            }
        }