//[Button(ButtonName = "dropdown")] //[ActionName("dropdownIndex")] public JsonResult fillTemplateDropdown(int CommunicationModeCodeId) { //LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); Common.Common objCommon = new Common.Common(); if (!objCommon.ValidateCSRFForAJAX()) { return(Json(new { status = false, Message = "" }, JsonRequestBehavior.AllowGet)); } List <PopulateComboDTO> lstList = new List <PopulateComboDTO>(); if (CommunicationModeCodeId != 0) { lstList = FillComboValues(ConstEnum.ComboType.TemplateList, Convert.ToString(CommunicationModeCodeId), null, null, null, null, true); ViewBag.TemplateList = lstList; } return(Json(new { status = true, FinancialPeriodTypeId = lstList, Message = "" }, JsonRequestBehavior.AllowGet)); //return RedirectToAction("Index", "TradingWindowEvent", new { FinancialYearId = FinancialYearId, acid = acid }); }
public JsonResult dropdownIndex(int FinancialYearId, int FinancialPeriodTypeId, int acid) { LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); ComCodeSL objComCodeModel = new ComCodeSL(); ComCodeDTO objComCodeDTO = new ComCodeDTO(); Common.Common objCommon = new Common.Common(); if (!objCommon.ValidateCSRFForAJAX()) { return(Json(new { status = false, Message = "" }, JsonRequestBehavior.AllowGet)); } ViewBag.FinancialYearId = FinancialYearId; if (FinancialYearId != 0) { objComCodeDTO = objComCodeModel.GetDetails(objLoginUserDetails.CompanyDBConnectionString, FinancialYearId); FinancialPeriodTypeId = (objComCodeDTO.ParentCodeId == null ? 0 : Convert.ToInt32(objComCodeDTO.ParentCodeId)); } return(Json(new { status = true, FinancialPeriodTypeId = FinancialPeriodTypeId, Message = "Contact Successfully Submitted" }, JsonRequestBehavior.AllowGet)); //return RedirectToAction("Index", "TradingWindowEvent", new { FinancialYearId = FinancialYearId, acid = acid }); }
public ActionResult PartialCreateView2(int CommunicationMode_id) { LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); Common.Common objCommon = new Common.Common(); if (!objCommon.ValidateCSRFForAJAX()) { return(RedirectToAction("Unauthorised", "Home")); } ViewBag.isAllEdit = isAllEdit; ViewBag.CommunicationMode_id = CommunicationMode_id; return(PartialView("PartialCreate2")); }
public ActionResult ParentPopulateCombo_OnChange(string CodeId, string CalledFrom, int ParentId, int acid) { Common.Common objCommon = new Common.Common(); if (!objCommon.ValidateCSRFForAJAX()) { return(RedirectToAction("Unauthorised", "Home")); } ViewBag.GridType = ConstEnum.GridType.ComCodeList; ViewBag.AddNew = ParentId; ViewBag.UserAction = acid; return(PartialView("PartialDataGrid")); }
/// <summary> /// This method is used to fetch sub category drop down view (partial) /// </summary> /// <param name="category_id"></param> /// <returns></returns> public ActionResult PartialCreateView(int CommunicationMode_id) { Common.Common objCommon = new Common.Common(); if (!objCommon.ValidateCSRFForAJAX()) { return(RedirectToAction("Unauthorised", "Home")); } CommunicationRuleMasterModel objCommunicationRuleMasterModel = new CommunicationRuleMasterModel(); LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); List <PopulateComboDTO> lstList = new List <PopulateComboDTO>(); ViewBag.isAllEdit = isAllEdit; lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.Events).ToString(), null, null, null, null, false); ViewBag.TriggerEventCodeList = lstList; lstList = FillComboValues(ConstEnum.ComboType.ListofEventsWithUserTypeForCommunicatioTriggerEvent, null, null, null, null, null, false); ViewBag.TriggerEventCodeWithUserTypeList = lstList; lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.Events).ToString(), null, null, null, null, false); ViewBag.OffsetEventCodeList = lstList; objCommunicationRuleMasterModel.AssignedTriggerEventCodeId = new List <PopulateComboDTO>(); objCommunicationRuleMasterModel.AssignedOffsetEventCodeId = new List <PopulateComboDTO>(); ViewBag.CommunicationMode_id = CommunicationMode_id; return(PartialView("PartialCreate1", objCommunicationRuleMasterModel)); }
public ActionResult PopulateCombo_OnChange(string CodeId, string CalledFrom, int ParentId, int acid) { LoginUserDetails objLoginUserDetails = null; ComCodeModel objComCodeModel = null; PopulateComboDTO objPopulateComboDTO = null; List <PopulateComboDTO> lstParentCodeGroup = null; List <PopulateComboDTO> lstLabelForParent = null; List <PopulateComboDTO> lstCodeGroup = null; string sView = string.Empty; Common.Common objCommon = new Common.Common(); try { if (!objCommon.ValidateCSRFForAJAX()) { return(RedirectToAction("Unauthorised", "Home")); } string ParentLabel = ""; string[] arr = new String[2]; objComCodeModel = new ComCodeModel(); objPopulateComboDTO = new PopulateComboDTO(); objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); arr = CodeId.Split(new string[] { "-" }, StringSplitOptions.None); if (Convert.ToInt32(arr[1]) != 0) { objPopulateComboDTO.Key = "0"; objPopulateComboDTO.Value = "Select"; lstParentCodeGroup = new List <PopulateComboDTO>(); lstParentCodeGroup.Add(objPopulateComboDTO); lstParentCodeGroup.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.ListOfCode, arr[1], null, null, null, null, sLookUpPrefix)); lstLabelForParent = new List <PopulateComboDTO>(); lstLabelForParent.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList, null, arr[1], null, null, null, sLookUpPrefix)); ParentLabel = lstLabelForParent.ElementAt <PopulateComboDTO>(0).Value; if (ParentLabel.Contains("Master")) { ParentLabel = ParentLabel.Substring(0, (ParentLabel.Length - 7)); } if (CalledFrom == "Details") { ViewBag.ParentCodeName = lstParentCodeGroup; ViewBag.SelectedValue = "0"; } else if (CalledFrom == "List") { ViewBag.ParentCodeName = lstParentCodeGroup; } } lstCodeGroup = new List <PopulateComboDTO>(); lstCodeGroup.Add(objPopulateComboDTO); lstCodeGroup.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList, null, null, null, null, null, sLookUpPrefix)); objComCodeModel.CodeGroupId = CodeId; if (CalledFrom == "Details") { ViewBag.ParentLabel = ParentLabel; ViewBag.CodeGroupDropDown = lstCodeGroup; sView = "PartialCreate"; } else if (CalledFrom == "List") { ViewBag.GridType = ConstEnum.GridType.ComCodeList; if (arr[1] != "0") { ViewBag.ParentLabel = ParentLabel; ViewBag.ParentId = ParentId; objComCodeModel.ParentCodeId = ParentId; ViewBag.CodeGroupDropDown = new SelectList(lstCodeGroup, "Key", "Value"); sView = "PartialIndex"; } else if (ParentId == 0) { ViewBag.AddNew = 1; sView = "PartialDataGrid"; } } ViewBag.UserAction = acid; } finally { objLoginUserDetails = null; objPopulateComboDTO = null; lstParentCodeGroup = null; lstLabelForParent = null; lstCodeGroup = null; } return(PartialView(sView, objComCodeModel)); }
public JsonResult Apply(string nAllEmployeeFlag, string nAllInsiderFlag, string nAllEmployeeInsiderFlag, string nAllCoFlag, string nAllCorporateInsiderFlag, string nAllNonEmployeeInsiderFlag, string sMapToId, string sMapToTypeCodeId, string arrIncluded, string arrExcluded, string arrFilter, string arrnonInsEmpFilter, int acid, string __RequestVerificationToken = "", int formId = 0) { bool statusFlag = false; var ErrorDictionary = new Dictionary <string, string>(); string[][] arrApplicabilityInclude = null; string[] arrApplicabilityExclude = null; List <ApplicabilityFilter> arrFilterList = null; List <NonInsEmpApplicabilityFilter> arrFilterNonInsEmpList = null; LoginUserDetails objLoginUserDetails = null; DataTable tblApplicabilityUserIncludeExclude = null; DataTable tblApplicabilityFilterType = null; DataTable tblNonInsEmpApplicabilityFilterType = null; Common.Common objCommon = new Common.Common(); try { if (!objCommon.ValidateCSRFForAJAX()) { return(Json(new { status = statusFlag, Message = ErrorDictionary }, JsonRequestBehavior.AllowGet)); } objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails); if (arrIncluded != "") { arrApplicabilityInclude = JsonConvert.DeserializeObject <string[][]>(arrIncluded); } if (arrExcluded != "") { arrApplicabilityExclude = JsonConvert.DeserializeObject <string[]>(arrExcluded); } if (arrFilter != "") { arrFilterList = JsonConvert.DeserializeObject <List <ApplicabilityFilter> >(arrFilter); } if (arrnonInsEmpFilter != "") { arrFilterNonInsEmpList = JsonConvert.DeserializeObject <List <NonInsEmpApplicabilityFilter> >(arrnonInsEmpFilter); } tblApplicabilityUserIncludeExclude = new DataTable("ApplicabilityUserIncludeExcludeType"); tblApplicabilityUserIncludeExclude.Columns.Add(new DataColumn("UserId", typeof(int))); tblApplicabilityUserIncludeExclude.Columns.Add(new DataColumn("InsiderTypeCodeId", typeof(int))); tblApplicabilityUserIncludeExclude.Columns.Add(new DataColumn("IncludeExcludeCodeId", typeof(int))); if (arrApplicabilityInclude != null) { for (int i = 0; i < arrApplicabilityInclude.Length; i++) { int UserTypeCodeId = i == 0 ? ConstEnum.Code.EmployeeType : i == 1 ? ConstEnum.Code.CorporateUserType : i == 2 ? ConstEnum.Code.NonEmployeeType : i == 3 ? ConstEnum.Code.COUserType : ConstEnum.Code.EmployeeType; DataRow row = null; for (int j = 0; j < arrApplicabilityInclude[i].Length; j++) { row = tblApplicabilityUserIncludeExclude.NewRow(); row["UserId"] = Convert.ToInt32(arrApplicabilityInclude[i][j]); row["InsiderTypeCodeId"] = UserTypeCodeId; row["IncludeExcludeCodeId"] = InsiderTrading.Common.ConstEnum.Code.IncludeTypeCode; tblApplicabilityUserIncludeExclude.Rows.Add(row); } row = null; } } if (arrApplicabilityExclude != null) { DataRow row = null; for (int i = 0; i < arrApplicabilityExclude.Length; i++) { row = tblApplicabilityUserIncludeExclude.NewRow(); row["UserId"] = Convert.ToInt32(arrApplicabilityExclude[i]); row["InsiderTypeCodeId"] = ConstEnum.Code.EmployeeType; row["IncludeExcludeCodeId"] = InsiderTrading.Common.ConstEnum.Code.ExcludeTypeCode; tblApplicabilityUserIncludeExclude.Rows.Add(row); } row = null; } tblApplicabilityFilterType = new DataTable("ApplicabilityFilterType"); tblApplicabilityFilterType.Columns.Add(new DataColumn("ApplicabilityDtlsId", typeof(int))); tblApplicabilityFilterType.Columns.Add(new DataColumn("DepartmentCodeId", typeof(int))); tblApplicabilityFilterType.Columns.Add(new DataColumn("GradeCodeId", typeof(int))); tblApplicabilityFilterType.Columns.Add(new DataColumn("DesignationCodeId", typeof(int))); tblApplicabilityFilterType.Columns.Add(new DataColumn("CategoryCodeId", typeof(int))); tblApplicabilityFilterType.Columns.Add(new DataColumn("SubCategoryCodeId", typeof(int))); tblApplicabilityFilterType.Columns.Add(new DataColumn("RoleId", typeof(int))); tblNonInsEmpApplicabilityFilterType = new DataTable("NonInsEmpApplicabilityFilterType"); tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("ApplicabilityDtlsId", typeof(int))); tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("DepartmentCodeId", typeof(int))); tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("GradeCodeId", typeof(int))); tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("DesignationCodeId", typeof(int))); tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("CategoryCodeId", typeof(int))); tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("SubCategoryCodeId", typeof(int))); tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("RoleId", typeof(int))); if (arrFilterList != null) { DataRow row = null; foreach (var objFilter in arrFilterList) { row = tblApplicabilityFilterType.NewRow(); row["ApplicabilityDtlsId"] = 0; row["DepartmentCodeId"] = DBNull.Value; row["GradeCodeId"] = DBNull.Value; row["DesignationCodeId"] = DBNull.Value; row["CategoryCodeId"] = DBNull.Value; row["SubCategoryCodeId"] = DBNull.Value; row["RoleId"] = DBNull.Value; if (objFilter.ApplicabilityDtlsId != "" && objFilter.ApplicabilityDtlsId != "0") { row["ApplicabilityDtlsId"] = Convert.ToInt32(objFilter.ApplicabilityDtlsId); } if (objFilter.DepartmentId != "" && objFilter.DepartmentId != "0") { row["DepartmentCodeId"] = Convert.ToInt32(objFilter.DepartmentId); } if (objFilter.GradeId != "" && objFilter.GradeId != "0") { row["GradeCodeId"] = Convert.ToInt32(objFilter.GradeId); } if (objFilter.DesignationId != "" && objFilter.DesignationId != "0") { row["DesignationCodeId"] = Convert.ToInt32(objFilter.DesignationId); } if (objFilter.CategoryId != "" && objFilter.CategoryId != "0") { row["CategoryCodeId"] = Convert.ToInt32(objFilter.CategoryId); } if (objFilter.SubCategoryId != "" && objFilter.SubCategoryId != "0") { row["SubCategoryCodeId"] = Convert.ToInt32(objFilter.SubCategoryId); } if (objFilter.RoleId != "" && objFilter.RoleId != "0") { row["RoleId"] = Convert.ToInt32(objFilter.RoleId); } if (row["DesignationCodeId"] != DBNull.Value || row["GradeCodeId"] != DBNull.Value || row["DepartmentCodeId"] != DBNull.Value || row["CategoryCodeId"] != DBNull.Value || row["SubCategoryCodeId"] != DBNull.Value || row["RoleId"] != DBNull.Value) { tblApplicabilityFilterType.Rows.Add(row); } } row = null; } if (arrFilterNonInsEmpList != null) { DataRow row = null; foreach (var objFilter in arrFilterNonInsEmpList) { row = tblNonInsEmpApplicabilityFilterType.NewRow(); row["ApplicabilityDtlsId"] = 0; row["DepartmentCodeId"] = DBNull.Value; row["GradeCodeId"] = DBNull.Value; row["DesignationCodeId"] = DBNull.Value; row["CategoryCodeId"] = DBNull.Value; row["SubCategoryCodeId"] = DBNull.Value; row["RoleId"] = DBNull.Value; if (objFilter.ApplicabilityDtlsId != "" && objFilter.ApplicabilityDtlsId != "0") { row["ApplicabilityDtlsId"] = Convert.ToInt32(objFilter.ApplicabilityDtlsId); } if (objFilter.DepartmentId != "" && objFilter.DepartmentId != "0") { row["DepartmentCodeId"] = Convert.ToInt32(objFilter.DepartmentId); } if (objFilter.GradeId != "" && objFilter.GradeId != "0") { row["GradeCodeId"] = Convert.ToInt32(objFilter.GradeId); } if (objFilter.DesignationId != "" && objFilter.DesignationId != "0") { row["DesignationCodeId"] = Convert.ToInt32(objFilter.DesignationId); } if (objFilter.CategoryId != "" && objFilter.CategoryId != "0") { row["CategoryCodeId"] = Convert.ToInt32(objFilter.CategoryId); } if (objFilter.SubCategoryId != "" && objFilter.SubCategoryId != "0") { row["SubCategoryCodeId"] = Convert.ToInt32(objFilter.SubCategoryId); } if (objFilter.RoleId != "" && objFilter.RoleId != "0") { row["RoleId"] = Convert.ToInt32(objFilter.RoleId); } if (row["DesignationCodeId"] != DBNull.Value || row["GradeCodeId"] != DBNull.Value || row["DepartmentCodeId"] != DBNull.Value || row["CategoryCodeId"] != DBNull.Value || row["SubCategoryCodeId"] != DBNull.Value || row["RoleId"] != DBNull.Value) { tblNonInsEmpApplicabilityFilterType.Rows.Add(row); } } row = null; } using (ApplicabilitySL objApplicabilitySl = new ApplicabilitySL()) { int nCountOverlapPolicy = 0; objApplicabilitySl.InsertDeleteApplicability(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(sMapToTypeCodeId), Convert.ToInt32(sMapToId), Convert.ToInt32(nAllEmployeeFlag), Convert.ToInt32(nAllInsiderFlag), Convert.ToInt32(nAllEmployeeInsiderFlag), Convert.ToInt32(nAllCoFlag), Convert.ToInt32(nAllCorporateInsiderFlag), Convert.ToInt32(nAllNonEmployeeInsiderFlag), tblApplicabilityFilterType, tblNonInsEmpApplicabilityFilterType, tblApplicabilityUserIncludeExclude, objLoginUserDetails.LoggedInUserID, out nCountOverlapPolicy); statusFlag = true; ErrorDictionary.Add("success", "Applicability saved successfully."); ErrorDictionary.Add("CountOverlapPolicy", Convert.ToString(nCountOverlapPolicy)); } } catch (Exception exp) { ModelState.Remove("KEY"); ModelState.Add("KEY", new ModelState()); ModelState.Clear(); string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString()); ModelState.AddModelError("error", sErrMessage); ErrorDictionary = GetModelStateErrorsAsString(); } finally { objLoginUserDetails = null; arrApplicabilityInclude = null; arrApplicabilityExclude = null; arrFilterList = null; tblApplicabilityUserIncludeExclude = null; tblApplicabilityFilterType = null; } return(Json(new { status = statusFlag, Message = ErrorDictionary }, JsonRequestBehavior.AllowGet)); }
public JsonResult Index(DelegateModel objDelegateModel, int acid) { bool bStatusFlag = false; int nPatrialSave = 0; var ErrorDictionary = new Dictionary <string, string>(); Common.Common objCommon = new Common.Common(); LoginUserDetails objLoginUserDetails = null; try { if (!objCommon.ValidateCSRFForAJAX()) { return(Json(new { status = false, msg = ErrorDictionary }, JsonRequestBehavior.AllowGet)); } objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); if (ModelState.IsValid) { ViewBag.UserInfoIdFrom = objDelegateModel.UserInfoIdFrom; ViewBag.UserInfoIdTo = objDelegateModel.UserInfoIdTo; ViewBag.DelegationFrom = objDelegateModel.DelegationFrom; ViewBag.DelegationTo = objDelegateModel.DelegationTo; objDelegateModel.DelegationId = 0; DelegationMasterDTO objDelegationMasterDTO = new DelegationMasterDTO(); Common.Common.CopyObjectPropertyByName(objDelegateModel, objDelegationMasterDTO); using (DelegationMasterSL objDelegationMasterSL = new DelegationMasterSL()) { objDelegationMasterDTO = objDelegationMasterSL.SaveDetails(objDelegationMasterDTO, nPatrialSave, objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); bStatusFlag = true; ErrorDictionary.Add("id", Convert.ToString(objDelegationMasterDTO.DelegationId)); } } else { ErrorDictionary = GetModelStateErrorsAsString(); } }catch (Exception e) { ModelState.Remove("KEY"); ModelState.Add("KEY", new ModelState()); ModelState.Clear(); string sErrMessage = Common.Common.getResource(e.InnerException.Data[0].ToString()); ModelState.AddModelError("error", sErrMessage); ErrorDictionary = GetModelStateErrorsAsString(); } finally { objLoginUserDetails = null; } return(Json(new { status = bStatusFlag, msg = ErrorDictionary, user_action = acid })); }
public JsonResult Create(List <TradingWindowEventModel> tradingWindowEventModel, int nFinancialYearCodeId, int nFinancialPeriodTypeCodeId, int acid, string __RequestVerificationToken, int formId) //public JsonResult Create(List<TradingWindowEventModel> tradingWindowEventModel, int nFinancialYearCodeId, int nFinancialPeriodTypeCodeId, int acid) { bool bReturn = true; LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); TradingWindowEventSL objTradingWindowEventSL = new TradingWindowEventSL(); Common.Common objCommon = new Common.Common(); try { if (!objCommon.ValidateCSRFForAJAX()) { return(Json(new { status = false, error = "" }, JsonRequestBehavior.AllowGet)); } #region Create Data Table tblTradingWindowEventType DataTable tblTradingWindowEventType = new DataTable("TradingWindowEventType"); tblTradingWindowEventType.Columns.Add(new DataColumn("TradingWindowEventId", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("FinancialYearCodeId", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("FinancialPeriodCodeId", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("TradingWindowId", typeof(string))); tblTradingWindowEventType.Columns.Add(new DataColumn("EventTypeCodeId", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("TradingWindowEventCodeId", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("ResultDeclarationDate", typeof(DateTime))); tblTradingWindowEventType.Columns.Add(new DataColumn("WindowCloseDate", typeof(DateTime))); tblTradingWindowEventType.Columns.Add(new DataColumn("WindowOpenDate", typeof(DateTime))); tblTradingWindowEventType.Columns.Add(new DataColumn("DaysPriorToResultDeclaration", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("DaysPostResultDeclaration", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("WindowClosesBeforeHours", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("WindowClosesBeforeMinutes", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("WindowOpensAfterHours", typeof(int))); tblTradingWindowEventType.Columns.Add(new DataColumn("WindowOpensAfterMinutes", typeof(int))); #endregion Create Data Table tblTradingWindowEventType ModelState.Clear(); foreach (var index in tradingWindowEventModel) { DataRow row = tblTradingWindowEventType.NewRow(); DateTime now = Common.Common.GetCurrentDate(objLoginUserDetails.CompanyDBConnectionString); if (index.TradingWindowEventId != null) { row["TradingWindowEventId"] = index.TradingWindowEventId; } row["FinancialYearCodeId"] = nFinancialYearCodeId; if (index.FinancialPeriodCodeId != null) { row["FinancialPeriodCodeId"] = index.FinancialPeriodCodeId; } if (index.TradingWindowId != null) { row["TradingWindowId"] = index.TradingWindowId; } if (index.ResultDeclarationDate != null) { row["ResultDeclarationDate"] = index.ResultDeclarationDate; } else { ModelState.AddModelError("ResultDeclarationDate", "Enter Result Declaration Date");//InsiderTrading.Common.Common.getResource("rul_msg_15083")); bReturn = false; } if (index.WindowOpenDate != null) { row["WindowOpenDate"] = index.WindowOpenDate; } if (index.WindowCloseDate != null) { row["WindowCloseDate"] = index.WindowCloseDate; } if (index.DaysPriorToResultDeclaration != null) { row["DaysPriorToResultDeclaration"] = index.DaysPriorToResultDeclaration; } else { ModelState.AddModelError("DaysPriorToResultDeclaration", "Enter Days Prior To Result Declaration");//InsiderTrading.Common.Common.getResource("rul_msg_15083")); bReturn = false; } if (index.DaysPostResultDeclaration != null) { row["DaysPostResultDeclaration"] = index.DaysPostResultDeclaration; } else { ModelState.AddModelError("DaysPriorToResultDeclaration", "Enter DaysPostResultDeclaration");//InsiderTrading.Common.Common.getResource("rul_msg_15083")); bReturn = false; } if (!bReturn) { break; } tblTradingWindowEventType.Rows.Add(row); } if (!bReturn && !ModelState.IsValid) { return(Json(new { status = false, error = ModelState.ToSerializedDictionary() })); } bReturn = objTradingWindowEventSL.SaveDetails(objLoginUserDetails.CompanyDBConnectionString, tblTradingWindowEventType, nFinancialPeriodTypeCodeId, objLoginUserDetails.LoggedInUserID); // TODO: Add insert logic here return(Json(new { status = true, Message = Common.Common.getResource("rul_msg_15380")//"Data saved successfully." }, JsonRequestBehavior.AllowGet)); } catch (Exception exp) { string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString()); ModelState.AddModelError("Error", Common.Common.GetErrorMessage(exp)); return(Json(new { status = false, error = ModelState.ToSerializedDictionary() })); } finally { objLoginUserDetails = null; objTradingWindowEventSL = null; } }
public JsonResult UpdateResourceValue(ResourceModel objResourceModel, int acid) { bool bReturn = false; LoginUserDetails objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails); ResourcesSL objResourcesSL = new ResourcesSL(); ResourcesDTO objResourcesDTO = new ResourcesDTO(); CompaniesSL objCompaniesSL = new CompaniesSL(); bool statusFlag = false; var ErrorDictionary = new Dictionary <string, string>(); Common.Common objCommon = new Common.Common(); string message = string.Empty; try { if (!objCommon.ValidateCSRFForAJAX()) { return(Json(new { status = statusFlag, Message = ErrorDictionary }, JsonRequestBehavior.AllowGet)); } Common.Common.CopyObjectPropertyByName(objResourceModel, objResourcesDTO); objResourcesDTO.LoggedInUserId = objLoginUserDetails.LoggedInUserID; bReturn = objResourcesSL.SaveDetails(objLoginUserDetails.CompanyDBConnectionString, objResourcesDTO); if (bReturn) { objCompaniesSL.UpdateMasterCompanyDetails(Common.Common.getSystemConnectionString(), objLoginUserDetails.CompanyName, 1); Common.Common.UpdateCompanyResources(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.CompanyName); //return Json(new //{ // status = true, // Message = InsiderTrading.Common.Common.getResource("mst_msg_10049") //"Resource Update Successfully." //}, JsonRequestBehavior.AllowGet); statusFlag = true; message = InsiderTrading.Common.Common.getResource("mst_msg_10049"); } else { statusFlag = false; message = "Resource not saved."; } //return Json(new //{ // status = false, // Message = "Resource not saved." //}, JsonRequestBehavior.AllowGet); } catch (Exception exp) { ModelState.Remove("KEY"); ModelState.Add("KEY", new ModelState()); ModelState.Clear(); string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString()); ModelState.AddModelError("error", sErrMessage); ErrorDictionary = GetModelStateErrorsAsString(); } finally { objLoginUserDetails = null; objResourcesSL = null; objResourcesDTO = null; objCompaniesSL = null; } return(Json(new { status = statusFlag, Message = message }, JsonRequestBehavior.AllowGet)); }
public JsonResult Delete(int acid, int TemplateMasterId) { bool statusFlag = false; var ErrorDictionary = new Dictionary <string, string>(); LoginUserDetails objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails); Common.Common objCommon = new Common.Common(); try { // TemplateMasterSL objTemplateMasterSL = new TemplateMasterSL(); //TemplateMasterModel objTemplateMasterModel = new TemplateMasterModel(); if (!objCommon.ValidateCSRFForAJAX()) { return(Json(new { status = statusFlag, Message = ErrorDictionary }, JsonRequestBehavior.AllowGet)); } using (var objTemplateMasterSL = new TemplateMasterSL()) { bool result = objTemplateMasterSL.Delete(objLoginUserDetails.CompanyDBConnectionString, TemplateMasterId, objLoginUserDetails.LoggedInUserID); } // return RedirectToAction("Index", "TemplateMaster",new {acid = ConstEnum.UserActions.TEMPLATE_LIST_RIGHT }); statusFlag = true; ErrorDictionary.Add("success", Common.Common.getResource("tra_msg_16175")); } catch (Exception exp) { //string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString()); //ModelState.AddModelError("Error", sErrMessage); TemplateMasterModel objTemplateMasterModel = new TemplateMasterModel(); List <PopulateComboDTO> lstList = new List <PopulateComboDTO>(); lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, ConstEnum.CodeGroup.RoleStatus, null, null, null, null, true); ViewBag.TemplateStatus = lstList; //get list of communication mode lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, ConstEnum.CodeGroup.CommunicationModes, null, null, null, null, true); ViewBag.CommunicationMode = lstList; //get list of disclousre type lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, ConstEnum.CodeGroup.DisclosureType, null, null, null, null, true); ViewBag.DisclosureType = lstList; lstList = null; FillGrid(ConstEnum.GridType.TemplateMasteList, null, null, null); // return View("View", objTemplateMasterModel); ModelState.Remove("KEY"); ModelState.Add("KEY", new ModelState()); ModelState.Clear(); string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString()); ModelState.AddModelError("error", sErrMessage); ErrorDictionary = GetModelStateErrorsAsString(); } finally { objLoginUserDetails = null; } return(Json(new { status = statusFlag, Message = ErrorDictionary }, JsonRequestBehavior.AllowGet)); }
public ActionResult AjaxHandler(String gridtype, String inp_sParam = "", String isInsider = "", int acid = 0, String ClearSearchFilter = "") { if (ClearSearchFilter == "True") { TempData.Remove("SearchArray"); JsonResult returnJson = Json(new { status = false }, JsonRequestBehavior.AllowGet); return(returnJson); } int out_iTotalRecords = 0; String sLookUpPrefix = ""; LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); IEnumerable <Object> lstCRUserList = new List <Object>(); // Change the received generic object to <key, value> pair as per required for datatable. List <Dictionary <string, Object> > lstUserList = new List <Dictionary <string, Object> >(); Common.Common objCommon = new Common.Common(); try { if (!objCommon.ValidateCSRFForAJAX()) { return(RedirectToAction("Unauthorised", "Home")); } //Fetch Search parameters String sSearch = Request.Form["Search"]; String[] arr = new string[51]; arr = sSearch.Split(new string[] { "|#|" }, StringSplitOptions.None); for (int i = 0; i <= arr.Length - 1; i++) { if (arr[i] == "" || arr[i] == "0") { arr[i] = null; } } if (!IsNullOrEmpty(arr) && (gridtype == InsiderTrading.Common.ConstEnum.GridType.ContinuousDisclosureListForCO.ToString() || gridtype == InsiderTrading.Common.ConstEnum.GridType.ContinousDisclosureStatusList.ToString() || gridtype == InsiderTrading.Common.ConstEnum.GridType.Report_ContinuousReportEmployeeWise.ToString() || gridtype == InsiderTrading.Common.ConstEnum.GridType.Report_InitialDisclosureEmployeeWise.ToString() || gridtype == InsiderTrading.Common.ConstEnum.GridType.InitialDisclosureListForCO.ToString() || gridtype == InsiderTrading.Common.ConstEnum.GridType.COUserList.ToString() || gridtype == InsiderTrading.Common.ConstEnum.GridType.EmployeeUserList.ToString() || (gridtype == InsiderTrading.Common.ConstEnum.GridType.RestrictedList.ToString() && arr[8] != "History"))) { TempData["SearchArray"] = arr; TempData.Keep("SearchArray"); } if (!IsNullOrEmpty(arr) && (gridtype == InsiderTrading.Common.ConstEnum.GridType.Report_ContinuousReportEmployeeIndividual.ToString() || gridtype == InsiderTrading.Common.ConstEnum.GridType.Report_InitialDisclosureEmployeeIndividual.ToString())) { TempData["ReportSearchArray"] = arr; TempData.Keep("ReportSearchArray"); } //Get sort column, direction, display length and page number String sSortCol = Request.Form["mDataProp_" + Request.Form["iSortCol_0"]]; String sSortDir = Request.Form["sSortDir_0"]; int nDisplayLength = Convert.ToInt32(Request.Form["iDisplayLength"]); int nPage = 0; if (nDisplayLength != 0) { nPage = Convert.ToInt32(Request.Form["iDisplayStart"]) / nDisplayLength + 1; } using (GenericSLImpl <Object> objGenericSLImpl = new GenericSLImpl <Object>()) { //PENDING TRANSACTIONS DASHBOARD : Initial Disclosures-Insider if (isInsider == "InitialDisInsider" && inp_sParam == "154002") { //nDisplayLength = 10; lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Initial Disclosures-Insider Relative else if (isInsider == "InitialDisInsider-Relative" && inp_sParam == "154002") { //nDisplayLength = 10; lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], "1", arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Initial Disclosures-CO else if (isInsider == "ContiDisCO" && inp_sParam == "154006") { //nDisplayLength = 10; lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Continuous Disclosures-CO else if (isInsider == "ContinouseDisCO" && inp_sParam == "114049") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], "153019", arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], "2", arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Continuous Disclosures-Insider else if (isInsider == "ContiDisInsider" && inp_sParam == "144001") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], "153019", arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], "3", arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Period End Disclosures-Insider else if (isInsider == "PeriodEndDisInsider" && inp_sParam == "154002") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], inp_sParam, arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Period End Disclosures-Insider else if (isInsider == "PeriodEndDisCO") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], "1", arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Trade details-Insider else if (isInsider == "TradeDetailsInsider" && inp_sParam == "154002") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], "1", arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Trade details-CO else if (isInsider == "TradeDetailsCO" && inp_sParam == "154006") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], "1", arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Submission to Stock Exchange-CO else if (isInsider == "SubToStckExCO" && inp_sParam == "154002") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], inp_sParam, arr[19], arr[20], arr[21], arr[22], arr[23], "1", arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //PENDING TRANSACTIONS DASHBOARD : Pre-clearances-CO else if (isInsider == "PreClearancesCO" && inp_sParam == "144001") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], inp_sParam, arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } else if (isInsider == "PreClearancesCO_OS" && inp_sParam == "144001") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], inp_sParam, arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } else if (isInsider == "PreClearancesCO_OS" && inp_sParam == "154002") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //Defaulter DASHBOARD : Initial, Continouse, Period End, Pre-Clearance else if (inp_sParam == "170001" || inp_sParam == "170002" || inp_sParam == "170003" || inp_sParam == "170004") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], inp_sParam, arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } //Defaulter DASHBOARD : Contra Trade else if (inp_sParam == "169007") { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], inp_sParam, arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } else { lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage, sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29], arr[30], arr[31], arr[32], arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47], arr[48], arr[49] ); } } foreach (dynamic objUserList in lstCRUserList) { var dictionary = new Dictionary <string, Object>(); foreach (KeyValuePair <string, Object> kvp in objUserList) // enumerating over it exposes the Properties and Values as a KeyValuePair { dictionary.Add(kvp.Key, kvp.Value); } lstUserList.Add(dictionary); dictionary = null; } JsonResult returnJson = Json(new { aaData = lstUserList, status = true, draw = Request.Form["draw"], iTotalRecords = out_iTotalRecords, iTotalDisplayRecords = out_iTotalRecords }, JsonRequestBehavior.AllowGet); return(returnJson); } catch (Exception exp) { lstUserList = new List <Dictionary <string, Object> >(); JsonResult returnJson = Json(new { aaData = lstUserList, status = false, draw = Request.Form["draw"], iTotalRecords = 0, iTotalDisplayRecords = 0 }, JsonRequestBehavior.AllowGet); return(returnJson); } finally { lstCRUserList = null; lstUserList = null; } }
public JsonResult SaveCommunicationRule(int acid, CommunicationRuleMasterModel objCommunicationRuleMasterModel) { bool bReturn = true; LoginUserDetails objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails); Common.Common objCommon = new Common.Common(); try { if (!objCommon.ValidateCSRFForAJAX()) { Json(new { status = false, error = ModelState.ToSerializedDictionary() }); } // TODO: Add insert logic here ModelState.Remove("KEY"); ModelState.Add("KEY", new ModelState()); ModelState.Clear(); // CommunicationRuleMasterSL objCommunicationRuleMasterSL = new CommunicationRuleMasterSL(); CommunicationRuleMasterDTO objCommunicationRuleMasterDTO = new CommunicationRuleMasterDTO(); InsiderTrading.Common.Common.CopyObjectPropertyByName(objCommunicationRuleMasterModel, objCommunicationRuleMasterDTO); if (objCommunicationRuleMasterModel.SelectTriggerEventCodeId != null && objCommunicationRuleMasterModel.SelectTriggerEventCodeId.Count() > 0) { var sSubmittedSecurityTypeList = String.Join(",", objCommunicationRuleMasterModel.SelectTriggerEventCodeId); objCommunicationRuleMasterDTO.TriggerEventCodeId = sSubmittedSecurityTypeList; } if (objCommunicationRuleMasterModel.SelectOffsetEventCodeId != null && objCommunicationRuleMasterModel.SelectOffsetEventCodeId.Count() > 0) { var sSubmittedSecurityTypeList = String.Join(",", objCommunicationRuleMasterModel.SelectOffsetEventCodeId); objCommunicationRuleMasterDTO.OffsetEventCodeId = sSubmittedSecurityTypeList; } if (objCommunicationRuleMasterModel.RuleCategoryCodeId == ConstEnum.Code.CommunicationRuleCategoryAuto && ((objCommunicationRuleMasterDTO.TriggerEventCodeId == null || objCommunicationRuleMasterDTO.TriggerEventCodeId == "") && (objCommunicationRuleMasterDTO.OffsetEventCodeId == null || objCommunicationRuleMasterDTO.OffsetEventCodeId == ""))) { ModelState.AddModelError("TriggerEventCodeId", InsiderTrading.Common.Common.getResource("cmu_msg_18062")); bReturn = false; } objCommunicationRuleMasterDTO.RuleForCodeId = ""; if (objCommunicationRuleMasterModel.RuleForCodeId_bool != null) { objCommunicationRuleMasterDTO.RuleForCodeId = (objCommunicationRuleMasterModel.RuleForCodeId_bool == YesNo.Yes) ? Convert.ToString(ConstEnum.Code.CommunicationRuleForUserTypeCO) : Convert.ToString(ConstEnum.Code.CommunicationRuleForUserTypeInsider); } if (objCommunicationRuleMasterModel.EventsApplyToCodeId_bool != null) { objCommunicationRuleMasterDTO.EventsApplyToCodeId = (objCommunicationRuleMasterModel.EventsApplyToCodeId_bool == YesNo.Yes) ? ConstEnum.Code.CommunicationRuleEventsToApplyUserTypeCO : ConstEnum.Code.CommunicationRuleEventsToApplyUserTypeInsider; } if (objCommunicationRuleMasterModel.InsiderPersonalize != null) { objCommunicationRuleMasterDTO.InsiderPersonalizeFlag = (objCommunicationRuleMasterModel.InsiderPersonalize == YesNo.Yes) ? true : false; } #region DataTable tblCommunicationRuleModeMasterType = new DataTable("CommunicationRuleModeMasterType"); tblCommunicationRuleModeMasterType.Columns.Add(new DataColumn("RuleModeId", typeof(int))); tblCommunicationRuleModeMasterType.Columns.Add(new DataColumn("RuleId", typeof(int))); tblCommunicationRuleModeMasterType.Columns.Add(new DataColumn("ModeCodeId", typeof(int))); tblCommunicationRuleModeMasterType.Columns.Add(new DataColumn("TemplateId", typeof(int))); tblCommunicationRuleModeMasterType.Columns.Add(new DataColumn("WaitDaysAfterTriggerEvent", typeof(int))); tblCommunicationRuleModeMasterType.Columns.Add(new DataColumn("ExecFrequencyCodeId", typeof(int))); tblCommunicationRuleModeMasterType.Columns.Add(new DataColumn("NotificationLimit", typeof(int))); tblCommunicationRuleModeMasterType.Columns.Add(new DataColumn("UserId", typeof(int))); foreach (CommunicationRuleModeMasterModel CommunicationRuleModeMasterMode in objCommunicationRuleMasterModel.CommunicationRuleModeMasterModelList) { DataRow row = tblCommunicationRuleModeMasterType.NewRow(); if (CommunicationRuleModeMasterMode.RuleModeId != null) { row["RuleModeId"] = CommunicationRuleModeMasterMode.RuleModeId; } else { row["RuleModeId"] = 0; } row["RuleId"] = objCommunicationRuleMasterModel.RuleId; if (CommunicationRuleModeMasterMode.UserId != null) { row["UserId"] = CommunicationRuleModeMasterMode.UserId; } if (CommunicationRuleModeMasterMode.ModeCodeId != null && CommunicationRuleModeMasterMode.ModeCodeId != 0) { row["ModeCodeId"] = CommunicationRuleModeMasterMode.ModeCodeId; } else { ModelState.AddModelError("ModeCodeId", InsiderTrading.Common.Common.getResource("cmu_msg_18051")); bReturn = false; } if (CommunicationRuleModeMasterMode.TemplateId != null && CommunicationRuleModeMasterMode.TemplateId != 0) { row["TemplateId"] = CommunicationRuleModeMasterMode.TemplateId; } else { ModelState.AddModelError("TemplateId", InsiderTrading.Common.Common.getResource("cmu_msg_18052")); bReturn = false; } if (CommunicationRuleModeMasterMode.WaitDaysAfterTriggerEvent != null) { row["WaitDaysAfterTriggerEvent"] = CommunicationRuleModeMasterMode.WaitDaysAfterTriggerEvent; } else { ModelState.AddModelError("WaitDaysAfterTriggerEvent", InsiderTrading.Common.Common.getResource("cmu_msg_18053")); bReturn = false; } if (CommunicationRuleModeMasterMode.ExecFrequencyCodeId != null && CommunicationRuleModeMasterMode.ExecFrequencyCodeId != 0) { row["ExecFrequencyCodeId"] = CommunicationRuleModeMasterMode.ExecFrequencyCodeId; } else { ModelState.AddModelError("ExecFrequencyCodeId", InsiderTrading.Common.Common.getResource("cmu_msg_18054")); bReturn = false; } if (CommunicationRuleModeMasterMode.NotificationLimit != null) { row["NotificationLimit"] = CommunicationRuleModeMasterMode.NotificationLimit; } else { ModelState.AddModelError("NotificationLimit", InsiderTrading.Common.Common.getResource("cmu_msg_18055")); bReturn = false; } if (!bReturn) { break; } tblCommunicationRuleModeMasterType.Rows.Add(row); } //check policy document windows status and by default set windows status to incomplete if (objCommunicationRuleMasterModel.RuleStatus != null) { switch (objCommunicationRuleMasterModel.RuleStatus) { case InsiderTrading.Models.CommunicationRuleMasterModel.RuleStatusCode.Inactive: objCommunicationRuleMasterDTO.RuleStatusCodeId = ConstEnum.Code.CommunicationRuleStatusInactive; break; case InsiderTrading.Models.CommunicationRuleMasterModel.RuleStatusCode.Active: objCommunicationRuleMasterDTO.RuleStatusCodeId = ConstEnum.Code.CommunicationRuleStatusActive; break; default: objCommunicationRuleMasterDTO.RuleStatusCodeId = ConstEnum.Code.CommunicationRuleStatusInactive; break; } } else { objCommunicationRuleMasterDTO.RuleStatusCodeId = ConstEnum.Code.CommunicationRuleStatusInactive; } #endregion if (!bReturn && !ModelState.IsValid) { #region Show error List <PopulateComboDTO> lstList = new List <PopulateComboDTO>(); lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.CommunicationRuleCategory).ToString(), null, null, null, null, true); ViewBag.RuleCategoryCodeList = lstList; lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.Events).ToString(), null, null, null, null, false); ViewBag.TriggerEventCodeList = lstList; lstList = FillComboValues(ConstEnum.ComboType.ListofEventsWithUserTypeForCommunicatioTriggerEvent, null, null, null, null, null, false); ViewBag.TriggerEventCodeWithUserTypeList = lstList; objCommunicationRuleMasterModel.AssignedTriggerEventCodeId = new List <PopulateComboDTO>(); objCommunicationRuleMasterModel.AssignedOffsetEventCodeId = new List <PopulateComboDTO>(); lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.Events).ToString(), null, null, null, null, false); ViewBag.OffsetEventCodeList = lstList; //lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.CommunicationRuleStatus).ToString(), null, null, null, null, false); //ViewBag.RuleStatusCodeId = lstList; lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.CommunicationModes).ToString(), Convert.ToInt32(ConstEnum.Code.CommunicationCategory).ToString(), null, null, null, true); ViewBag.CommunicationModes = lstList; //JsonConvert.SerializeObject(lstList);//Json(new(key=lstList[key], JsonRequestBehavior.AllowGet); lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.CommunicationExecutionFrequency).ToString(), null, null, null, null, true); ViewBag.CommunicationExecutionFrequency = lstList;//JsonConvert.SerializeObject(lstList);//Json(new(key=lstList[key], JsonRequestBehavior.AllowGet); lstList = FillComboValues(ConstEnum.ComboType.TemplateList, null, null, null, null, null, true); ViewBag.TemplateList = lstList;//JsonConvert.SerializeObject(lstList);//Json(new(key=lstList[key], JsonRequestBehavior.AllowGet); if (objCommunicationRuleMasterModel.TriggerEventCodeId != null && objCommunicationRuleMasterModel.TriggerEventCodeId != "") { List <int> TagIds1 = objCommunicationRuleMasterModel.TriggerEventCodeId.Split(',').Select(int.Parse).ToList(); foreach (var a in TagIds1) { PopulateComboDTO obj = new PopulateComboDTO(); obj.Key = a.ToString(); obj.Value = ""; objCommunicationRuleMasterModel.AssignedTriggerEventCodeId.Add(obj); } } if (objCommunicationRuleMasterModel.OffsetEventCodeId != null && objCommunicationRuleMasterModel.OffsetEventCodeId != "") { List <int> TagIds1 = objCommunicationRuleMasterModel.OffsetEventCodeId.Split(',').Select(int.Parse).ToList(); foreach (var a in TagIds1) { PopulateComboDTO obj = new PopulateComboDTO(); obj.Key = a.ToString(); obj.Value = ""; objCommunicationRuleMasterModel.AssignedOffsetEventCodeId.Add(obj); } } FillGrid(ConstEnum.GridType.CommunicationRuleModesMasterList, Convert.ToString(objLoginUserDetails.LoggedInUserID), Convert.ToString(objCommunicationRuleMasterModel.RuleId), null, null, null); ViewBag.showApplicabilityButton = false; ViewBag.allowChangeStatus = false; ViewBag.isAllEdit = false; ViewBag.RuleId = objCommunicationRuleMasterModel.RuleId; ViewBag.UserId = objLoginUserDetails.LoggedInUserID; ViewBag.CommunicationMode_id = (objCommunicationRuleMasterModel.RuleCategoryCodeId == null ? 0 : objCommunicationRuleMasterModel.RuleCategoryCodeId); if ((objCommunicationRuleMasterModel.IsApplicabilityDefined != null && objCommunicationRuleMasterModel.IsApplicabilityDefined == true) || objCommunicationRuleMasterModel.RuleStatusCodeId == Convert.ToInt32(InsiderTrading.Models.CommunicationRuleMasterModel.RuleStatusCode.Active)) { ViewBag.allowChangeStatus = true; } if (InsiderTrading.Common.Common.CanPerform(InsiderTrading.Common.ConstEnum.UserActions.COMMUNICATION_RULES_ADD_RIGHT) || InsiderTrading.Common.Common.CanPerform(InsiderTrading.Common.ConstEnum.UserActions.COMMUNICATION_RULES_EDIT_RIGHT)) { ViewBag.isAllEdit = true; if (objCommunicationRuleMasterModel.RuleId != 0) { ViewBag.showApplicabilityButton = true; } } //return View("Create", objCommunicationRuleMasterModel); return(Json(new { status = false, error = ModelState.ToSerializedDictionary() })); #endregion } using (var objCommunicationRuleMasterSL = new CommunicationRuleMasterSL()) { objCommunicationRuleMasterDTO = objCommunicationRuleMasterSL.SaveDetails(objCommunicationRuleMasterDTO, tblCommunicationRuleModeMasterType, objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); } string SuccessMessage = Common.Common.getResource("cmu_msg_18020"); bool bIsApplicabilityDefined = ((objCommunicationRuleMasterModel.IsApplicabilityDefined != null && objCommunicationRuleMasterModel.IsApplicabilityDefined == true) ? true : false); if (bIsApplicabilityDefined && (objLoginUserDetails.UserTypeCodeId == ConstEnum.Code.Admin || objLoginUserDetails.UserTypeCodeId == ConstEnum.Code.COUserType)) { SuccessMessage = ((objCommunicationRuleMasterDTO.RuleStatusCodeId == Convert.ToInt32(InsiderTrading.Models.CommunicationRuleMasterModel.RuleStatusCode.Active) ? Common.Common.getResource("cmu_msg_18065") : Common.Common.getResource("cmu_msg_18066"))); } return(Json(new { status = true, msg = SuccessMessage, IsApplicabilityDefined = bIsApplicabilityDefined, RuleId = objCommunicationRuleMasterDTO.RuleId })); //return RedirectToAction("Create", "CommunicationRuleMaster", new { acid = ConstEnum.UserActions.COMMUNICATION_RULES_EDIT_RIGHT, RuleId = objCommunicationRuleMasterDTO.RuleId}).Success(Common.Common.getResource("cmu_msg_18020")); } catch (Exception exp) { List <PopulateComboDTO> lstList = new List <PopulateComboDTO>(); ModelState.Remove("KEY"); ModelState.Add("KEY", new ModelState()); ModelState.Clear(); string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString()); ModelState.AddModelError("Error", sErrMessage); lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.CommunicationRuleCategory).ToString(), null, null, null, null, true); ViewBag.RuleCategoryCodeList = lstList; lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.Events).ToString(), null, null, null, null, false); ViewBag.TriggerEventCodeList = lstList; lstList = FillComboValues(ConstEnum.ComboType.ListofEventsWithUserTypeForCommunicatioTriggerEvent, null, null, null, null, null, false); ViewBag.TriggerEventCodeWithUserTypeList = lstList; objCommunicationRuleMasterModel.AssignedTriggerEventCodeId = new List <PopulateComboDTO>(); objCommunicationRuleMasterModel.AssignedOffsetEventCodeId = new List <PopulateComboDTO>(); lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.Events).ToString(), null, null, null, null, false); ViewBag.OffsetEventCodeList = lstList; //lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.CommunicationRuleStatus).ToString(), null, null, null, null, false); //ViewBag.RuleStatusCodeId = lstList; lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.CommunicationModes).ToString(), Convert.ToInt32(ConstEnum.Code.CommunicationCategory).ToString(), null, null, null, true); ViewBag.CommunicationModes = lstList; //JsonConvert.SerializeObject(lstList);//Json(new(key=lstList[key], JsonRequestBehavior.AllowGet); lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.CommunicationExecutionFrequency).ToString(), null, null, null, null, true); ViewBag.CommunicationExecutionFrequency = lstList;//JsonConvert.SerializeObject(lstList);//Json(new(key=lstList[key], JsonRequestBehavior.AllowGet); lstList = FillComboValues(ConstEnum.ComboType.TemplateList, null, null, null, null, null, true); ViewBag.TemplateList = lstList;//JsonConvert.SerializeObject(lstList);//Json(new(key=lstList[key], JsonRequestBehavior.AllowGet); lstList = null; if (objCommunicationRuleMasterModel.TriggerEventCodeId != null && objCommunicationRuleMasterModel.TriggerEventCodeId != "") { List <int> TagIds1 = objCommunicationRuleMasterModel.TriggerEventCodeId.Split(',').Select(int.Parse).ToList(); foreach (var a in TagIds1) { PopulateComboDTO obj = new PopulateComboDTO(); obj.Key = a.ToString(); obj.Value = ""; objCommunicationRuleMasterModel.AssignedTriggerEventCodeId.Add(obj); } } if (objCommunicationRuleMasterModel.OffsetEventCodeId != null && objCommunicationRuleMasterModel.OffsetEventCodeId != "") { List <int> TagIds1 = objCommunicationRuleMasterModel.OffsetEventCodeId.Split(',').Select(int.Parse).ToList(); foreach (var a in TagIds1) { PopulateComboDTO obj = new PopulateComboDTO(); obj.Key = a.ToString(); obj.Value = ""; objCommunicationRuleMasterModel.AssignedOffsetEventCodeId.Add(obj); } } FillGrid(ConstEnum.GridType.CommunicationRuleModesMasterList, Convert.ToString(objLoginUserDetails.LoggedInUserID), Convert.ToString(objCommunicationRuleMasterModel.RuleId), null, null, null); ViewBag.showApplicabilityButton = false; ViewBag.UserAction = 119; ViewBag.RuleId = objCommunicationRuleMasterModel.RuleId; ViewBag.UserId = objLoginUserDetails.LoggedInUserID; ViewBag.CommunicationMode_id = (objCommunicationRuleMasterModel.RuleCategoryCodeId == null ? 0 : objCommunicationRuleMasterModel.RuleCategoryCodeId); if ((objCommunicationRuleMasterModel.IsApplicabilityDefined != null && objCommunicationRuleMasterModel.IsApplicabilityDefined == true) || objCommunicationRuleMasterModel.RuleStatusCodeId == Convert.ToInt32(InsiderTrading.Models.CommunicationRuleMasterModel.RuleStatusCode.Active)) { ViewBag.allowChangeStatus = true; } if (InsiderTrading.Common.Common.CanPerform(InsiderTrading.Common.ConstEnum.UserActions.COMMUNICATION_RULES_ADD_RIGHT) || InsiderTrading.Common.Common.CanPerform(InsiderTrading.Common.ConstEnum.UserActions.COMMUNICATION_RULES_EDIT_RIGHT)) { ViewBag.isAllEdit = true; if (objCommunicationRuleMasterModel.RuleId != 0) { ViewBag.showApplicabilityButton = true; } } //return View("Create", objCommunicationRuleMasterModel); return(Json(new { status = false, error = ModelState.ToSerializedDictionary() })); } finally { objLoginUserDetails = null; } }