Beispiel #1
0
        public TResponse UpdateStatusByTypeId(string type, int ID, bool Status)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    UserProfile objUserProfile = db.UserProfileRepository.Get(x => x.Type == type && x.UserId == ID).FirstOrDefault();
                    if (objUserProfile != null && objUserProfile.UserId > 0)
                    {
                        objUserProfile.IsActive = Status;
                        db.UserProfileRepository.Update(objUserProfile);
                    }
                    objTResponse.Status  = ResponseStaus.ok;
                    objTResponse.Message = ResponseMessage.success;
                }
                catch (Exception ex)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "DeleteUserProfile", Id = 0, ClassName = "UserProfileBusiness", Error = ex.Message
                    });
                    return(objTResponse);
                }

                return(objTResponse);
            }
        }
Beispiel #2
0
        public TResponse Delete(int ID)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    SurveyStatu objSurveyStatusStatus = db.SurveyStatusRepository.GetById(ID);
                    if (objSurveyStatusStatus != null && objSurveyStatusStatus.ID > 0)
                    {
                        objSurveyStatusStatus.IsDeleted = true;
                        db.SurveyStatusRepository.Update(objSurveyStatusStatus);
                    }


                    objTResponse.Status  = ResponseStaus.ok;
                    objTResponse.Message = ResponseMessage.success;
                }
                catch (Exception ex)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "DeleteSurveyStatusStatus", Id = 0, ClassName = "SurveyStatusStatusBusiness", Error = ex.Message
                    });
                    return(objTResponse);
                }

                return(objTResponse);
            }
        }
Beispiel #3
0
        public TResponse Delete(int ID)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    UserProfile objUserProfile = db.UserProfileRepository.GetById(ID);
                    if (objUserProfile != null && objUserProfile.UserId > 0)
                    {
                        objUserProfile.IsDeleted = true;
                        db.UserProfileRepository.Update(objUserProfile);
                    }


                    objTResponse.Status  = ResponseStaus.ok;
                    objTResponse.Message = ResponseMessage.success;
                }
                catch (Exception ex)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "DeleteUserProfile", Id = 0, ClassName = "UserProfileBusiness", Error = ex.Message
                    });
                    return(objTResponse);
                }

                return(objTResponse);
            }
        }
        public TResponse UpdateStatus(int ID, bool Status)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    Survey objSurveyDetail = db.SurveyRepository.GetById(ID);
                    if (objSurveyDetail != null && objSurveyDetail.ID > 0)
                    {
                        objSurveyDetail.IsActive = Status;
                        db.SurveyRepository.Update(objSurveyDetail);
                    }
                    objTResponse.Status  = ResponseStaus.ok;
                    objTResponse.Message = ResponseMessage.success;
                }
                catch (Exception ex)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "DeleteSurveyDetail", Id = 0, ClassName = "SurveyDetailBusiness", Error = ex.Message
                    });
                    return(objTResponse);
                }

                return(objTResponse);
            }
        }
Beispiel #5
0
        public TResponse AddUpdate(SurveyStatusModel objSurveyStatusModel)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    SurveyStatu objSurveyStatus = db.SurveyStatusRepository.Get(x => x.ID == objSurveyStatusModel.ID).FirstOrDefault();

                    if (objSurveyStatus == null)
                    {
                        objSurveyStatus = new SurveyStatu();

                        objSurveyStatus.Title     = objSurveyStatusModel.Title;
                        objSurveyStatus.IsDeleted = false;
                        objSurveyStatus.CreatedOn = DateTime.Now;

                        objSurveyStatus = objSurveyStatus = db.SurveyStatusRepository.Insert(objSurveyStatus);
                    }
                    else
                    {
                        objSurveyStatus       = new SurveyStatu();
                        objSurveyStatus.ID    = objSurveyStatusModel.ID;
                        objSurveyStatus.Title = objSurveyStatusModel.Title;

                        objSurveyStatus.IsDeleted = objSurveyStatusModel.IsDeleted;
                        objSurveyStatus.CreatedOn = objSurveyStatusModel.CreatedOn;
                        objSurveyStatus.UpdatedOn = DateTime.Now;
                        objSurveyStatus           = objSurveyStatus = db.SurveyStatusRepository.Update(objSurveyStatus);
                    }
                    if (objSurveyStatus != null)
                    {
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = "";
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "AddSurveyStatusStatus", Id = objSurveyStatusModel.ID, ClassName = "SurveyStatusStatusBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
Beispiel #6
0
        public TResponse GetAll()
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    List <CustomerModel> lstCustomerModel = new List <CustomerModel>();
                    CustomerModel        objCustomerModel;
                    List <Customer>      lstCustomer = db.CustomerRepository.GetAll().ToList();
                    if (lstCustomer != null && lstCustomer.Count > 0)
                    {
                        foreach (Customer objCustomer in lstCustomer)
                        {
                            objCustomerModel    = new CustomerModel();
                            objCustomerModel.ID = objCustomer.ID;

                            objCustomerModel.FName    = objCustomer.FName;
                            objCustomerModel.LName    = objCustomer.LName;
                            objCustomerModel.Email    = objCustomer.Email;
                            objCustomerModel.Phone    = objCustomer.Phone;
                            objCustomerModel.Address1 = objCustomer.Address1;
                            objCustomerModel.Address2 = objCustomer.Address2;
                            objCustomerModel.City     = objCustomer.City;

                            objCustomerModel.IsActive  = Convert.ToBoolean(objCustomer.IsActive);
                            objCustomerModel.IsDeleted = Convert.ToBoolean(objCustomer.IsDeleted);

                            objCustomerModel.UpdatedOn = DateTime.Now;
                            lstCustomerModel.Add(objCustomerModel);
                        }
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = lstCustomerModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "ListCustomer", Id = 0, ClassName = "CustomerBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
Beispiel #7
0
        public TResponse GetAllUserByType(string type)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    UserProfileModel        objUserProfileModel;
                    List <UserProfileModel> lstUserProfileModel = new List <UserProfileModel>();
                    List <UserProfile>      lstUserProfile      = db.UserProfileRepository.Get(x => x.Type == type).ToList();
                    if (lstUserProfile != null)
                    {
                        foreach (UserProfile objUserProfile in lstUserProfile)
                        {
                            objUserProfileModel           = new UserProfileModel();
                            objUserProfileModel.UserId    = objUserProfile.UserId;
                            objUserProfileModel.FName     = objUserProfile.FName;
                            objUserProfileModel.LName     = objUserProfile.LName;
                            objUserProfileModel.Email     = objUserProfile.Email;
                            objUserProfileModel.Phone     = objUserProfile.Phone;
                            objUserProfileModel.Address1  = objUserProfile.Address1;
                            objUserProfileModel.Address2  = objUserProfile.Address2;
                            objUserProfileModel.City      = objUserProfile.City;
                            objUserProfileModel.IsActive  = Convert.ToBoolean(objUserProfile.IsActive);
                            objUserProfileModel.IsDeleted = objUserProfileModel.IsDeleted;
                            objUserProfileModel.CreatedOn = objUserProfileModel.CreatedOn;

                            lstUserProfileModel.Add(objUserProfileModel);
                        }
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = lstUserProfileModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "GetByType", Id = 0, ClassName = "UserProfileBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
Beispiel #8
0
 public TResponse GetAll()
 {
     using (var db = new UnitOfWork())
     {
         try
         {
             List <PilotModel> lstPilotModel = new List <PilotModel>();
             PilotModel        objPilotModel;
             List <Pilot>      lstPilot = db.PilotRepository.GetAll().ToList();
             if (lstPilot != null && lstPilot.Count > 0)
             {
                 foreach (Pilot obj in lstPilot)
                 {
                     objPilotModel    = new PilotModel();
                     objPilotModel.ID = obj.ID;
                     //objPilotModel.UserId =Convert.ToInt16(obj.UserId);
                     objPilotModel.FName     = obj.FName;
                     objPilotModel.LName     = obj.LName;
                     objPilotModel.Email     = obj.Email;
                     objPilotModel.Phone     = obj.Phone;
                     objPilotModel.Address1  = obj.Address1;
                     objPilotModel.Address2  = obj.Address2;
                     objPilotModel.City      = obj.City;
                     objPilotModel.IsActive  = Convert.ToBoolean(obj.IsActive);
                     objPilotModel.IsDeleted = Convert.ToBoolean(obj.IsDeleted);
                     objPilotModel.CreatedOn = Convert.ToDateTime(obj.CreatedOn);
                     lstPilotModel.Add(objPilotModel);
                 }
                 objTResponse.Status         = ResponseStaus.ok;
                 objTResponse.Message        = ResponseMessage.success;
                 objTResponse.ResponsePacket = lstPilotModel;
             }
             else
             {
                 objTResponse.Status         = ResponseStaus.error;
                 objTResponse.Message        = ResponseMessage.ItemNotFound;
                 objTResponse.ResponsePacket = null;
             }
             return(objTResponse);
         }
         catch (DbEntityValidationException dbEx)
         {
             ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
             objerrorlog.AddErrorLog(new ErrorLogModel {
                 MethodName = "ListPilot", Id = 0, ClassName = "PilotBusiness", Error = dbEx.Message
             });
             return(objTResponse);
         }
     }
 }
Beispiel #9
0
        public TResponse GetByID(long Id)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    CustomerModel objCustomerModel = new CustomerModel();
                    Customer      objCustomer      = db.CustomerRepository.Get(x => x.ID == Id).FirstOrDefault();
                    if (objCustomer != null)
                    {
                        objCustomerModel.ID = objCustomer.ID;

                        objCustomerModel.FName    = objCustomer.FName;
                        objCustomerModel.LName    = objCustomer.LName;
                        objCustomerModel.Email    = objCustomer.Email;
                        objCustomerModel.Phone    = objCustomer.Phone;
                        objCustomerModel.Address1 = objCustomer.Address1;
                        objCustomerModel.Address2 = objCustomer.Address2;
                        objCustomerModel.City     = objCustomer.City;

                        objCustomerModel.IsActive  = Convert.ToBoolean(objCustomer.IsActive);
                        objCustomerModel.IsDeleted = Convert.ToBoolean(objCustomer.IsDeleted);

                        objCustomerModel.UpdatedOn = Convert.ToDateTime(objCustomer.UpdatedOn);


                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = objCustomerModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "GetByID", Id = Id, ClassName = "CustomerBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
        //public TResponse AddUpdate(AssignedCustomerModel objAssignedCustomerModel)
        //{
        //    using (var db = new UnitOfWork())
        //    {
        //        try
        //        {
        //            AssignedCustomer objAssignedCustomer = db.AssignedCustomerRepository.Get(x => x.Id == objAssignedCustomerModel.UserId).FirstOrDefault();

        //            if (objAssignedCustomer == null)
        //            {
        //                objAssignedCustomer = new AssignedCustomer();

        //                objAssignedCustomer.CustomerID = objAssignedCustomerModel.CustomerID;
        //                objAssignedCustomer.PilotID = objAssignedCustomerModel.PilotID;

        //                objAssignedCustomer.IsActive = true;
        //                objAssignedCustomer.IsDeleted = false;
        //                objAssignedCustomer.CreatedOn = DateTime.Now;
        //                objAssignedCustomer = db.AssignedCustomerRepository.Insert(objAssignedCustomer);
        //            }
        //            else
        //            {
        //                objAssignedCustomer.Id = Convert.ToInt16(objAssignedCustomerModel.Id);
        //                objAssignedCustomer.CustomerID = objAssignedCustomerModel.CustomerID;
        //                objAssignedCustomer.PilotID = objAssignedCustomerModel.PilotID;

        //                objAssignedCustomer.UpdatedOn = DateTime.Now;
        //                objAssignedCustomer = db.AssignedCustomerRepository.Update(objAssignedCustomer);
        //            }
        //            if (objAssignedCustomer != null)
        //            {
        //                objAssignedCustomerModel = new AssignedCustomerModel();
        //                objAssignedCustomerModel.Id = objAssignedCustomer.Id;
        //                objAssignedCustomerModel.CustomerID = objAssignedCustomer.CustomerID;
        //                objAssignedCustomerModel.PilotID = objAssignedCustomer.PilotID;

        //                objAssignedCustomerModel.IsActive = Convert.ToBoolean(objAssignedCustomer.IsActive);
        //                objAssignedCustomerModel.IsDeleted = objAssignedCustomerModel.IsDeleted;
        //                objAssignedCustomerModel.CreatedOn = objAssignedCustomerModel.CreatedOn;

        //                objTResponse.Status = ResponseStaus.ok;
        //                objTResponse.Message = ResponseMessage.success;
        //                objTResponse.ResponsePacket = objAssignedCustomerModel;
        //            }
        //            else
        //            {
        //                objTResponse.Status = ResponseStaus.error;
        //                objTResponse.Message = ResponseMessage.ItemNotFound;
        //                objTResponse.ResponsePacket = null;
        //            }
        //            return objTResponse;
        //        }
        //        catch (DbEntityValidationException dbEx)
        //        {
        //            ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
        //            objerrorlog.AddErrorLog(new ErrorLogModel { MethodName = "AddAssignedCustomer", Id = objAssignedCustomerModel.UserId, ClassName = "AssignedCustomerBusiness", Error = dbEx.Message });
        //            return objTResponse;
        //        }
        //    }
        //}

        //public TResponse GetByID(long Id)
        //{
        //    using (var db = new UnitOfWork())
        //    {
        //        try
        //        {
        //            AssignedCustomerModel objAssignedCustomerModel = new AssignedCustomerModel();
        //            AssignedCustomer objAssignedCustomer = db.AssignedCustomerRepository.Get(x => x.UserId == Id).FirstOrDefault();
        //            if (objAssignedCustomer != null)
        //            {
        //                objAssignedCustomerModel.Id = objAssignedCustomer.Id;
        //                objAssignedCustomerModel.CustomerID = objAssignedCustomer.CustomerID;
        //                objAssignedCustomerModel.PilotID = objAssignedCustomer.PilotID;

        //                objAssignedCustomerModel.IsActive = Convert.ToBoolean(objAssignedCustomer.IsActive);
        //                objAssignedCustomerModel.IsDeleted = objAssignedCustomerModel.IsDeleted;
        //                objAssignedCustomerModel.CreatedOn = objAssignedCustomerModel.CreatedOn;
        //                objTResponse.Status = ResponseStaus.ok;
        //                objTResponse.Message = ResponseMessage.success;
        //                objTResponse.ResponsePacket = objAssignedCustomerModel;

        //            }
        //            else
        //            {
        //                objTResponse.Status = ResponseStaus.error;
        //                objTResponse.Message = ResponseMessage.ItemNotFound;
        //                objTResponse.ResponsePacket = null;
        //            }
        //            return objTResponse;
        //        }
        //        catch (DbEntityValidationException dbEx)
        //        {
        //            ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
        //            objerrorlog.AddErrorLog(new ErrorLogModel { MethodName = "GetByID", Id = Id, ClassName = "AssignedCustomerBusiness", Error = dbEx.Message });
        //            return objTResponse;
        //        }
        //    }
        //}

        public TResponse GetByPilot(long Id)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    List <AssignedCustomerModel> lstAssignedCustomerModel = new List <AssignedCustomerModel>();
                    AssignedCustomerModel        objAssignedCustomerModel = new AssignedCustomerModel();
                    List <AssignedCustomer>      lstAssignedCustomer      = db.AssignedCustomerRepository.Get(x => x.PilotID == Id).ToList();
                    if (lstAssignedCustomer != null)
                    {
                        foreach (AssignedCustomer objAssignedCustomer in lstAssignedCustomer)
                        {
                            objAssignedCustomerModel            = new AssignedCustomerModel();
                            objAssignedCustomerModel.Id         = objAssignedCustomer.Id;
                            objAssignedCustomerModel.CustomerID = objAssignedCustomer.CustomerID;
                            objAssignedCustomerModel.PilotID    = objAssignedCustomer.PilotID;

                            objAssignedCustomerModel.CustomerName = objAssignedCustomer.UserProfile.FName + " " + objAssignedCustomer.UserProfile.LName;
                            objAssignedCustomerModel.PilotName    = objAssignedCustomer.UserProfile.FName + " " + objAssignedCustomer.UserProfile.LName;

                            objAssignedCustomerModel.IsActive  = Convert.ToBoolean(objAssignedCustomer.IsActive);
                            objAssignedCustomerModel.IsDeleted = objAssignedCustomerModel.IsDeleted;
                            objAssignedCustomerModel.CreatedOn = objAssignedCustomerModel.CreatedOn;
                            lstAssignedCustomerModel.Add(objAssignedCustomerModel);
                        }
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = lstAssignedCustomerModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "GetByID", Id = Id, ClassName = "AssignedCustomerBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
 public TResponse GetAll()
 {
     using (var db = new UnitOfWork())
     {
         try
         {
             List <CustomerLocationModel> lstCustomerLocationModel = new List <CustomerLocationModel>();
             CustomerLocationModel        objCustomerLocationModel;
             List <CustomerLocation>      lstCustomerLocation = db.CustomerLocationRepository.Get().ToList();
             if (lstCustomerLocation != null && lstCustomerLocation.Count > 0)
             {
                 foreach (CustomerLocation objCustomerLocation in lstCustomerLocation)
                 {
                     objCustomerLocationModel              = new CustomerLocationModel();
                     objCustomerLocationModel.ID           = objCustomerLocation.ID;
                     objCustomerLocationModel.CustomerID   = Convert.ToInt64(objCustomerLocation.CustomerID);
                     objCustomerLocationModel.CustomerName = objCustomerLocation.UserProfile.FName + " " + objCustomerLocation.UserProfile.LName;
                     objCustomerLocationModel.Location     = objCustomerLocation.Location;
                     objCustomerLocationModel.LocationName = objCustomerLocation.LocationName;
                     objCustomerLocationModel.IsActive     = Convert.ToBoolean(objCustomerLocation.IsActive);
                     objCustomerLocationModel.IsDeleted    = Convert.ToBoolean(objCustomerLocation.IsDeleted);
                     objCustomerLocationModel.CreatedOn    = Convert.ToDateTime(objCustomerLocation.CreatedOn);
                     objCustomerLocationModel.UpdatedOn    = Convert.ToDateTime(objCustomerLocation.UpdatedOn);
                     objCustomerLocationModel.UpdatedOn    = Convert.ToDateTime(objCustomerLocation.UpdatedOn);
                     lstCustomerLocationModel.Add(objCustomerLocationModel);
                 }
                 objTResponse.Status         = ResponseStaus.ok;
                 objTResponse.Message        = ResponseMessage.success;
                 objTResponse.ResponsePacket = lstCustomerLocationModel;
             }
             else
             {
                 objTResponse.Status         = ResponseStaus.error;
                 objTResponse.Message        = ResponseMessage.ItemNotFound;
                 objTResponse.ResponsePacket = null;
             }
             return(objTResponse);
         }
         catch (DbEntityValidationException dbEx)
         {
             ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
             objerrorlog.AddErrorLog(new ErrorLogModel {
                 MethodName = "ListCustomerLocation", Id = 0, ClassName = "CustomerLocationBusiness", Error = dbEx.Message
             });
             return(objTResponse);
         }
     }
 }
        public TResponse GetAll()
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    List <AssignedCustomerModel> lstAssignedCustomerModel = new List <AssignedCustomerModel>();
                    AssignedCustomerModel        objAssignedCustomerModel;
                    List <AssignedCustomer>      lstAssignedCustomer = db.AssignedCustomerRepository.GetAll().ToList();
                    if (lstAssignedCustomer != null && lstAssignedCustomer.Count > 0)
                    {
                        foreach (AssignedCustomer obj in lstAssignedCustomer)
                        {
                            objAssignedCustomerModel            = new AssignedCustomerModel();
                            objAssignedCustomerModel.Id         = obj.Id;
                            objAssignedCustomerModel.CustomerID = obj.CustomerID;
                            objAssignedCustomerModel.PilotID    = obj.PilotID;

                            objAssignedCustomerModel.IsActive  = Convert.ToBoolean(obj.IsActive);
                            objAssignedCustomerModel.IsDeleted = Convert.ToBoolean(obj.IsDeleted);
                            objAssignedCustomerModel.CreatedOn = Convert.ToDateTime(obj.CreatedOn);
                            lstAssignedCustomerModel.Add(objAssignedCustomerModel);
                        }
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = lstAssignedCustomerModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "ListAssignedCustomer", Id = 0, ClassName = "AssignedCustomerBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
Beispiel #13
0
 public TResponse GetByTypeID(string type, long Id)
 {
     using (var db = new UnitOfWork())
     {
         try
         {
             UserProfileModel objUserProfileModel = new UserProfileModel();
             UserProfile      objUserProfile      = db.UserProfileRepository.Get(x => x.UserId == Id && x.Type == type).FirstOrDefault();
             if (objUserProfile != null)
             {
                 objUserProfileModel.UserId    = objUserProfile.UserId;
                 objUserProfileModel.FName     = objUserProfile.FName;
                 objUserProfileModel.LName     = objUserProfile.LName;
                 objUserProfileModel.Email     = objUserProfile.Email;
                 objUserProfileModel.Password  = objUserProfile.Password;
                 objUserProfileModel.Type      = objUserProfile.Type;
                 objUserProfileModel.Phone     = objUserProfile.Phone;
                 objUserProfileModel.Address1  = objUserProfile.Address1;
                 objUserProfileModel.Address2  = objUserProfile.Address2;
                 objUserProfileModel.City      = objUserProfile.City;
                 objUserProfileModel.IsActive  = Convert.ToBoolean(objUserProfile.IsActive);
                 objUserProfileModel.IsDeleted = objUserProfileModel.IsDeleted;
                 objUserProfileModel.CreatedOn = objUserProfileModel.CreatedOn;
                 objTResponse.Status           = ResponseStaus.ok;
                 objTResponse.Message          = ResponseMessage.success;
                 objTResponse.ResponsePacket   = objUserProfileModel;
             }
             else
             {
                 objTResponse.Status         = ResponseStaus.error;
                 objTResponse.Message        = ResponseMessage.ItemNotFound;
                 objTResponse.ResponsePacket = null;
             }
             return(objTResponse);
         }
         catch (DbEntityValidationException dbEx)
         {
             ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
             objerrorlog.AddErrorLog(new ErrorLogModel {
                 MethodName = "GetByID", Id = Id, ClassName = "UserProfileBusiness", Error = dbEx.Message
             });
             return(objTResponse);
         }
     }
 }
Beispiel #14
0
 public TResponse PilotLogin(string email, string pasword, string type)
 {
     using (var db = new UnitOfWork())
     {
         try
         {
             PilotModel  objPilotModel = new PilotModel();
             UserProfile objPilot      = db.UserProfileRepository.Get(x => x.Email == email && x.Password == pasword && x.Type == type && x.IsDeleted == false).FirstOrDefault();
             if (objPilot != null)
             {
                 objPilotModel.UserId        = objPilot.UserId;
                 objPilotModel.FName         = objPilot.FName;
                 objPilotModel.LName         = objPilot.LName;
                 objPilotModel.Email         = objPilot.Email;
                 objPilotModel.Password      = objPilot.Password;
                 objPilotModel.Phone         = objPilot.Phone;
                 objPilotModel.Address1      = objPilot.Address1;
                 objPilotModel.Address2      = objPilot.Address2;
                 objPilotModel.City          = objPilot.City;
                 objPilotModel.IsActive      = Convert.ToBoolean(objPilot.IsActive);
                 objPilotModel.IsDeleted     = objPilotModel.IsDeleted;
                 objPilotModel.CreatedOn     = objPilotModel.CreatedOn;
                 objTResponse.Status         = ResponseStaus.ok;
                 objTResponse.Message        = ResponseMessage.success;
                 objTResponse.ResponsePacket = objPilotModel;
             }
             else
             {
                 objTResponse.Status         = ResponseStaus.error;
                 objTResponse.Message        = ResponseMessage.ItemNotFound;
                 objTResponse.ResponsePacket = null;
             }
             return(objTResponse);
         }
         catch (DbEntityValidationException dbEx)
         {
             ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
             objerrorlog.AddErrorLog(new ErrorLogModel {
                 MethodName = "PilotLogin", Id = 0, ClassName = "PilotBusiness", Error = dbEx.Message
             });
             return(objTResponse);
         }
     }
 }
Beispiel #15
0
 public TResponse GetByID(long Id)
 {
     using (var db = new UnitOfWork())
     {
         try
         {
             PilotModel objPilotModel = new PilotModel();
             Pilot      objPilot      = db.PilotRepository.Get(x => x.ID == Id).FirstOrDefault();
             if (objPilot != null)
             {
                 objPilotModel.ID = objPilot.ID;
                 //objPilotModel.UserId = Convert.ToInt16(objPilot.UserId);
                 objPilotModel.FName         = objPilot.FName;
                 objPilotModel.LName         = objPilot.LName;
                 objPilotModel.Email         = objPilot.Email;
                 objPilotModel.Phone         = objPilot.Phone;
                 objPilotModel.Address1      = objPilot.Address1;
                 objPilotModel.Address2      = objPilot.Address2;
                 objPilotModel.City          = objPilot.City;
                 objPilotModel.IsActive      = Convert.ToBoolean(objPilot.IsActive);
                 objPilotModel.IsDeleted     = objPilotModel.IsDeleted;
                 objPilotModel.CreatedOn     = objPilotModel.CreatedOn;
                 objTResponse.Status         = ResponseStaus.ok;
                 objTResponse.Message        = ResponseMessage.success;
                 objTResponse.ResponsePacket = objPilotModel;
             }
             else
             {
                 objTResponse.Status         = ResponseStaus.error;
                 objTResponse.Message        = ResponseMessage.ItemNotFound;
                 objTResponse.ResponsePacket = null;
             }
             return(objTResponse);
         }
         catch (DbEntityValidationException dbEx)
         {
             ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
             objerrorlog.AddErrorLog(new ErrorLogModel {
                 MethodName = "GetByID", Id = Id, ClassName = "PilotBusiness", Error = dbEx.Message
             });
             return(objTResponse);
         }
     }
 }
        public TResponse GetAll()
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    List <DroneEquipmentModel> lstDroneEquipmentModel = new List <DroneEquipmentModel>();
                    DroneEquipmentModel        objDroneEquipmentModel;
                    List <DroneEquipment>      lstDroneEquipment = db.DroneEquipmentRepository.GetAll().ToList();
                    if (lstDroneEquipment != null && lstDroneEquipment.Count > 0)
                    {
                        foreach (DroneEquipment obj in lstDroneEquipment)
                        {
                            objDroneEquipmentModel              = new DroneEquipmentModel();
                            objDroneEquipmentModel.ID           = obj.ID;
                            objDroneEquipmentModel.Model        = obj.Model;
                            objDroneEquipmentModel.SerialNumber = obj.SerialNumber;
                            objDroneEquipmentModel.IsActive     = Convert.ToBoolean(obj.IsActive);
                            objDroneEquipmentModel.IsDeleted    = objDroneEquipmentModel.IsDeleted;

                            lstDroneEquipmentModel.Add(objDroneEquipmentModel);
                        }
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = lstDroneEquipmentModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "ListDroneEquipment", Id = 0, ClassName = "DroneEquipmentBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
Beispiel #17
0
        public TResponse GetAll()
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    List <SurveyStatusModel> lstSurveyStatusModel = new List <SurveyStatusModel>();
                    SurveyStatusModel        objSurveyStatusModel;
                    List <SurveyStatu>       lstSurveyStatus = db.SurveyStatusRepository.GetAll().ToList();
                    if (lstSurveyStatus != null && lstSurveyStatus.Count > 0)
                    {
                        foreach (SurveyStatu objSurveyStatus in lstSurveyStatus)
                        {
                            objSurveyStatusModel       = new SurveyStatusModel();
                            objSurveyStatusModel.ID    = objSurveyStatus.ID;
                            objSurveyStatusModel.Title = objSurveyStatus.Title;

                            objSurveyStatusModel.IsDeleted = Convert.ToBoolean(objSurveyStatus.IsDeleted);
                            objSurveyStatusModel.CreatedOn = Convert.ToDateTime(objSurveyStatus.CreatedOn);
                            objSurveyStatusModel.UpdatedOn = Convert.ToDateTime(objSurveyStatus.UpdatedOn);
                            lstSurveyStatusModel.Add(objSurveyStatusModel);
                        }
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = lstSurveyStatusModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "ListSurveyStatusStatus", Id = 0, ClassName = "SurveyStatusStatusBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
        public TResponse GetByID(long Id)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    CustomerLocationModel objCustomerLocationModel = new CustomerLocationModel();
                    CustomerLocation      objCustomerLocation      = db.CustomerLocationRepository.Get(x => x.ID == Id).FirstOrDefault();
                    if (objCustomerLocation != null)
                    {
                        objCustomerLocationModel.ID           = objCustomerLocation.ID;
                        objCustomerLocationModel.CustomerID   = Convert.ToInt64(objCustomerLocation.CustomerID);
                        objCustomerLocationModel.CustomerName = objCustomerLocation.UserProfile.FName + " " + objCustomerLocation.UserProfile.FName;
                        objCustomerLocationModel.Location     = objCustomerLocation.Location;
                        objCustomerLocationModel.LocationName = objCustomerLocation.LocationName;
                        objCustomerLocationModel.IsActive     = Convert.ToBoolean(objCustomerLocation.IsActive);
                        objCustomerLocationModel.IsDeleted    = Convert.ToBoolean(objCustomerLocation.IsDeleted);
                        objCustomerLocationModel.CreatedOn    = Convert.ToDateTime(objCustomerLocation.CreatedOn);
                        objCustomerLocationModel.UpdatedOn    = Convert.ToDateTime(objCustomerLocation.UpdatedOn);

                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = objCustomerLocationModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "GetByID", Id = Id, ClassName = "CustomerLocationBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
Beispiel #19
0
        public TResponse GetByID(long Id)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    SurveyStatusModel objSurveyStatusModel = new SurveyStatusModel();
                    SurveyStatu       objSurveyStatus      = db.SurveyStatusRepository.Get(x => x.ID == Id).FirstOrDefault();
                    if (objSurveyStatus != null)
                    {
                        objSurveyStatusModel.ID    = objSurveyStatus.ID;
                        objSurveyStatusModel.Title = objSurveyStatus.Title;

                        objSurveyStatusModel.IsDeleted = Convert.ToBoolean(objSurveyStatus.IsDeleted);
                        objSurveyStatusModel.CreatedOn = Convert.ToDateTime(objSurveyStatus.CreatedOn);
                        objSurveyStatusModel.UpdatedOn = Convert.ToDateTime(objSurveyStatus.UpdatedOn);

                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = objSurveyStatusModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "GetByID", Id = Id, ClassName = "SurveyStatusStatusBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
 public TResponse GetByID(long Id)
 {
     using (var db = new UnitOfWork())
     {
         try
         {
             DroneEquipmentModel objDroneEquipmentModel = new DroneEquipmentModel();
             DroneEquipment      objDroneEquipment      = db.DroneEquipmentRepository.Get(x => x.ID == Id).FirstOrDefault();
             if (objDroneEquipment != null)
             {
                 objDroneEquipmentModel              = new DroneEquipmentModel();
                 objDroneEquipmentModel.ID           = objDroneEquipment.ID;
                 objDroneEquipmentModel.Model        = objDroneEquipment.Model;
                 objDroneEquipmentModel.SerialNumber = objDroneEquipment.SerialNumber;
                 objDroneEquipmentModel.IsActive     = Convert.ToBoolean(objDroneEquipment.IsActive);
                 objDroneEquipmentModel.IsDeleted    = Convert.ToBoolean(objDroneEquipment.IsDeleted);
                 objDroneEquipmentModel.CreatedOn    = Convert.ToDateTime(objDroneEquipment.CreatedOn);
                 objTResponse.Status         = ResponseStaus.ok;
                 objTResponse.Message        = ResponseMessage.success;
                 objTResponse.ResponsePacket = objDroneEquipmentModel;
             }
             else
             {
                 objTResponse.Status         = ResponseStaus.error;
                 objTResponse.Message        = ResponseMessage.ItemNotFound;
                 objTResponse.ResponsePacket = null;
             }
             return(objTResponse);
         }
         catch (DbEntityValidationException dbEx)
         {
             ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
             objerrorlog.AddErrorLog(new ErrorLogModel {
                 MethodName = "GetByID", Id = Id, ClassName = "DroneEquipmentBusiness", Error = dbEx.Message
             });
             return(objTResponse);
         }
     }
 }
Beispiel #21
0
        public TResponse GetSurveyList(long PilotId)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    List <SurveyModel> lstSurveyModel = new List <SurveyModel>();
                    SurveyModel        objSurveyModel;
                    List <Survey>      lstSurvey = db.SurveyRepository.Get(x => x.PilotID == PilotId).ToList();
                    if (lstSurvey != null && lstSurvey.Count > 0)
                    {
                        foreach (Survey objSurvey in lstSurvey)
                        {
                            objSurveyModel            = new SurveyModel();
                            objSurveyModel.ID         = objSurvey.ID;
                            objSurveyModel.Title      = objSurvey.Title;
                            objSurveyModel.SurveyDate = Convert.ToDateTime(objSurvey.SurveyDate);
                            //objSurveyModel.SurveyTime = Convert.ToDateTime(objSurvey.SurveyTime).Ticks;
                            objSurveyModel.CustomerID   = Convert.ToInt64(objSurvey.CustomerID);
                            objSurveyModel.CustomerName = objSurvey.UserProfile.FName + " " + objSurvey.UserProfile.LName;

                            objSurveyModel.CustomerLocationID = Convert.ToInt64(objSurvey.CustomerLocationID);
                            objSurveyModel.PilotID            = Convert.ToInt32(objSurvey.PilotID);
                            objSurveyModel.DroneID            = Convert.ToInt32(objSurvey.DroneID);
                            objSurveyModel.SurveyStatusID     = Convert.ToInt32(objSurvey.SurveyStatusID);
                            objSurveyModel.EC_ATC             = objSurvey.EC_ATC;
                            objSurveyModel.EC_LocalPolice     = objSurvey.EC_LocalPolice;
                            objSurveyModel.EC_FireBrigde      = objSurvey.EC_FireBrigde;
                            objSurveyModel.EC_AE              = objSurvey.EC_AE;
                            objSurveyModel.WC_Wind            = objSurvey.WC_Wind;
                            objSurveyModel.WC_Precipitation   = objSurvey.WC_Precipitation;
                            objSurveyModel.WC_Visibility      = objSurvey.WC_Visibility;
                            objSurveyModel.WC_CloudCover      = objSurvey.WC_CloudCover;
                            objSurveyModel.WC_KP              = objSurvey.WC_KP;
                            objSurveyModel.W_SunRise          = objSurvey.W_SunRise;
                            objSurveyModel.W_SunSet           = objSurvey.W_SunSet;
                            objSurveyModel.W_CTAFS            = objSurvey.W_CTAFS;
                            objSurveyModel.W_WindSpeed        = objSurvey.W_WindSpeed;
                            objSurveyModel.W_Prepreciption    = objSurvey.W_Prepreciption;
                            objSurveyModel.W_Temperature      = objSurvey.W_Temperature;
                            objSurveyModel.W_Notams           = objSurvey.W_Notams;
                            objSurveyModel.SH_NotedStructure  = objSurvey.SH_NotedStructure;
                            objSurveyModel.SH_PedestrainRisk  = objSurvey.SH_PedestrainRisk;
                            objSurveyModel.SH_VehileRisk      = objSurvey.SH_VehileRisk;
                            objSurveyModel.SH_ATR             = objSurvey.SH_ATR;
                            objSurveyModel.SH_ExplosiveRisk   = objSurvey.SH_ExplosiveRisk;
                            objSurveyModel.MS_Name            = objSurvey.MS_Name;
                            objSurveyModel.MS_Telephone       = objSurvey.MS_Telephone;
                            objSurveyModel.MS_Email           = objSurvey.MS_Email;
                            objSurveyModel.FT_StartTime       = Convert.ToDateTime(objSurvey.FT_StartTime);
                            objSurveyModel.FT_EndTime         = Convert.ToDateTime(objSurvey.FT_EndTime);
                            objSurveyModel.TimeHack           = Convert.ToDateTime(objSurvey.TimeHack);
                            objSurveyModel.NearAreaPopulation = objSurvey.NearAreaPopulation;
                            objSurveyModel.SiteAddress        = objSurvey.SiteAddress;
                            objSurveyModel.OperatingArea      = objSurvey.OperatingArea;
                            objSurveyModel.Question           = objSurvey.Question;
                            objSurveyModel.WorkDescription    = objSurvey.WorkDescription;
                            objSurveyModel.Comments           = objSurvey.Comments;
                            objSurveyModel.IsActive           = Convert.ToBoolean(objSurvey.IsActive);
                            objSurveyModel.IsDeleted          = Convert.ToBoolean(objSurvey.IsDeleted);
                            objSurveyModel.CreatedOn          = Convert.ToDateTime(objSurvey.CreatedOn);
                            objSurveyModel.UpdatedOn          = Convert.ToDateTime(objSurvey.UpdatedOn);
                            lstSurveyModel.Add(objSurveyModel);
                        }
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = lstSurveyModel;
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "ListSurveyDetail", Id = 0, ClassName = "SurveyDetailBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
Beispiel #22
0
        public TResponse AddUpdate(SurveyModel objSurveyModel)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    Survey objSurvey = db.SurveyRepository.Get(x => x.ID == objSurveyModel.ID).FirstOrDefault();

                    if (objSurvey == null)
                    {
                        objSurvey                    = new Survey();
                        objSurvey.ID                 = objSurveyModel.ID;
                        objSurvey.Title              = objSurveyModel.Title;
                        objSurvey.SurveyDate         = objSurveyModel.SurveyDate;
                        objSurvey.SurveyTime         = objSurveyModel.SurveyTime;
                        objSurvey.CustomerID         = objSurveyModel.CustomerID;
                        objSurvey.CustomerLocationID = objSurveyModel.CustomerLocationID;
                        objSurvey.PilotID            = objSurveyModel.PilotID;
                        objSurvey.DroneID            = objSurveyModel.DroneID;
                        objSurvey.SurveyStatusID     = objSurveyModel.SurveyStatusID;
                        objSurvey.EC_ATC             = objSurveyModel.EC_ATC;
                        objSurvey.EC_LocalPolice     = objSurveyModel.EC_LocalPolice;
                        objSurvey.EC_FireBrigde      = objSurveyModel.EC_FireBrigde;
                        objSurvey.EC_AE              = objSurveyModel.EC_AE;
                        objSurvey.WC_Wind            = objSurveyModel.WC_Wind;
                        objSurvey.WC_Precipitation   = objSurveyModel.WC_Precipitation;
                        objSurvey.WC_Visibility      = objSurveyModel.WC_Visibility;
                        objSurvey.WC_CloudCover      = objSurveyModel.WC_CloudCover;
                        objSurvey.WC_KP              = objSurveyModel.WC_KP;
                        objSurvey.W_SunRise          = objSurveyModel.W_SunRise;
                        objSurvey.W_SunSet           = objSurveyModel.W_SunSet;
                        objSurvey.W_CTAFS            = objSurveyModel.W_CTAFS;
                        objSurvey.W_WindSpeed        = objSurveyModel.W_WindSpeed;
                        objSurvey.W_Prepreciption    = objSurveyModel.W_Prepreciption;
                        objSurvey.W_Temperature      = objSurveyModel.W_Temperature;
                        objSurvey.W_Notams           = objSurveyModel.W_Notams;
                        objSurvey.SH_NotedStructure  = objSurveyModel.SH_NotedStructure;
                        objSurvey.SH_PedestrainRisk  = objSurveyModel.SH_PedestrainRisk;
                        objSurvey.SH_VehileRisk      = objSurveyModel.SH_VehileRisk;
                        objSurvey.SH_ATR             = objSurveyModel.SH_ATR;
                        objSurvey.SH_ExplosiveRisk   = objSurveyModel.SH_ExplosiveRisk;
                        objSurvey.MS_Name            = objSurveyModel.MS_Name;
                        objSurvey.MS_Telephone       = objSurveyModel.MS_Telephone;
                        objSurvey.MS_Email           = objSurveyModel.MS_Email;
                        objSurvey.FT_StartTime       = objSurveyModel.FT_StartTime;
                        objSurvey.FT_EndTime         = objSurveyModel.FT_EndTime;
                        objSurvey.TimeHack           = objSurveyModel.TimeHack;
                        objSurvey.NearAreaPopulation = objSurveyModel.NearAreaPopulation;
                        objSurvey.SiteAddress        = objSurveyModel.SiteAddress;
                        objSurvey.OperatingArea      = objSurveyModel.OperatingArea;
                        objSurvey.Question           = objSurveyModel.Question;
                        objSurvey.WorkDescription    = objSurveyModel.WorkDescription;
                        objSurvey.Comments           = objSurveyModel.Comments;
                        objSurvey.IsActive           = true;
                        objSurvey.IsDeleted          = false;
                        objSurvey.CreatedOn          = DateTime.Now;

                        objSurvey = objSurvey = db.SurveyRepository.Insert(objSurvey);
                    }
                    else
                    {
                        objSurvey                    = new Survey();
                        objSurvey.ID                 = objSurveyModel.ID;
                        objSurvey.Title              = objSurveyModel.Title;
                        objSurvey.SurveyDate         = objSurveyModel.SurveyDate;
                        objSurvey.SurveyTime         = objSurveyModel.SurveyTime;
                        objSurvey.CustomerID         = objSurveyModel.CustomerID;
                        objSurvey.CustomerLocationID = objSurveyModel.CustomerLocationID;
                        objSurvey.PilotID            = objSurveyModel.PilotID;
                        objSurvey.DroneID            = objSurveyModel.DroneID;
                        objSurvey.SurveyStatusID     = objSurveyModel.SurveyStatusID;
                        objSurvey.EC_ATC             = objSurveyModel.EC_ATC;
                        objSurvey.EC_LocalPolice     = objSurveyModel.EC_LocalPolice;
                        objSurvey.EC_FireBrigde      = objSurveyModel.EC_FireBrigde;
                        objSurvey.EC_AE              = objSurveyModel.EC_AE;
                        objSurvey.WC_Wind            = objSurveyModel.WC_Wind;
                        objSurvey.WC_Precipitation   = objSurveyModel.WC_Precipitation;
                        objSurvey.WC_Visibility      = objSurveyModel.WC_Visibility;
                        objSurvey.WC_CloudCover      = objSurveyModel.WC_CloudCover;
                        objSurvey.WC_KP              = objSurveyModel.WC_KP;
                        objSurvey.W_SunRise          = objSurveyModel.W_SunRise;
                        objSurvey.W_SunSet           = objSurveyModel.W_SunSet;
                        objSurvey.W_CTAFS            = objSurveyModel.W_CTAFS;
                        objSurvey.W_WindSpeed        = objSurveyModel.W_WindSpeed;
                        objSurvey.W_Prepreciption    = objSurveyModel.W_Prepreciption;
                        objSurvey.W_Temperature      = objSurveyModel.W_Temperature;
                        objSurvey.W_Notams           = objSurveyModel.W_Notams;
                        objSurvey.SH_NotedStructure  = objSurveyModel.SH_NotedStructure;
                        objSurvey.SH_PedestrainRisk  = objSurveyModel.SH_PedestrainRisk;
                        objSurvey.SH_VehileRisk      = objSurveyModel.SH_VehileRisk;
                        objSurvey.SH_ATR             = objSurveyModel.SH_ATR;
                        objSurvey.SH_ExplosiveRisk   = objSurveyModel.SH_ExplosiveRisk;
                        objSurvey.MS_Name            = objSurveyModel.MS_Name;
                        objSurvey.MS_Telephone       = objSurveyModel.MS_Telephone;
                        objSurvey.MS_Email           = objSurveyModel.MS_Email;
                        objSurvey.FT_StartTime       = objSurveyModel.FT_StartTime;
                        objSurvey.FT_EndTime         = objSurveyModel.FT_EndTime;
                        objSurvey.TimeHack           = objSurveyModel.TimeHack;
                        objSurvey.NearAreaPopulation = objSurveyModel.NearAreaPopulation;
                        objSurvey.SiteAddress        = objSurveyModel.SiteAddress;
                        objSurvey.OperatingArea      = objSurveyModel.OperatingArea;
                        objSurvey.Question           = objSurveyModel.Question;
                        objSurvey.WorkDescription    = objSurveyModel.WorkDescription;
                        objSurvey.Comments           = objSurveyModel.Comments;
                        objSurvey.IsActive           = objSurveyModel.IsActive;
                        objSurvey.IsDeleted          = objSurveyModel.IsDeleted;
                        objSurvey.CreatedOn          = objSurveyModel.CreatedOn;
                        objSurvey.UpdatedOn          = DateTime.Now;
                        objSurvey                    = objSurvey = db.SurveyRepository.Update(objSurvey);
                    }
                    if (objSurvey != null)
                    {
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = "";
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "AddSurveyDetail", Id = objSurveyModel.ID, ClassName = "SurveyDetailBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }
Beispiel #23
0
        public TResponse AddUpdate(CustomerModel objCustomerModel)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    Customer objCustomer = db.CustomerRepository.Get(x => x.ID == objCustomerModel.ID).FirstOrDefault();

                    if (objCustomer == null)
                    {
                        objCustomer          = new Customer();
                        objCustomer.UserId   = objCustomerModel.UserId;
                        objCustomer.FName    = objCustomerModel.FName;
                        objCustomer.LName    = objCustomerModel.LName;
                        objCustomer.Email    = objCustomerModel.Email;
                        objCustomer.Phone    = objCustomerModel.Phone;
                        objCustomer.Address1 = objCustomerModel.Address1;
                        objCustomer.Address2 = objCustomerModel.Address2;
                        objCustomer.City     = objCustomerModel.City;
                        // objCustomer.Location = objCustomerModel.Location;

                        objCustomer.IsActive  = true;
                        objCustomer.IsDeleted = false;
                        objCustomer.CreatedOn = DateTime.Now;

                        objCustomer = db.CustomerRepository.Insert(objCustomer);
                    }
                    else
                    {
                        objCustomer.FName    = objCustomerModel.FName;
                        objCustomer.LName    = objCustomerModel.LName;
                        objCustomer.Email    = objCustomerModel.Email;
                        objCustomer.Phone    = objCustomerModel.Phone;
                        objCustomer.Address1 = objCustomerModel.Address1;
                        objCustomer.Address2 = objCustomerModel.Address2;
                        objCustomer.City     = objCustomerModel.City;

                        objCustomer.IsActive  = objCustomerModel.IsActive;
                        objCustomer.IsDeleted = objCustomerModel.IsDeleted;

                        objCustomer.UpdatedOn = DateTime.Now;
                        objCustomer           = db.CustomerRepository.Update(objCustomer);
                    }
                    if (objCustomer != null)
                    {
                        objTResponse.Status         = ResponseStaus.ok;
                        objTResponse.Message        = ResponseMessage.success;
                        objTResponse.ResponsePacket = "";
                    }
                    else
                    {
                        objTResponse.Status         = ResponseStaus.error;
                        objTResponse.Message        = ResponseMessage.ItemNotFound;
                        objTResponse.ResponsePacket = null;
                    }
                    return(objTResponse);
                }
                catch (DbEntityValidationException dbEx)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "AddCustomer", Id = objCustomerModel.ID, ClassName = "CustomerBusiness", Error = dbEx.Message
                    });
                    return(objTResponse);
                }
            }
        }