Example #1
0
        public ClusterDto GetByID(int clusterID)
        {
            var objuspClusterGetByIdResult = _dbContext.uspClusterGetByID(clusterID).ToList().FirstOrDefault();

            ClusterDto objClusterDto = AutoMapperEntityConfiguration.Cast <ClusterDto>(objuspClusterGetByIdResult);

            return(objClusterDto);
        }
Example #2
0
        public List <ClusterDto> GetAll()
        {
            var lstClusterDto = new List <ClusterDto>();
            var lstuspClusterGetAll_Result = _dbContext.uspClusterGetAll().ToList();

            foreach (var cluster in lstuspClusterGetAll_Result)
            {
                ClusterDto objCluster = Mapper.Map <uspClusterGetAll_Result, ClusterDto>(cluster);
                lstClusterDto.Add(objCluster);
            }

            return(lstClusterDto);
        }
Example #3
0
        public Cluster MapToCluster(ClusterDto clusterDto)
        {
            var cluster = new Cluster
            {
                Id            = clusterDto.Id,
                Name          = clusterDto.Name,
                Description   = clusterDto.Description,
                ClusterStatus = (ComponentStatus)clusterDto.ClusterStatus,
                ModifiedDate  = clusterDto.ModifiedDate,
                IsDeleted     = clusterDto.IsDeleted
            };

            return(cluster);
        }
Example #4
0
        public ClusterDto MapToClusterDto(Cluster cluster)
        {
            var clusterDto = new ClusterDto();

            if (cluster != null)
            {
                clusterDto.Id            = cluster.Id;
                clusterDto.Name          = cluster.Name;
                clusterDto.Description   = cluster.Description;
                clusterDto.ClusterStatus = (int)cluster.ClusterStatus;
                clusterDto.ModifiedDate  = cluster.ModifiedDate;
                clusterDto.IsDeleted     = cluster.IsDeleted;
            }

            return(clusterDto);
        }
Example #5
0
        public ActionResult CreateCluster(string id)
        {
            int ClusterId    = string.IsNullOrEmpty(id.DecryptString()) ? default(int) : Convert.ToInt32(id.DecryptString());
            var clusterDto   = new ClusterDto();
            var clusterModel = new ClusterModel();

            LoadDropDowns();

            if (ClusterId > 0)
            {
                clusterDto   = _clusterService.GetByID(ClusterId);
                clusterModel = Mapper.Map <ClusterDto, ClusterModel>(clusterDto);
            }

            ViewBag.Result = new ResultDto();
            return(View(clusterModel));
        }
Example #6
0
        public ResultDto InsertUpdate(ClusterDto cluster)
        {
            ResultDto resultDto = new ResultDto();
            string    obectName = "cluster";

            try
            {
                ObjectParameter prmClusterID   = new ObjectParameter("ClusterID", cluster.ClusterID);
                ObjectParameter prmClusterCode = new ObjectParameter("ClusterCode", string.Empty);

                int effectedRow = _dbContext.uspClusterInsertUpdate(prmClusterID, cluster.ClusterName, cluster.TEClusterName, cluster.StartDate, cluster.MandalID,
                                                                    cluster.BranchID, cluster.Phone, cluster.Address, cluster.Leader, cluster.LeaderFromDate, cluster.UserID, prmClusterCode);

                resultDto.ObjectId   = (int)prmClusterID.Value;
                resultDto.ObjectCode = string.IsNullOrEmpty((string)prmClusterCode.Value) ? cluster.ClusterCode : (string)prmClusterCode.Value;

                if (resultDto.ObjectId > 0)
                {
                    resultDto.Message = string.Format("{0} details saved successfully with code : {1}", obectName, resultDto.ObjectCode);
                }
                else if (resultDto.ObjectId == -1)
                {
                    resultDto.Message = string.Format("Error occured while generating {0} code", obectName);
                }
                else
                {
                    resultDto.Message = string.Format("Error occured while saving {0} details", obectName);
                }
            }
            catch (Exception)
            {
                resultDto.Message  = string.Format("Service layer error occured while saving the {0} details", obectName);
                resultDto.ObjectId = -98;
            }
            return(resultDto);
        }
Example #7
0
        public JsonResult GetClusterName(int id)
        {
            ClusterDto ClusterDto = _clusterService.GetByID(id);

            return(Json(new { ClusterName = ClusterDto.ClusterName }));
        }
Example #8
0
 public ResultDto Update(ClusterDto clusterDto)
 {
     return(InsertUpdate(clusterDto));
 }