Beispiel #1
0
        public IHttpActionResult DeleteGeographical(GeographicalMaster Geographical)
        {
            string status = string.Empty;

            try
            {
                GeographicalMaster _Geographical = _geographicalService.GetGeographicalById(Geographical.Id);
                _Geographical.Deactivate     = "Y";
                _Geographical.DeactivateBy   = Geographical.EnteredBy;
                _Geographical.DeactivateDate = DateTime.Now;
                _geographicalService.UpdateGeographical(_Geographical);

                status = "OK";
            }
            catch (ACSException ex)
            {
                status = ex.InnerException.Message;
            }
            catch (Exception ex)
            {
                status = ex.InnerException.Message;
            }

            return(Json(status));
        }
 public void InsertGeographical(GeographicalMaster Geographical)
 {
     Geographical.Deactivate     = "N";
     Geographical.parentid       = Geographical.parentid;
     Geographical.geogcode       = Geographical.geogName.Replace(".", string.Empty).Substring(0, 2).ToUpper();
     Geographical.EntryDate      = DateTime.Now;
     Geographical.ModifiedBy     = null;
     Geographical.ModifiedDate   = null;
     Geographical.DeactivateBy   = null;
     Geographical.DeactivateDate = null;
     _geographicalServiceRepository.Insert(Geographical);
 }
        /// <summary>
        /// Check The duplicity of record before insertion and deletion
        /// </summary>
        /// <param name="GeographyType">Geography</param>
        public string DuplicityCheck(GeographicalMaster Geographical)
        {
            var dupes = _geographicalServiceRepository.Table.Where(x => x.geogName == Geographical.geogName &&
                                                                   x.Deactivate == "N" &&
                                                                   x.geogtype == Geographical.geogtype &&
                                                                   x.parentid == Geographical.parentid &&
                                                                   (Geographical.Id != 0 ? x.Id : 0) != (Geographical.Id != 0 ? Geographical.Id : 1)).FirstOrDefault();

            if (dupes != null)
            {
                return("N");
            }
            else
            {
                return("Y");
            }
        }
Beispiel #4
0
        public IHttpActionResult InsertGeographical(GeographicalMaster Geographical)
        {
            string status = "";

            try
            {
                status = _geographicalService.DuplicityCheck(Geographical);
                if (status == "Y")
                {
                    if (Geographical.Id == 0)
                    {
                        _geographicalService.InsertGeographical(Geographical);
                        status = _localizationService.GetResource("Master.API.Success.Message");
                    }

                    else
                    {
                        GeographicalMaster _Geographical = _geographicalService.GetGeographicalById(Geographical.Id);
                        _Geographical.parentid     = Geographical.parentid;
                        _Geographical.geogName     = Geographical.geogName;
                        _Geographical.geogcode     = Geographical.geogName.Replace(".", string.Empty).Substring(0, 2).ToUpper();
                        _Geographical.ModifiedBy   = Geographical.EnteredBy;
                        _Geographical.ModifiedDate = DateTime.Now;
                        _geographicalService.UpdateGeographical(_Geographical);
                        status = _localizationService.GetResource("Master.API.Success.Message");
                    }
                }
                else
                {
                    status = "Duplicate";
                }
            }
            catch (ACSException ex)
            {
                status = ex.InnerException.Message;
            }
            catch (Exception ex)
            {
                status = ex.InnerException.Message;
            }
            return(Json(status));
        }
Beispiel #5
0
        public IHttpActionResult getGeographical(int Id)
        {
            GeographicalMaster _geographicalMaster = _geographicalService.GetGeographicalById(Id);

            return(Json(SerializeObj.SerializeObject(new { _geographicalMaster })));
        }
Beispiel #6
0
 /// <summary>
 ///methos for selecting the geogType
 /// </summary>
 /// <param name="GeographyType">Geography</param>
 ///
 public IList <GeographicalMaster> GetAllGeog(GeographicalMaster geog)
 {
     return(_GeogRepository.Table.Where(c => c.Deactivate == "N" &&
                                        c.geogtype == geog.geogtype &&
                                        c.parentid == geog.parentid).Distinct().OrderBy(c => c.geogName).ToList());
 }
Beispiel #7
0
 public IHttpActionResult GeographicalUserControl(GeographicalMaster geog)
 {
     return(Json(_CommonDDLService.GetAllGeog(geog).ToList()));
 }
 public void DeleteGeographical(GeographicalMaster Geographical)
 {
     _geographicalServiceRepository.Delete(Geographical);
 }
 public void UpdateGeographical(GeographicalMaster Geographical)
 {
     _geographicalServiceRepository.Update(Geographical);
 }