/// <summary> /// /// </summary> /// <param name="info2"></param> /// <returns></returns> public bool InsertTostInfo2(stInfo2 info2) { IDbCommand command = new SqlCommand().GetCommandWithParameters(info2, _Insert_INFO2); SqlConnection connection = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString); command.Connection = connection; command.ExecuteNonQuery(); DBConnectionHelper.CloseSqlConnection(connection); return(true); }
/// <summary> /// /// </summary> /// <param name="DataCaptYM"></param> /// <param name="DeptID"></param> /// <param name="MenuID"></param> /// <returns></returns> public stInfo2 GetADIRFormDataByID(int DataCaptYM, string DeptID, string MenuID) { Dictionary <string, object> sqlParamDictionary = new Dictionary <string, object>(); sqlParamDictionary.Add("DataCaptYM", DataCaptYM); sqlParamDictionary.Add("DeptID", DeptID); sqlParamDictionary.Add("MenuID", string.IsNullOrWhiteSpace(MenuID) ? "ADIR" : MenuID); IDbCommand command = new SqlCommand().GetCommandWithParameters(sqlParamDictionary, _SELECT_DOAA1_INFO); SqlConnection connection = DBConnectionHelper.OpenNewSqlConnection(this.ConnectionString); command.Connection = connection; stInfo2 stInfo2 = EntityMapper.MapSingle <stInfo2>(command.ExecuteReader()); DBConnectionHelper.CloseSqlConnection(connection); return(stInfo2); }
public void GetDOAA1Data(int DataCaptYM, string MenuID) { FormsRepository formsRepository = new FormsRepository(); DataCaptYM = SessionManager.DataCaptYR > 0 ? SessionManager.DataCaptYR : (DataCaptYM > 0 ? DataCaptYM : 0); if (MenuID == DataAccess.Enum.Menu.DOAA.ToString()) { this.info = formsRepository.GetDOAA1FormDataByID(DataCaptYM, SessionManager.DeptID, MenuID); if (info == null) { info = new stInfo(); info.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; info.DataStatusName = "Data Entry Started by Operator"; info.DataCaptYM = DataCaptYM; info.DeptName = info.DeptID = SessionManager.DeptID; } } else if (MenuID == DataAccess.Enum.Menu.ADIR.ToString() || MenuID == DataAccess.Enum.Menu.DOSW.ToString()) { this.info2 = formsRepository.GetADIRFormDataByID(DataCaptYM, SessionManager.DeptID, MenuID); if (info2 == null) { info2 = new stInfo2(); info2.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; info2.DataStatusName = "Data Entry Started by Operator"; info2.DataCaptYM = DataCaptYM; info2.DeptName = info2.DeptID = SessionManager.DeptID; } } else if (MenuID == DataAccess.Enum.Menu.LIBFORM.ToString()) { this.libInfo = formsRepository.GetLibFormDataByID(DataCaptYM, SessionManager.DeptID, MenuID); if (libInfo == null) { libInfo = new LibInfo(); libInfo.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; libInfo.DataStatusName = "Data Entry Started by Operator"; libInfo.DataCaptYM = DataCaptYM; libInfo.DeptName = libInfo.DeptID = SessionManager.DeptID; } } RankMesg rankmesg = FormCommonMethods.GetCurrentRankMesg(); this.rankmsg = rankmesg.Message; }
public bool SaveUpdateFormData(object objectData, string action, string menu) { FormsViewModel formsViewModel = new FormsViewModel(); 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 = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; if (action == "Finalize") { info2.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryCompletedbyOperator; } else if (action == "FinalizedByHod") { info2.DataStatus = (int)DataAccess.Enum.DataStatus.DataCheckingCompletedbyHOD; } 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"); 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 = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; if (action == "Finalize") { info.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryCompletedbyOperator; } else if (action == "FinalizedByHod") { info.DataStatus = (int)DataAccess.Enum.DataStatus.DataCheckingCompletedbyHOD; } info.DataUser = SessionManager.UserName; info.DeptID = SessionManager.DeptID; 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(); 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 = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; if (action == "Finalize") { libInfo.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryCompletedbyOperator; } else if (action == "FinalizedByHod") { libInfo.DataStatus = (int)DataAccess.Enum.DataStatus.DataCheckingCompletedbyHOD; } 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(); formsViewModel.libInfo = libInfo; if (formsViewModel.libInfo.IDNo > 0) { formsViewModel.isSaveSuccessfully = formsViewModel.UdpateLIBForm(formsViewModel); } else { formsViewModel.isSaveSuccessfully = formsViewModel.SaveLIBForm(formsViewModel); } } if (formsViewModel.isSaveSuccessfully && action == "Finalize") { try { string body = "The User: "******", Dept: " + SessionManager.DeptID + " , DataCapt: " + info.DataCaptYM + ", IRD Data has been finalised & sent for your Authorization. Kindly Check & Authorize/Approve the data." + "Time Stamp: DateTime Stamp: " + DateTime.Now + "This is a System generated Email."; string subject = "IRD Data Entry updated by " + SessionManager.UserName; DataCollectionModelDataContext db = new DataCollectionModelDataContext(); var hod = db.RankUsers.Where(a => a.DeptID.ToLower() == SessionManager.DeptID.ToLower() && a.UserRole.ToLower() == UserRoles.User.ToString().ToLower() && a.UserWork.ToLower() == DataAccess.Enum.UserWork.HOD.ToString().ToLower()).FirstOrDefault(); string tomail = "*****@*****.**"; if (hod != null) { tomail = hod.UserEmail; } FormServices formServices = new FormServices(); formServices.SendEmail(tomail, "", subject, body); } catch (Exception ex) { } } return(formsViewModel.isSaveSuccessfully); }
public void GetDOAA1Data(int DataCaptYM, string MenuID) { FormsRepository formsRepository = new FormsRepository(); DataCaptYM = SessionManager.DataCaptYR > 0 ? SessionManager.DataCaptYR : (DataCaptYM > 0 ? DataCaptYM : 0); if (MenuID == DataAccess.Enum.Menu.DOAA.ToString()) { string deptID = string.IsNullOrEmpty(SessionManager.EmpDeptID) ? SessionManager.DeptID : SessionManager.EmpDeptID; this.info = formsRepository.GetDOAA1FormDataByID(DataCaptYM, deptID, MenuID); if (info == null) { info = new stInfo(); info.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; info.DataStatusName = (DataAccess.Enum.DataStatus.DataEntryStartedbyOperator).GetStringValue(); info.DataCaptYM = DataCaptYM; info.DeptName = info.DeptID = SessionManager.DeptID; } info.EmpDept = SessionManager.EmpDeptID; } else if (MenuID == DataAccess.Enum.Menu.ADIR.ToString() || MenuID == DataAccess.Enum.Menu.DOSW.ToString()) { this.info2 = formsRepository.GetADIRFormDataByID(DataCaptYM, SessionManager.DeptID, MenuID); if (info2 == null) { info2 = new stInfo2(); info2.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; info2.DataStatusName = (DataAccess.Enum.DataStatus.DataEntryStartedbyOperator).GetStringValue(); info2.DataCaptYM = DataCaptYM; info2.DeptName = info2.DeptID = SessionManager.DeptID; } } else if (MenuID == DataAccess.Enum.Menu.LIBFORM.ToString()) { this.libInfo = formsRepository.GetLibFormDataByID(DataCaptYM, SessionManager.DeptID, MenuID); if (libInfo == null) { libInfo = new LibInfo(); libInfo.DataStatus = (int)DataAccess.Enum.DataStatus.DataEntryStartedbyOperator; libInfo.DataStatusName = (DataAccess.Enum.DataStatus.DataEntryStartedbyOperator).GetStringValue(); libInfo.DataCaptYM = DataCaptYM; libInfo.DeptName = libInfo.DeptID = SessionManager.DeptID; } } else if (MenuID == DataAccess.Enum.Menu.DOFA.ToString()) { dofaViewModel = new DofaViewModel(); dofaViewModel.GetDOFAData(DataCaptYM); } else if (MenuID == DataAccess.Enum.Menu.SRICFA.ToString()) { sricFAViewModel = new SricFAViewModel(); sricFAViewModel.GetSRICFAData(DataCaptYM); } else if (MenuID == DataAccess.Enum.Menu.SRIC.ToString()) { sricDeptViewModel = new SricDeptViewModel(); sricDeptViewModel.GetSRICData(DataCaptYM); } else if (MenuID == DataAccess.Enum.Menu.DOFAPEER.ToString()) { dofaPeerViewModel = new DofaPeerViewModel(); dofaPeerViewModel.GetDofaPeerData(DataCaptYM); } else if (MenuID == DataAccess.Enum.Menu.TPDEPT.ToString()) { tpDeptViewModel = new TPDeptViewModel(); tpDeptViewModel.GetTPDeptData(DataCaptYM); } else if (MenuID == DataAccess.Enum.Menu.INFRA.ToString()) { infraViewModel = new InfraViewModel(); infraViewModel.GetInfraData(DataCaptYM); } else if (MenuID == DataAccess.Enum.Menu.DFNP.ToString()) { dfnpViewModel = new DFNPViewModel(); dfnpViewModel.GetDFNPData(DataCaptYM); dfnpViewModel.finInfo.EmpDept = SessionManager.EmpDeptID; } RankMesg rankmesg = FormCommonMethods.GetCurrentRankMesg(); this.rankmsg = rankmesg.Message; }
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)); }