Пример #1
0
 public Object ViewRecord(Int64 OwnerID)
 {
     DAL.OwnerList owner = new OwnerList();
     try
     {
         owner = DALOwner.ViewOwnerRecord(Convert.ToInt64(OwnerID));
     }
     catch (Exception ex)
     {
         throw;
     }
     return owner;
 }
Пример #2
0
 public Object GetRecord(String OwnerID)
 {
     DAL.OwnerList owner = new OwnerList();
     try
     {
         owner = DALOwner.ViewOwnerAsClientRecord(OwnerID);
     }
     catch (Exception ex)
     {
         throw;
     }
     return owner;
 }
Пример #3
0
        public ActionResult AddRecord( String OwnerID, String PropID, String SiteID, String ClientID)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
                ViewBag.RoleName = loginsession.RoleName;
                  ConsumerMaster _Consumer = new ConsumerMaster();
                  DAL.OwnerList ownerobj = new DAL.OwnerList();
                    String DClientID = String.Empty;
                    String DSiteID = String.Empty;
                    String DPropID = String.Empty;
                    String DOwnerID = String.Empty;
                    String DConsID = String.Empty;
                    if ((ClientID != null)&&(DSiteID != null)&&(PropID != null) && (OwnerID != null))
                    {
                        DClientID = BAL.Security.URLDecrypt(ClientID);
                        _Consumer.ClientID = Convert.ToInt64(DClientID);
                        ViewBag.Client_ID = Convert.ToInt64(DClientID);
                        DSiteID = BAL.Security.URLDecrypt(SiteID);
                        _Consumer.SiteID = Convert.ToInt64(DSiteID);
                        ViewBag.Site_ID = Convert.ToInt64(DSiteID);
                        DPropID = BAL.Security.URLDecrypt(PropID);
                        _Consumer.PropertyID = Convert.ToInt64(DPropID);
                        ViewBag.Property_ID = Convert.ToInt64(DPropID);

                        DOwnerID = BAL.Security.URLDecrypt(OwnerID);
                        _Consumer.OwnerID = Convert.ToInt64(DOwnerID);
                         ViewBag.Owner_ID = Convert.ToInt64(DOwnerID);
                        ownerobj = BAL.OwnerModel.ViewOwner(DOwnerID);

                        if (ownerobj != null)
                        {
                            _Consumer.Property = ownerobj.PropertyNo;
                            _Consumer.Client = ownerobj.Client;
                            _Consumer.Site = ownerobj.Site;
                            _Consumer.Owner = ownerobj.ContactName;

                        }
                    }

                    return View(_Consumer);
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
Пример #4
0
        //public static IEnumerable<OwnerList> OwnerRecordList(String Field, String value)
        //{
        //    try
        //    {
        //        using (var context = new SycousCon())
        //        {
        //            if (Field == "PropertyNo")
        //            {
        //                return (from O in context.Owners
        //                        join P in context.Properties
        //                         on O.PropertyID equals P.ID
        //                        join S in context.SiteMasters
        //                        on O.SiteID equals S.Id
        //                        join C in context.ClientMasters
        //                        on S.ClientID equals C.ClientID
        //                        where (O.IsDeleted == 0 && P.IsDeleted == 0 && S.IsDeleted == 0 && C.DeleteStatus == 0 && P.PropertyNumber.Contains(value))
        //                        orderby O.CreateDate descending, O.ModifyDate descending
        //                        select new OwnerList()
        //                        {
        //                            OwnerID = SqlFunctions.StringConvert((Double)O.ID).Trim(),
        //                            ContactName = ((O.FirstName.Trim() != "") ? O.FirstName.Trim() : "") + "   " + ((O.LastName.Trim() == null) ? "" : O.LastName.Trim()),
        //                            FirstName= O.FirstName,
        //                            LastName=O.LastName,
        //                            PropertyNo = P.PropertyNumber + " " + P.Address1 ,
        //                            StartDate = O.StartDate,
        //                            ClientID = SqlFunctions.StringConvert((Double)C.ClientID).Trim(),
        //                            SiteID = SqlFunctions.StringConvert((Double)S.Id).Trim()
        //                        }).ToList();
        //            }
        //            else if (Field == "Client")
        //            {
        //                return (from O in context.Owners
        //                        join P in context.Properties
        //                         on O.PropertyID equals P.ID
        //                        join S in context.SiteMasters
        //                        on O.SiteID equals S.Id
        //                        join C in context.ClientMasters
        //                        on S.ClientID equals C.ClientID
        //                        where (O.IsDeleted == 0 && P.IsDeleted == 0 && S.IsDeleted == 0 && C.DeleteStatus == 0 && C.Name.Contains(value))
        //                        orderby O.CreateDate descending, O.ModifyDate descending
        //                        select new OwnerList()
        //                        {
        //                            OwnerID = SqlFunctions.StringConvert((Double)O.ID).Trim(),
        //                            ContactName = ((O.FirstName.Trim() != "") ? O.FirstName.Trim() : "") + "   " + ((O.LastName.Trim() == null) ? "" : O.LastName.Trim()),
        //                            FirstName= O.FirstName,
        //                            LastName=O.LastName,
        //                            PropertyNo = P.PropertyNumber + " " + P.Address1,
        //                            StartDate = O.StartDate,
        //                            ClientID = SqlFunctions.StringConvert((Double)C.ClientID).Trim(),
        //                            SiteID = SqlFunctions.StringConvert((Double)S.Id).Trim()
        //                        }).ToList();
        //            }
        //            else if (Field == "Site")
        //            {
        //                return (from O in context.Owners
        //                        join P in context.Properties
        //                         on O.PropertyID equals P.ID
        //                        join S in context.SiteMasters
        //                        on O.SiteID equals S.Id
        //                        join C in context.ClientMasters
        //                        on S.ClientID equals C.ClientID
        //                        where (O.IsDeleted == 0 && P.IsDeleted == 0 && S.IsDeleted == 0 && C.DeleteStatus == 0 && S.SiteName.Contains(value))
        //                        orderby O.CreateDate descending, O.ModifyDate descending
        //                        select new OwnerList()
        //                        {
        //                            OwnerID = SqlFunctions.StringConvert((Double)O.ID).Trim(),
        //                            ContactName = ((O.FirstName.Trim() != "") ? O.FirstName.Trim() : "") + "   " + ((O.LastName.Trim() == null) ? "" : O.LastName.Trim()),
        //                            FirstName = O.FirstName,
        //                            LastName = O.LastName,
        //                            PropertyNo = P.PropertyNumber + " " + P.Address1,
        //                            StartDate = O.StartDate,
        //                            ClientID = SqlFunctions.StringConvert((Double)C.ClientID).Trim(),
        //                            SiteID = SqlFunctions.StringConvert((Double)S.Id).Trim()
        //                        }).ToList();
        //            }
        //            else if (Field == "Contact")
        //            {
        //                return (from O in context.Owners
        //                        join P in context.Properties
        //                         on O.PropertyID equals P.ID
        //                        join S in context.SiteMasters
        //                        on O.SiteID equals S.Id
        //                        join C in context.ClientMasters
        //                        on S.ClientID equals C.ClientID
        //                        where (O.IsDeleted == 0 && P.IsDeleted == 0 && S.IsDeleted == 0 && C.DeleteStatus == 0 && O.ContactName.Contains(value))
        //                        orderby O.CreateDate descending, O.ModifyDate descending
        //                        select new OwnerList()
        //                        {
        //                            OwnerID = SqlFunctions.StringConvert((Double)O.ID).Trim(),
        //                            ContactName = ((O.FirstName.Trim() != "") ? O.FirstName.Trim() : "") + "   " + ((O.LastName.Trim() == null) ? "" : O.LastName.Trim()),
        //                            FirstName = O.FirstName,
        //                            LastName = O.LastName,
        //                            PropertyNo = P.PropertyNumber + " " + P.Address1,
        //                            StartDate = O.StartDate,
        //                            ClientID = SqlFunctions.StringConvert((Double)C.ClientID).Trim(),
        //                            SiteID = SqlFunctions.StringConvert((Double)S.Id).Trim()
        //                        }).ToList();
        //            }
        //            else
        //            {
        //                return (from O in context.Owners
        //                        join P in context.Properties
        //                         on O.PropertyID equals P.ID
        //                        join S in context.SiteMasters
        //                        on O.SiteID equals S.Id
        //                        join C in context.ClientMasters
        //                        on S.ClientID equals C.ClientID
        //                        where (O.IsDeleted == 0 && P.IsDeleted == 0 && S.IsDeleted == 0 && C.DeleteStatus == 0 && (O.ContactName.Contains(value) || S.SiteName.Contains(value) || C.Name.Contains(value) || P.PropertyNumber.Contains(value)))
        //                        orderby O.CreateDate descending, O.ModifyDate descending
        //                        select new OwnerList()
        //                        {
        //                            OwnerID = SqlFunctions.StringConvert((Double)O.ID).Trim(),
        //                            ContactName = ((O.FirstName.Trim() != "") ? O.FirstName.Trim() : "") + "   " + ((O.LastName.Trim() == null) ? "" : O.LastName.Trim()),
        //                            FirstName = O.FirstName,
        //                            LastName = O.LastName,
        //                            PropertyNo = P.PropertyNumber + " " + P.Address1,
        //                            StartDate = O.StartDate,
        //                            ClientID = SqlFunctions.StringConvert((Double)C.ClientID).Trim(),
        //                            SiteID = SqlFunctions.StringConvert((Double)S.Id).Trim()
        //                        }).ToList();
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        throw;
        //    }
        //}//OwnerRecordList
        public static OwnerList ViewOwnerRecord(Int64 ownerID)
        {
            OwnerList owner = new OwnerList();
               using (var context = new SycousCon())
               {
               try
               {
                   owner = (from O in context.Owners
                            join P in context.Properties
                             on O.PropertyID equals P.ID
                            join S in context.SiteMasters
                            on O.SiteID equals S.Id
                            join C in context.ClientMasters
                            on S.ClientID equals C.ClientID
                            where (O.IsDeleted == 0 && P.IsDeleted == 0 && S.IsDeleted == 0 && C.DeleteStatus == 0 && O.ID == ownerID)
                            orderby O.CreateDate descending, O.ModifyDate descending
                            select new OwnerList()
                            {
                                OwnerID = SqlFunctions.StringConvert((Double)O.ID).Trim(),
                                ContactName = ((O.FirstName.Trim() != "") ? O.FirstName.Trim() : "") + "   " + ((O.LastName.Trim() == null) ? "" : O.LastName.Trim()),
                                PropertyNo = P.PropertyNumber + "" + P.Address1 ,
                                StartDate = O.StartDate,
                                Email = O.Email,
                                IsMailService = O.MailService,
                                BankName = O.BankName,
                                BankSortCode = O.BankSortCode,
                                BankAccountNo = O.BankAccountNo,
                                Address1 = O.Address1,
                                Address2 = O.Address2,
                                City= O.City,
                                County = O.County,
                                Telephone = O.Telephone,
                                Mobile = O.Mobile,
                                Agent = O.Agent,
                                Client= C.Name,
                                Site = S.SiteName,
                                FirstName= O.FirstName,
                                LastName=O.LastName,
                                Notes = O.Notes,
                                AgentTelephone = O.AgentTelephone,
                                AgentEmail= O.AgentEmail,
                                ClientRef = O.ClientRefNo,
                                OwnerType ="1"
                            }).FirstOrDefault();

                   return owner;

               }
               catch (Exception ex)
               {
                   context.Dispose();
                   throw;
               }
               }
        }
Пример #5
0
        public static OwnerList ViewOwnerAsClientRecord(String OwnerID)
        {
            OwnerList Owner = new OwnerList();
               using (var context = new SycousCon())
               {
               try
               {
                   var parmode = new SqlParameter
                   {
                       ParameterName = "mode",
                       Value = "3",
                       Direction = ParameterDirection.Input
                   };

                   var pOwnerID = new SqlParameter
                   {
                       ParameterName = "OwnerID",
                       Value = OwnerID,
                       Direction = ParameterDirection.Input
                   };
                   Owner = context.ExecuteStoreQuery<OwnerList>("exec [SYCOUS].[PropertyOwnerList] @mode,@OwnerID", parmode, pOwnerID).FirstOrDefault();

                   return Owner;
               }
               catch (Exception ex)
               {
                   context.Dispose();
                   throw;
               }
               }
        }
Пример #6
0
 public ActionResult OView(String OwnerID , String Type)
 {
     if (Session["Login"] != null)
     {
         LoginSession loginsession = (LoginSession)Session["Login"];
         ViewBag.CompanyLogo = loginsession.CompanyLogo;
         ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
         String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
         String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
         ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
         if ((OwnerID != null) && (Type != null))
         {
             String Dec_OwnerID = BAL.Security.URLDecrypt(OwnerID);
             String DOwnerType = BAL.Security.URLDecrypt(Type);
             DAL.OwnerList owner = new DAL.OwnerList();
             if ((Dec_OwnerID != "0") && (Dec_OwnerID != null))
             {
                 try
                 {
                     if (DOwnerType == "1")
                     {
                         owner = BAL.OwnerModel.ViewOwner(Dec_OwnerID);
                     }
                     if (DOwnerType == "2")
                     {
                         owner = BAL.OwnerModel.ViewOwnerAsClientRecord(Dec_OwnerID);
                     }
                 }
                 catch (Exception ex)
                 {
                     return Content("Execption:" + ex.Message);
                 }
             }
             return View(owner);
         }
         else
         { return RedirectToAction("Index", "Notify"); }
     }
     else
     { return RedirectToAction("Index", "Home"); }
 }