Beispiel #1
0
        public async Task <IActionResult> SaveVarianceMaster(int varianceId = 0)
        {
            var mainActivityMasters = await _mainActivityMasterHelper.GetAllMainActivityMasterDetails();

            List <MainActivityMasterViewModel> lstMainActivityMaster = new List <MainActivityMasterViewModel>();
            VarianceMasterViewModel            variMasterModel       = new VarianceMasterViewModel();

            if (mainActivityMasters != null)
            {
                foreach (var item in mainActivityMasters)
                {
                    lstMainActivityMaster.Add(new MainActivityMasterViewModel()
                    {
                        MainActivityId   = item.MainActivityId,
                        MainActivityCode = item.MainActivityCode
                    });
                }
            }

            if (varianceId > 0)
            {
                var varianceMasterList = await _varianceMasterHelper.GetAllVarianceMasterDetails("", varianceId, 1);

                if (varianceMasterList != null)
                {
                    variMasterModel.VarianceId          = varianceMasterList[0].VarianceId;
                    variMasterModel.MainActivityId      = varianceMasterList[0].MainActivityId;
                    variMasterModel.VarianceName        = varianceMasterList[0].VarianceName;
                    variMasterModel.VarianceCode        = varianceMasterList[0].VarianceCode;
                    variMasterModel.ParentId            = varianceMasterList[0].ParentId;
                    variMasterModel.OrgId               = varianceMasterList[0].OrgId;
                    variMasterModel.Status              = varianceMasterList[0].Status;
                    variMasterModel.Sequence            = varianceMasterList[0].Sequence;
                    variMasterModel.IsDeleted           = varianceMasterList[0].IsDeleted;
                    variMasterModel.VarianceDescription = varianceMasterList[0].VarianceDescription;
                }
            }
            variMasterModel.lstMainActivityMaster = lstMainActivityMaster;

            return(PartialView("SaveVarianceMaster", variMasterModel));
        }
Beispiel #2
0
        //public async Task<IActionResult> SaveMainActivity()
        //{
        //    var groupMasters = await _groupMasterHelper.GetGroupMasterViewModelDetails();
        //    List<GroupMasterViewModel> lstGroupMaster = new List<GroupMasterViewModel>();
        //    if (groupMasters != null)
        //    {
        //        foreach (var item in groupMasters)
        //        {
        //            lstGroupMaster.Add(new GroupMasterViewModel()
        //            {
        //                GroupId = item.GroupId,
        //                GroupName = item.GroupCode
        //            });
        //        }
        //    }

        //    MainActivityMasterViewModel mainActivityModel = new MainActivityMasterViewModel()
        //    {
        //        lstGroupMaster = lstGroupMaster
        //    };
        //    return PartialView("SaveMainActivity", mainActivityModel);
        //}

        public async Task <IActionResult> CostCode(int caseStat = 0)
        {
            var groupMasters = await _groupMasterHelper.GetGroupMasterViewModelDetails();

            var mainActivities = await _mainActivityMasterHelper.GetAllMainActivityMasterDetails("", 0, caseStat);

            var activityMasterList = await _activityMasterHelper.GetAllActivityMasterDetails("", 0, caseStat);

            var varianceMasterList = await _varianceMasterHelper.GetAllVarianceMasterDetails("", 0, caseStat);

            List <VarianceMasterViewModel> lstVarianceMaster = new List <VarianceMasterViewModel>();

            if (varianceMasterList?.Count > 0)
            {
                varianceMasterList.ForEach(item =>
                {
                    lstVarianceMaster.Add(new VarianceMasterViewModel
                    {
                        VarianceId          = item.VarianceId,
                        VarianceCode        = item.VarianceCode ?? string.Empty,
                        VarianceName        = item.VarianceName ?? string.Empty,
                        Sequence            = item.Sequence ?? string.Empty,
                        OrgId               = item.OrgId,
                        Status              = item.Status,
                        IsDeleted           = item.IsDeleted,
                        VarianceDescription = item.VarianceDescription,
                        MainActivityId      = item.MainActivityId
                    });
                });
            }

            List <GroupMasterViewModel> lstGrpMaster = new List <GroupMasterViewModel>();

            if (groupMasters?.Count > 0)
            {
                groupMasters.ForEach(item =>
                {
                    lstGrpMaster.Add(new GroupMasterViewModel
                    {
                        GroupId          = item.GroupId,
                        GroupCode        = item.GroupCode ?? string.Empty,
                        GroupName        = item.GroupName ?? string.Empty,
                        Sequence         = item.Sequence ?? string.Empty,
                        OrgId            = item.OrgId,
                        Status           = item.Status,
                        IsDeleted        = item.IsDeleted,
                        GroupDescription = item.GroupDescription
                    });
                });
            }

            List <MainActivityMasterViewModel> lstMainMaster = new List <MainActivityMasterViewModel>();

            if (mainActivities?.Count > 0)
            {
                mainActivities.ForEach(item =>
                {
                    lstMainMaster.Add(new MainActivityMasterViewModel
                    {
                        MainActivityId          = item.MainActivityId,
                        GroupId                 = item.GroupId,
                        GroupName               = item.GroupName ?? string.Empty,
                        MainActivityName        = item.MainActivityName ?? string.Empty,
                        MainActivityCode        = item.MainActivityCode ?? string.Empty,
                        OrgId                   = item.OrgId,
                        Sequence                = item.Sequence,
                        Status                  = item.Status,
                        IsDeleted               = item.IsDeleted,
                        MainActivityDescription = item.MainActivityDescription
                    });
                });
            }
            CostListsModel costList = new CostListsModel();
            List <ActivityMasterViewModel> lstActivityMaster = new List <ActivityMasterViewModel>();

            if (activityMasterList?.Count > 0)
            {
                activityMasterList.ForEach(item =>
                {
                    lstActivityMaster.Add(new ActivityMasterViewModel
                    {
                        ActivityId          = item.ActivityId,
                        MainActivityId      = item.MainActivityId,
                        MainActivityName    = item.MainActivityName,
                        ActivityName        = item.ActivityName,
                        ActivityCode        = item.ActivityCode,
                        ParentId            = item.ParentId,
                        OrgId               = item.OrgId,
                        Status              = item.Status,
                        Sequence            = item.Sequence,
                        IsDeleted           = item.IsDeleted,
                        ActivityDescription = item.ActivityDescription
                    });
                });
            }
            bool checkStatus = false;

            if (caseStat == 0)
            {
                checkStatus = true;
            }
            else
            {
                checkStatus = false;
            }

            CostListsModel costLists = new CostListsModel()
            {
                lstGroupMaster        = lstGrpMaster,
                lstMainActivityMaster = lstMainMaster,
                lstActivityMaster     = lstActivityMaster,
                lstVarianceMaster     = lstVarianceMaster,
                chkStatus             = checkStatus
            };

            return(PartialView("CostCode", costLists));
        }