示例#1
0
 public string AddAssociate(Cog.MLIAD.BusinessLogic.Associate.Associate associate)
 {
     try
     {
         MLIADService.SetNoCache();
         return(repository.AddAssociate(associate));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public string AddAddress(Associate.Address address, string AssociateID)
        {
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                try
                {
                    int retadd = 0;
                    int AssoID = Convert.ToInt32(AssociateID);
                    retadd = asscon.Add_Address(AssoID, address.AddressTypeID, address.Address1, address.Address2, address.Address3, address.City, address.State, address.Country, address.Zip);
                    if (!(retadd == 0))
                        return "success";
                    else
                        return "failure";
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }
        }
示例#3
0
 public string EditAssociate(Cog.MLIAD.BusinessLogic.Associate.Associate associate)
 {
     try
     {
         MLIADService.SetNoCache();
         string retval = "failure";
         if (associate.oper == "edit")
         {
             retval = repository.EditAssociate(associate);
         }
         else if (associate.oper == "delete")
         {
             retval = repository.DeleteAssociate(associate.id);
         }
         return(retval);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#4
0
        public Pager <Cog.MLIAD.BusinessLogic.Associate.Associate> SearchAssociate(Cog.MLIAD.BusinessLogic.Associate.Associate associate, string page, string row, string totalcount)
        {
            try
            {
                int?count     = 0;
                int pageIndex = Convert.ToInt32(page);
                int pageSize  = Convert.ToInt32(row);
                Pager <Cog.MLIAD.BusinessLogic.Associate.Associate> pager = new Pager <Cog.MLIAD.BusinessLogic.Associate.Associate>();
                MLIADService.SetNoCache();
                List <Cog.MLIAD.BusinessLogic.Associate.Associate> associates = repository.SearchAssociate(associate, (pageIndex - 1), pageSize, ref count);

                pager.Items     = associates;
                pager.Page      = pageIndex;
                pager.ItemCount = (count == null) ? 0 : Convert.ToInt32(count);
                pager.PageTotal = ((pager.ItemCount + pageSize - 1) / pageSize);
                pager.PageSize  = pageSize;
                return(pager);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public string AddAssociate(Cog.MLIAD.BusinessLogic.Associate.Associate associate)
 {
     try
     {
         MLIADMobileService.SetNoCache();
         var result = repository.AddMobileAssociate(associate);
         //if(result == "success")
         //{
         //    string smstext = "Thanks " + associate.FirstName + " " + associate.LastName + ". Your registration is successful. Your username is: '" + associate .AssociateID+ "'. You password is: 'password'. Please login to https://massociatecon.cognizant.com/mobile/login.htm";
         //    try
         //    {
         //        SendSMS(smstext, "91" + associate.Mobile);
         //    }
         //    catch (Exception ex)
         //    {
         //    }
         //    finally
         //    {
         //        //try
         //        //{
         //        //    repository.SendEmail("Registration Successful!", smstext, associate.email, associate.email, true);
         //        //}
         //        //catch (Exception ex) { }
         //        //finally
         //        //{
         //        //    //return result;
         //        //}
         //    }
         //    return result;
         //}
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public string EditSoftware(Associate.SoftwareRequest software)
 {
     int SoftRequestID = Convert.ToInt32(software.id);
     int SoftCategoryID = Convert.ToInt32(software.SoftCategory);
     int SoftResourceID = Convert.ToInt32(software.SoftResource);
     int SoftVersionID = Convert.ToInt32(software.SoftVersion);
     int ProjectID = Convert.ToInt32(software.ProjectName);
     using (AssociateConnDataContext asscon = new AssociateConnDataContext())
     {
         try
         {
             int retval = asscon.Edit_Software(SoftRequestID, SoftResourceID, SoftCategoryID, SoftVersionID, ProjectID);
             if (retval == 1)
                 return "sucess";
             else
                 return "failure";
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
        public string EditFirewall(Associate.FirewallRequest firewall)
        {
            int RequestedID = Convert.ToInt32(firewall.id);
            int ProjectID = Convert.ToInt32(firewall.ProjectName);
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                try
                {
                    int retval = asscon.Edit_Firewall(RequestedID, firewall.FirewallRequestDesc, firewall.Destination, firewall.Source, firewall.Port, ProjectID);
                    if (retval == 1)
                        return "sucess";
                    else
                        return "failure";
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }
        }
 public string EditCategory(Associate.Category category)
 {
     int CategoryID = Convert.ToInt32(category.CategoryID);
     int IsActive = Convert.ToInt32(category.IsActive);
     using (AssociateConnDataContext asscon = new AssociateConnDataContext())
     {
         try
         {
             int retval = 0;
             retval = asscon.Update_Category(CategoryID, category.CategoryDesc, IsActive);
             if (!(retval == 0))
                 return "success";
             else
                 return "failure";
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
 public string EditAssociate(Associate.Associate associate)
 {
     int AssociateID = Convert.ToInt32(associate.id);
     int ProjectID = Convert.ToInt32(associate.ProjectName);
     int LocationID = Convert.ToInt32(associate.Location);
     int DesignationID = Convert.ToInt32(associate.Designation);
     using (AssociateConnDataContext asscon = new AssociateConnDataContext())
     {
         try
         {
             int retasct = 0;
             retasct = asscon.Edit_Associate(AssociateID, associate.DirectReportID, associate.DOB, associate.DOJ, associate.email, associate.FirstName, associate.IsActive, associate.LastName, associate.Mobile, associate.ModifiedBy, DesignationID, LocationID, ProjectID);
             //foreach (var Adrs in associate.Address)
             //{
             //    retadd=asscon.Edit_Address(associate.AssociateID, Adrs.Address1, Adrs.Address2, Adrs.Address3, Adrs.City, Adrs.State, Adrs.Country, Adrs.Zip, Adrs.AddressTypeID);
             //}
             //foreach (var Phn in associate.Phones)
             //{
             //    retphn=asscon.Edit_Phone(associate.AssociateID, Phn.PhoneNo, Phn.PhoneTypeID);
             //}
             if (!(retasct == 0))
                 return "success";
             else
                 return "failure";
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
        public string AddPhone(Associate.Phone phone, string AssociateID)
        {
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                try
                {
                    int retphn = 0;
                    int AssoID = Convert.ToInt32(AssociateID);
                    retphn = asscon.Add_Phone(AssoID, phone.PhoneTypeID, phone.PhoneNo);
                    if (!(retphn == 0))
                        return "success";
                    else
                        return "failure";
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }
        }
        public List<Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest> SearchSoftware(Associate.SoftwareRequest software, int pageIndex, int pageSize, ref int? count)
        {
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                try
                {
                    Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest retval = new Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest();
                    var softwares = (from s in asscon.SearchSoftware(software.SoftResourceID, software.SoftCategoryID, software.ProjectID, ref count)
                                     select new Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest()
                                     {
                                         SoftRequestID = s.SoftRequestID,
                                         SoftCategory = s.SoftCategory,
                                         SoftResource = s.SoftResource,
                                         SoftVersion = s.SoftVersion,
                                         ProjectName = s.ProjectName
                                     }).ToList<Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest>();

                    pageSize = (pageSize < 1 ? 10 : pageSize);
                    pageIndex = (pageIndex < 0 ? 0 : pageIndex);
                    count = softwares.Count;
                    if (count < pageSize)
                    {
                        pageIndex = 0;
                        return softwares;
                    }
                    else if (softwares.Count < pageSize * pageIndex)
                    {
                        pageIndex = 0;
                        return new List<BusinessLogic.Associate.SoftwareRequest>(softwares.Take(pageSize));
                    }
                    else
                    {
                        int a = Convert.ToInt32(((count - pageSize * pageIndex) >= pageSize) ? pageSize : (count - pageSize * pageIndex));
                        return new List<BusinessLogic.Associate.SoftwareRequest>(softwares.Skip(pageSize * pageIndex).Take(a));
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
 public List<Cog.MLIAD.BusinessLogic.Associate.FirewallRequest> SearchFirewall(Associate.FirewallRequest firewall, int pageIndex, int pageSize, ref int? count)
 {
     using (AssociateConnDataContext asscon = new AssociateConnDataContext())
     {
         try
         {
             Cog.MLIAD.BusinessLogic.Associate.FirewallRequest retval = new Cog.MLIAD.BusinessLogic.Associate.FirewallRequest();
             var firewalls = (from f in asscon.SearchFirewall(firewall.Destination, firewall.ProjectID)
                              select new Cog.MLIAD.BusinessLogic.Associate.FirewallRequest()
                              {
                                  FirewallRequestID = f.FirewallRequestID,
                                  FirewallRequestDesc = f.FirewallRequestDesc,
                                  Destination = f.Destination,
                                  Source = f.Source,
                                  Port = f.Port,
                                  ProjectName = f.ProjectName
                              }
                             ).ToList<Cog.MLIAD.BusinessLogic.Associate.FirewallRequest>();
             pageSize = (pageSize < 1 ? 10 : pageSize);
             pageIndex = (pageIndex < 0 ? 0 : pageIndex);
             count = firewalls.Count;
             if (count < pageSize)
             {
                 pageIndex = 0;
                 return firewalls;
             }
             else if (firewalls.Count < pageSize * pageIndex)
             {
                 pageIndex = 0;
                 return new List<BusinessLogic.Associate.FirewallRequest>(firewalls.Take(pageSize));
             }
             else
             {
                 int a = Convert.ToInt32(((count - pageSize * pageIndex) >= pageSize) ? pageSize : (count - pageSize * pageIndex));
                 return new List<BusinessLogic.Associate.FirewallRequest>(firewalls.Skip(pageSize * pageIndex).Take(a));
             }
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
        public List<Cog.MLIAD.BusinessLogic.Associate.Category> SearchCategory(Associate.Category search, int pageIndex, int pageSize, ref int? count)
        {
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                try
                {
                    //int CategoryID = (search.CategoryID == "")?0: Convert.ToInt32(search.CategoryID);
                    var associates = (from a in asscon.SearchCategory(search.CategoryID, search.CategoryDesc, search.IsActive)
                                      select new Cog.MLIAD.BusinessLogic.Associate.Category()
                                      {
                                          CategoryID = a.CategoryID,
                                          CategoryDesc = a.CategoryDesc,
                                          IsActive = a.IsActive
                                      }).ToList<Cog.MLIAD.BusinessLogic.Associate.Category>();

                    List<Cog.MLIAD.BusinessLogic.Associate.Category> list = new List<Cog.MLIAD.BusinessLogic.Associate.Category>();
                    list = associates;

                    pageSize = (pageSize < 1 ? 10 : pageSize);
                    pageIndex = (pageIndex < 0 ? 0 : pageIndex);
                    count = list.Count;
                    if (count < pageSize)
                    {
                        pageIndex = 0;
                        return list;
                    }
                    else if (list.Count < pageSize * pageIndex)
                    {
                        pageIndex = 0;
                        return new List<BusinessLogic.Associate.Category>(list.Take(pageSize));
                    }
                    else
                    {
                        int a = Convert.ToInt32(((count - pageSize * pageIndex) >= pageSize) ? pageSize : (count - pageSize * pageIndex));
                        return new List<BusinessLogic.Associate.Category>(list.Skip(pageSize * pageIndex).Take(a));
                    }

                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public List<Cog.MLIAD.BusinessLogic.Associate.Associate> SearchAssociate(Associate.Associate associate, int pageIndex, int pageSize, ref int? count)
        {
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                try
                {
                    int AssociateID = Convert.ToInt32(associate.AssociateID);
                    var associates = (from a in asscon.SearchAssociate(AssociateID, associate.DesignationID, associate.FirstName, associate.LastName, associate.ProjectID, associate.LocationID, ref count)
                                      select new Cog.MLIAD.BusinessLogic.Associate.Associate()
                                      {
                                          AssociateID = a.AssociateID,
                                          FirstName = (a.FirstName == null) ? "" : a.FirstName,
                                          LastName = (a.LastName == null) ? "" : a.LastName,
                                          Mobile = (a.Mobile == null) ? "" : a.Mobile,
                                          email = (a.email == null) ? "" : a.email,
                                          DirectReportID = a.DirectReportID,
                                          IsActive = (a.IsActive == null) ? false : a.IsActive,
                                          IsApproved = a.IsApproved,
                                          ModifiedBy = (a.ModifiedBy == null) ? 0 : a.ModifiedBy,
                                          ModifiedOn = (a.ModifiedOn == null) ? null : a.ModifiedOn,
                                          DOJ = (a.DOJ == null) ? "" : a.DOJ,
                                          DOB = (a.DOB == null) ? "" : a.DOB,
                                          ProjectName = (a.ProjectName == null) ? "" : a.ProjectName,
                                          Location = (a.Location == null) ? "" : a.Location,
                                          Designation = (a.Designation == null) ? "" : a.Designation,
                                          UserID = (a.UserId == null) ? "" : a.UserId
                                      }).ToList<Cog.MLIAD.BusinessLogic.Associate.Associate>();

                    List<Cog.MLIAD.BusinessLogic.Associate.Associate> list = new List<Cog.MLIAD.BusinessLogic.Associate.Associate>();
                    list = associates;

                    pageSize = (pageSize < 1 ? 10 : pageSize);
                    pageIndex = (pageIndex < 0 ? 0 : pageIndex);
                    count = list.Count;
                    if (count < pageSize)
                    {
                        pageIndex = 0;
                        return list;
                    }
                    else if (list.Count < pageSize * pageIndex)
                    {
                        pageIndex = 0;
                        return new List<BusinessLogic.Associate.Associate>(list.Take(pageSize));
                    }
                    else
                    {
                        int a = Convert.ToInt32(((count - pageSize * pageIndex) >= pageSize) ? pageSize : (count - pageSize * pageIndex));
                        return new List<BusinessLogic.Associate.Associate>(list.Skip(pageSize * pageIndex).Take(a));
                    }

                    //foreach (var asct in associates)
                    //{
                    //    var address = (from add in asscon.Search_Address(asct.AssociateID)
                    //                     select new Cog.MLIAD.BusinessLogic.Associate.Address()
                    //                     {
                    //                         Address1=add.Address1,
                    //                         Address2=add.Address2,
                    //                         Address3=add.Address3,
                    //                         City=add.City,
                    //                         State=add.State,
                    //                         Country=add.Country,
                    //                         Zip=add.Zip,
                    //                         AddressTypeID=add.AddressTypeID
                    //                     }).ToList<Cog.MLIAD.BusinessLogic.Associate.Address>();
                    //    asct.Address = address;
                    //    var Phone = (from phn in asscon.Search_Phone(asct.AssociateID)
                    //                 select new Cog.MLIAD.BusinessLogic.Associate.Phone()
                    //                 {
                    //                     PhoneNo=phn.Phone,
                    //                     PhoneTypeID =Convert.ToInt32(phn.PhoneTypeID)
                    //                 }).ToList<Cog.MLIAD.BusinessLogic.Associate.Phone>();
                    //    asct.Phones = Phone;
                    //    list.Add(asct);
                    //}
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }