예제 #1
0
        public bool SaveSricDeptData(string action, out string msg)
        {
            msg = string.Empty;
            bool success = false;

            if (SricDeptData == null || SricDeptData.Count == 0)
            {
                return(success);
            }

            foreach (var item in SricDeptData)
            {
                item.MenuID        = DataAccess.Enum.Menu.SRIC.ToString();
                item.DataUser      = SessionManager.UserName;
                item.DataUpdatedOn = DateTime.Now;
                item.DataCaptYM    = SessionManager.DataCaptYR;
                item.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                item.DataValid     = "Y";
                item.DataLocked    = "N";
                item.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
            }

            try
            {
                FormsRepository formsRepository = new FormsRepository();
                DataTable       dt = ToDataTable(SricDeptData);
                success = formsRepository.UpdateBulkSricDeptFormData(dt, SessionManager.DataCaptYR);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
예제 #2
0
        public bool SaveDFNPData(string action, out string msg)
        {
            msg = string.Empty;
            bool success = false;

            if (finInfo == null)
            {
                return(success);
            }

            finInfo.MenuID        = DataAccess.Enum.Menu.DFNP.ToString();
            finInfo.DeptID        = string.IsNullOrEmpty(finInfo.EmpDept) ? SessionManager.DeptID : finInfo.EmpDept;
            finInfo.DeptName      = SessionManager.DeptID;
            finInfo.DataUser      = SessionManager.UserName;
            finInfo.DataUpdatedOn = DateTime.Now;
            finInfo.DataCaptYM    = SessionManager.DataCaptYR;
            finInfo.DataStatus    = FormCommonMethods.GetStatusByAction(action);
            finInfo.DataValid     = "Y";
            finInfo.DataLocked    = "N";
            finInfo.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");

            try
            {
                FormsRepository formsRepository = new FormsRepository();
                DataTable       dt = ToDataTable(new List <FinInfo> {
                    finInfo
                });
                success = formsRepository.UpdateBulkDFNPData(dt, SessionManager.DataCaptYR);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
예제 #3
0
        public bool SaveDOFAData(string action, out string msg)
        {
            msg = string.Empty;
            bool success = false;

            if (DofaData == null || DofaData.Count == 0)
            {
                return(success);
            }

            if (DofaData.Any(n => n.empNo <= 0 || string.IsNullOrWhiteSpace(n.empName) || string.IsNullOrWhiteSpace(n.empDEPT)))
            {
                msg = "Minimum EmpNo, Name, Dept should not be blank";
                return(success);
            }

            if (DofaData.GroupBy(n => n.empNo).Any(c => c.Count() > 1))
            {
                msg = "Duplicate EmpNo Exist.! Data saving aborted.";
                return(success);
            }


            foreach (var item in DofaData)
            {
                item.MenuID        = DataAccess.Enum.Menu.DOFA.ToString();
                item.DeptID        = SessionManager.DeptID;
                item.DataUser      = SessionManager.UserName;
                item.DataUpdatedOn = DateTime.Now;
                item.DataCaptYM    = SessionManager.DataCaptYR;
                item.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                item.DataValid     = "Y";
                item.DataLocked    = "N";
                item.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
            }

            try
            {
                FormsRepository formsRepository = new FormsRepository();
                DataTable       dt = ToDataTable(DofaData);
                success = formsRepository.UpdateBulkDOFAFormData(dt, SessionManager.DataCaptYR, SessionManager.DeptID, EmpDept);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
예제 #4
0
        public bool SaveSricFAData(string action, out string msg)
        {
            msg = string.Empty;
            bool success = false;

            if (SricFAData == null || SricFAData.Count == 0)
            {
                return(success);
            }

            if (SricFAData.Any(n => string.IsNullOrWhiteSpace(n.FAName)))
            {
                msg = "At least Agency Name / Sponsor Name Required.";
                return(success);
            }

            if (SricFAData.GroupBy(n => n.FAName.Trim().ToLower()).Any(c => c.Count() > 1))
            {
                msg = "Duplicate Organization / Agency Name Exist.! Data saving aborted.";
                return(success);
            }

            foreach (var item in SricFAData)
            {
                item.FAName        = item.FAName.Trim();
                item.MenuID        = DataAccess.Enum.Menu.SRICFA.ToString();
                item.DeptID        = SessionManager.DeptID;
                item.DataUser      = SessionManager.UserName;
                item.DataUpdatedOn = DateTime.Now;
                item.DataCaptYM    = SessionManager.DataCaptYR;
                item.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                item.DataValid     = "Y";
                item.DataLocked    = "N";
                item.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
            }

            try
            {
                FormsRepository formsRepository = new FormsRepository();
                DataTable       dt = ToDataTable(SricFAData);
                success = formsRepository.UpdateBulkSricFAFormData(dt, SessionManager.DataCaptYR, SessionManager.DeptID);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
예제 #5
0
        public bool SaveDofaPeerData(string action, out string msg, out int empNo, out string empName)
        {
            msg = string.Empty; empNo = 0; empName = string.Empty;
            bool success = false;

            if (DofaPeerData == null || DofaPeerData.Count == 0)
            {
                return(success);
            }

            if (DofaPeerData.Any(n => n.empNo <= 0))
            {
                msg = "Employee Required";
                return(success);
            }

            DataCollectionModelDataContext db = new DataCollectionModelDataContext();
            string empNotExist = string.Empty;

            foreach (var item in DofaPeerData)
            {
                var emp = db.dofaInfos.Where(a => a.empNo == item.empNo).FirstOrDefault();
                if (emp != null)
                {
                    item.empNo         = item.empNo;
                    item.MenuID        = DataAccess.Enum.Menu.DOFAPEER.ToString();
                    item.DeptID        = SessionManager.DeptID;
                    item.DataUser      = SessionManager.UserName;
                    item.DataUpdatedOn = DateTime.Now;
                    item.DataCaptYM    = SessionManager.DataCaptYR;
                    item.DataStatus    = (short)FormCommonMethods.GetStatusByAction(action);
                    item.DataValid     = Convert.ToChar("Y");
                    item.DataLocked    = Convert.ToChar("N");
                    item.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
                    item.PeerRemarks   = SessionManager.UserName + " on " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
                    empNo   = emp.empNo;
                    empName = emp.empName;
                }
                else
                {
                    if (string.IsNullOrEmpty(empNotExist))
                    {
                        empNotExist = Convert.ToString(emp.empNo);
                    }
                    else
                    {
                        empNotExist = empNotExist + " ," + emp.empNo;
                    }
                }
            }

            if (!string.IsNullOrEmpty(empNotExist))
            {
                msg = empNotExist + "Employee Not Exist.";
                return(success);
            }

            try
            {
                FormsRepository formsRepository = new FormsRepository();
                DataTable       dt = ToDataTable(DofaPeerData);
                success = formsRepository.UpdateBulkDofaPeerFormData(dt, SessionManager.DataCaptYR, SessionManager.DeptID);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
        public bool SaveInfraData(string action, out string msg)
        {
            msg = string.Empty;
            bool success = false, IsInfraInfoVisible = false;

            if (InfraDeptData == null || InfraDeptData.Count == 0)
            {
                return(success);
            }

            foreach (var item in InfraDeptData)
            {
                item.MenuID        = DataAccess.Enum.Menu.INFRA.ToString();
                item.DeptID        = SessionManager.DeptID;
                item.DataUser      = SessionManager.UserName;
                item.DataUpdatedOn = DateTime.Now;
                item.DataCaptYM    = SessionManager.DataCaptYR;
                item.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                item.DataValid     = "Y";
                item.DataLocked    = "N";
                item.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
            }

            if (SessionManager.DeptID == "EW")
            {
                IsInfraInfoVisible = true;
                foreach (var item in InfraInfoData)
                {
                    item.MenuID        = DataAccess.Enum.Menu.INFRA.ToString();
                    item.DataUser      = SessionManager.UserName;
                    item.DeptID        = SessionManager.DeptID;
                    item.DataUpdatedOn = DateTime.Now;
                    item.DataCaptYM    = SessionManager.DataCaptYR;
                    item.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                    item.DataValid     = "Y";
                    item.DataLocked    = "N";
                    item.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
                    item.InfraRemarks  = SessionManager.UserName + " on " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
                }
            }
            else
            {
                IsInfraInfoVisible = false;
                InfraInfoData      = new List <InfraInfo>();
                InfraInfo item = new InfraInfo();
                item.DeptID        = SessionManager.DeptID;
                item.MenuID        = DataAccess.Enum.Menu.INFRA.ToString();
                item.DataUser      = SessionManager.UserName;
                item.DataUpdatedOn = DateTime.Now;
                item.DataCaptYM    = SessionManager.DataCaptYR;
                item.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                item.DataValid     = "Y";
                item.DataLocked    = "N";
                item.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
                InfraInfoData.Add(item);
            }

            try
            {
                FormsRepository formsRepository = new FormsRepository();
                DataTable       dtInfraInfo     = null;
                DataTable       dtInfraDept     = ToDataTable(InfraDeptData);
                dtInfraInfo = ToDataTable(InfraInfoData);
                success     = formsRepository.UpdateBulkInfraFormData(dtInfraDept, dtInfraInfo, SessionManager.DataCaptYR, IsInfraInfoVisible);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
예제 #7
0
        public Tuple <bool, bool?> SaveUpdateFormData(object objectData, string action, string menu, string needModificationMSG, out string msg)
        {
            msg = string.Empty;
            FormsViewModel formsViewModel = new FormsViewModel();
            int            DataCaptYM     = 0;
            string         DeptID         = string.Empty;
            bool?          IsEmailSent    = null;

            if (menu == DataAccess.Enum.Menu.DOSW.ToString() || menu == DataAccess.Enum.Menu.ADIR.ToString())
            {
                stInfo2 info2 = new stInfo2();
                info2 = JsonConvert.DeserializeObject <stInfo2>(objectData.ToString());

                info2.DataUpdatedOn = DateTime.Now;
                info2.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                info2.DataUser      = SessionManager.UserName;
                info2.DeptID        = SessionManager.DeptID;
                info2.DataValid     = "Y";
                info2.DataLocked    = "N";
                info2.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss"); //DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt");
                DeptID     = info2.DeptID;
                DataCaptYM = info2.DataCaptYM;
                if (menu == DataAccess.Enum.Menu.ADIR.ToString())
                {
                    info2.MenuID = DataAccess.Enum.Menu.ADIR.ToString();
                }
                else
                {
                    info2.MenuID = DataAccess.Enum.Menu.DOSW.ToString();
                }

                formsViewModel.info2 = info2;

                if (formsViewModel.info2.IDNo > 0)
                {
                    formsViewModel.isSaveSuccessfully = formsViewModel.UdpateADIRAndDOSWForm(formsViewModel);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = formsViewModel.SaveADIRAndDOSWForm(formsViewModel);
                }
            }
            else if (menu == DataAccess.Enum.Menu.DOAA.ToString())
            {
                stInfo info = new stInfo();
                info = JsonConvert.DeserializeObject <stInfo>(objectData.ToString());

                info.DataUpdatedOn = DateTime.Now;
                info.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                info.DataUser      = SessionManager.UserName;
                info.DeptID        = string.IsNullOrEmpty(info.EmpDept) ? SessionManager.DeptID : info.EmpDept;
                info.DataValid     = "Y";
                info.DataLocked    = "N";
                info.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
                info.MenuID        = DataAccess.Enum.Menu.DOAA.ToString();
                DataCaptYM         = info.DataCaptYM;
                DeptID             = info.DeptID;

                formsViewModel.info = info;

                if (formsViewModel.info.IDNo > 0)
                {
                    formsViewModel.isSaveSuccessfully = formsViewModel.UdpateDOAA1Form(formsViewModel);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = formsViewModel.SaveDOAA1Form(formsViewModel);
                }
            }
            else if (menu == DataAccess.Enum.Menu.LIBFORM.ToString())
            {
                LibInfo libInfo = new LibInfo();
                libInfo = JsonConvert.DeserializeObject <LibInfo>(objectData.ToString());

                libInfo.DataUpdatedOn = DateTime.Now;
                libInfo.DataStatus    = FormCommonMethods.GetStatusByAction(action);
                libInfo.DataUser      = SessionManager.UserName;
                libInfo.DeptID        = SessionManager.DeptID;
                libInfo.DataValid     = "Y";
                libInfo.DataLocked    = "N";
                libInfo.DataStatusLog = SessionManager.UserName + " " + DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss");
                libInfo.MenuID        = DataAccess.Enum.Menu.LIBFORM.ToString();
                DataCaptYM            = libInfo.DataCaptYM;
                DeptID = libInfo.DeptID;

                formsViewModel.libInfo = libInfo;

                if (formsViewModel.libInfo.IDNo > 0)
                {
                    formsViewModel.isSaveSuccessfully = formsViewModel.UdpateLIBForm(formsViewModel);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = formsViewModel.SaveLIBForm(formsViewModel);
                }
            }
            else if (menu == DataAccess.Enum.Menu.DOFA.ToString())
            {
                if (objectData != null && typeof(DofaViewModel) == objectData.GetType())
                {
                    DofaViewModel dvm = (DofaViewModel)objectData;
                    DataCaptYM = dvm.DataCaptYM;
                    DeptID     = "DOFA";
                    formsViewModel.isSaveSuccessfully = dvm.SaveDOFAData(action, out msg);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = false;
                }
            }
            else if (menu == DataAccess.Enum.Menu.SRICFA.ToString())
            {
                if (objectData != null && typeof(SricFAViewModel) == objectData.GetType())
                {
                    SricFAViewModel sfvm = (SricFAViewModel)objectData;
                    DataCaptYM = sfvm.DataCaptYM;
                    DeptID     = "SRIC Agency";
                    formsViewModel.isSaveSuccessfully = sfvm.SaveSricFAData(action, out msg);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = false;
                }
            }
            else if (menu == DataAccess.Enum.Menu.SRIC.ToString())
            {
                if (objectData != null && typeof(SricDeptViewModel) == objectData.GetType())
                {
                    SricDeptViewModel sdvm = (SricDeptViewModel)objectData;
                    DataCaptYM = sdvm.DataCaptYM;
                    DeptID     = "SRIC";
                    formsViewModel.isSaveSuccessfully = sdvm.SaveSricDeptData(action, out msg);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = false;
                }
            }
            else if (menu == DataAccess.Enum.Menu.DOFAPEER.ToString())
            {
                if (objectData != null && typeof(DofaPeerViewModel) == objectData.GetType())
                {
                    DofaPeerViewModel sdvm = (DofaPeerViewModel)objectData;
                    DataCaptYM = sdvm.DataCaptYM;
                    DeptID     = "DOFA";
                    int    EmpNo   = 0;
                    string EmpName = string.Empty;

                    formsViewModel.isSaveSuccessfully = sdvm.SaveDofaPeerData(action, out msg, out EmpNo, out EmpName);

                    if (formsViewModel.isSaveSuccessfully && action.ToLower().Trim() == "save")
                    {
                        IsEmailSent = FormCommonMethods.SendEmailOnSaveForDOFAPeer(action, EmpNo, EmpName);
                    }
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = false;
                }
            }
            else if (menu == DataAccess.Enum.Menu.TPDEPT.ToString())
            {
                if (objectData != null && typeof(TPDeptViewModel) == objectData.GetType())
                {
                    TPDeptViewModel sdvm = (TPDeptViewModel)objectData;
                    DataCaptYM = sdvm.DataCaptYM;
                    DeptID     = "TPDEPT";
                    formsViewModel.isSaveSuccessfully = sdvm.SaveTPDeptData(action, out msg);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = false;
                }
            }
            else if (menu == DataAccess.Enum.Menu.INFRA.ToString())
            {
                if (objectData != null && typeof(InfraViewModel) == objectData.GetType())
                {
                    InfraViewModel sdvm = (InfraViewModel)objectData;
                    DataCaptYM = sdvm.DataCaptYM;
                    DeptID     = "INFRA";
                    formsViewModel.isSaveSuccessfully = sdvm.SaveInfraData(action, out msg);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = false;
                }
            }

            else if (menu == DataAccess.Enum.Menu.DFNP.ToString())
            {
                if (objectData != null && typeof(DFNPViewModel) == objectData.GetType())
                {
                    DFNPViewModel vm = (DFNPViewModel)objectData;
                    formsViewModel.isSaveSuccessfully = vm.SaveDFNPData(action, out msg);
                }
                else
                {
                    formsViewModel.isSaveSuccessfully = false;
                }
            }

            if (formsViewModel.isSaveSuccessfully && action.ToLower().Trim() != "save")
            {
                IsEmailSent = FormCommonMethods.SendFinallizeEmail(action, DataCaptYM, DeptID, needModificationMSG);
            }

            return(new Tuple <bool, bool?>(formsViewModel.isSaveSuccessfully, IsEmailSent));
        }