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 });
        }
Example #2
0
        public JsonResult DeleteFromGrid(int CodeID, int acid)
        {
            bool bReturn         = false;
            bool statusFlag      = false;
            var  ErrorDictionary = new Dictionary <string, string>();

            LoginUserDetails objLoginUserDetails = null;

            try
            {
                objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

                using (ComCodeSL objComCodeSL = new ComCodeSL())
                {
                    bReturn    = objComCodeSL.Delete(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID, CodeID);
                    statusFlag = true;
                    ErrorDictionary.Add("success", "Record deleted");
                }
            }
            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;
            }

            return(Json(new
            {
                status = statusFlag,
                Message = ErrorDictionary
            }, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public ActionResult DeleteCode(ComCodeModel objComCodeModel, int acid)//int CodeID, int ParentCodeId, string CodeGroupId, int acid)
        {
            bool bReturn = false;
            //int CodeID = 0;

            LoginUserDetails objLoginUserDetails = null;

            //  ComCodeModel objComCodeModel = null;
            PopulateComboDTO objPopulateComboDTO = null;
            ComCodeDTO       objComCodeDTO       = null;

            List <PopulateComboDTO> lstParentCodeGroup = null;
            List <PopulateComboDTO> lstLabelForParent  = null;
            List <PopulateComboDTO> lstCodeGroup       = null;

            try
            {
                objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);
                string msg = "";

                using (ComCodeSL objComCodeSL = new ComCodeSL())
                {
                    bReturn = objComCodeSL.Delete(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID, Convert.ToInt32(objComCodeModel.CodeID));
                    ArrayList lst = new ArrayList();
                    msg = Common.Common.getResource("mst_msg_10048");
                }

                return(RedirectToAction("Index", "ComCode", new { acid = Common.ConstEnum.UserActions.OTHERMASTER_COMCODE_VIEW, CodeGroupId = objComCodeModel.CodeGroupId, ParentCodeId = objComCodeModel.ParentCodeId }).Success(msg));
            }
            catch (Exception exp)
            {
                string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());

                ModelState.AddModelError("Error", sErrMessage);
                string ParentLabel = "";

                objComCodeDTO = new ComCodeDTO();
                // objComCodeModel = new ComCodeModel();

                objPopulateComboDTO       = new PopulateComboDTO();
                objPopulateComboDTO.Key   = "0";
                objPopulateComboDTO.Value = "Select";

                ViewBag.GridType = ConstEnum.GridType.ComCodeList;


                string[] arr = new String[2];

                objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

                //objComCodeDTO.CodeGroupId = CodeGroupId;
                arr = objComCodeModel.CodeGroupId.Split(new string[] { "-" }, StringSplitOptions.None);
                if (arr[1] != "0")
                {
                    // objComCodeModel.ParentCodeId = ParentCodeId;
                    //objComCodeDTO.ParentCodeId = ParentCodeId;
                    ViewBag.ParentCodeId = objComCodeModel.ParentCodeId;

                    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));
                    }

                    ViewBag.ParentCodeName      = lstParentCodeGroup;
                    objComCodeModel.CodeGroupId = arr[0];
                }
                else
                {
                    //objComCodeDTO.CodeGroupId = CodeGroupId;
                    // objComCodeDTO.ParentCodeId = ParentCodeId;
                    ViewBag.ParentCodeName = null;
                }

                ViewBag.ParentLabel = ParentLabel;
                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 = CodeGroupId;
                // objComCodeModel.ParentCodeId = ParentCodeId;
                if (objComCodeModel.ParentCodeId == null || objComCodeModel.ParentCodeId == 0)
                {
                    objComCodeModel.ParentCodeId = 0;
                }
                ViewBag.CodeGroupDropDown = lstCodeGroup;
                ViewBag.UserAction        = acid;
                return(View("Create", objComCodeModel));
            }
            finally
            {
                objLoginUserDetails = null;

                objComCodeModel     = null;
                objPopulateComboDTO = null;
                objComCodeDTO       = null;

                lstParentCodeGroup = null;
                lstLabelForParent  = null;
                lstCodeGroup       = null;
            }
        }
Example #4
0
        public ActionResult Edit(int CodeId, int acid, string CalledFrom)
        {
            LoginUserDetails objLoginUserDetails = null;
            ComCodeModel     objComCodeModel     = null;

            PopulateComboDTO objPopulateComboDTO = null;
            ComCodeDTO       objComCodeDTO       = null;
            ComCodeDTO       objComCodeDTO1      = null;
            string           ParentLabel         = "";

            List <PopulateComboDTO> CodeName           = null;
            List <PopulateComboDTO> lstParentCodeGroup = null;
            List <PopulateComboDTO> lstLabelForParent  = null;
            List <PopulateComboDTO> lstCodeGroup       = null;

            try
            {
                objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

                objComCodeModel     = new ComCodeModel();
                objPopulateComboDTO = new PopulateComboDTO();

                using (ComCodeSL objComCodeSL = new ComCodeSL())
                {
                    objComCodeDTO = objComCodeSL.GetDetails(objLoginUserDetails.CompanyDBConnectionString, CodeId);

                    CodeName = new List <PopulateComboDTO>();

                    CodeName.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList,
                                                                     null, objComCodeDTO.CodeGroupId, null, null, null, sLookUpPrefix));

                    ViewBag.CodeName = CodeName.ElementAt <PopulateComboDTO>(0).Value;

                    if (objComCodeDTO.ParentCodeId != null && objComCodeDTO.ParentCodeId != 0)
                    {
                        objComCodeDTO1     = objComCodeSL.GetDetails(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(objComCodeDTO.ParentCodeId));
                        ViewBag.ParentName = objComCodeDTO1.CodeName;
                        string ParentCodeId = objComCodeDTO.ParentCodeId.ToString().Substring(0, 3);

                        objComCodeDTO.CodeGroupId = objComCodeDTO.CodeGroupId + "-" + ParentCodeId;
                        objPopulateComboDTO.Key   = "0";
                        objPopulateComboDTO.Value = "Select";

                        lstParentCodeGroup = new List <PopulateComboDTO>();
                        lstParentCodeGroup.Add(objPopulateComboDTO);
                        lstParentCodeGroup.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.ListOfCode,
                                                                                   ParentCodeId, null, null, null, null, sLookUpPrefix));

                        ViewBag.ParentCodeName = lstParentCodeGroup;

                        lstLabelForParent = new List <PopulateComboDTO>();
                        lstLabelForParent.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList,
                                                                                  null, ParentCodeId, null, null, null, sLookUpPrefix));

                        ParentLabel = lstLabelForParent.ElementAt <PopulateComboDTO>(0).Value;
                        if (ParentLabel.Contains("Master"))
                        {
                            ParentLabel = ParentLabel.Substring(0, (ParentLabel.Length - 7));
                        }
                    }
                    else
                    {
                        objComCodeDTO.CodeGroupId  = objComCodeDTO.CodeGroupId + "-" + 0;
                        objComCodeDTO.ParentCodeId = 0;
                    }
                }

                objPopulateComboDTO.Key   = "0";
                objPopulateComboDTO.Value = "Select";
                ViewBag.ParentLabel       = ParentLabel;

                lstCodeGroup = new List <PopulateComboDTO>();
                lstCodeGroup.Add(objPopulateComboDTO);
                lstCodeGroup.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList,
                                                                     null, null, null, null, null, sLookUpPrefix));

                ViewBag.CodeGroupDropDown = lstCodeGroup;

                ViewBag.UserAction = acid;

                if (objComCodeDTO != null)
                {
                    Common.Common.CopyObjectPropertyByName(objComCodeDTO, objComCodeModel);

                    ViewBag.ParentId = objComCodeDTO.ParentCodeId;
                    return(View("Create", objComCodeModel));
                }
            }
            finally
            {
                objLoginUserDetails = null;

                objPopulateComboDTO = null;
                objComCodeDTO       = null;
                objComCodeDTO1      = null;

                CodeName           = null;
                lstParentCodeGroup = null;
                lstLabelForParent  = null;
                lstCodeGroup       = null;
            }

            return(View("Create"));
        }
Example #5
0
        public ActionResult Create(ComCodeModel objComCodeModel, int acid, bool backpd = false, int pdid = 0, string view = "", string frm = "")
        {
            string sCodeGroupID  = "";
            string sParentCodeId = "";

            bool backToPolicyDocument = false;

            LoginUserDetails objLoginUserDetails = null;
            ComCodeDTO       objComCodeDTO       = null;
            PopulateComboDTO objPopulateComboDTO = null;

            ArrayList lst = null;
            List <PopulateComboDTO> lstLabelForParent  = null;
            List <PopulateComboDTO> CodeName           = null;
            List <PopulateComboDTO> lstParentCodeGroup = null;

            try
            {
                string[] arr = new String[2];
                sCodeGroupID = objComCodeModel.CodeGroupId;

                objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

                objComCodeDTO = new ComCodeDTO();

                if (objComCodeModel.CodeID == null)
                {
                    objComCodeModel.CodeID = 0;
                }
                arr = objComCodeModel.CodeGroupId.Split(new string[] { "-" }, StringSplitOptions.None);
                objComCodeModel.CodeGroupId = arr[0];
                sParentCodeId = arr[1];

                Common.Common.CopyObjectPropertyByName(objComCodeModel, objComCodeDTO);

                objComCodeDTO.LoggedInUserId = objLoginUserDetails.LoggedInUserID;

                using (ComCodeSL objComCodeSL = new ComCodeSL())
                {
                    objComCodeDTO = objComCodeSL.Save(objLoginUserDetails.CompanyDBConnectionString, objComCodeDTO);
                }

                if (objComCodeModel.ParentCodeId == 0 || objComCodeModel.ParentCodeId == null)
                {
                    objComCodeModel.CodeGroupId = objComCodeModel.CodeGroupId + "-" + 0;
                }
                else
                {
                    string ParentCodeId = objComCodeDTO.ParentCodeId.ToString().Substring(0, 3);
                    objComCodeModel.CodeGroupId = objComCodeModel.CodeGroupId + "-" + ParentCodeId;
                }

                lst = new ArrayList();
                lst.Add(objComCodeModel.CodeName);
                string msg = objComCodeModel.CodeName + " " + Common.Common.getResource("mst_msg_10047");

                //check if back to policy document id flag is set or not to check if oringial requrest came from policy document page to create policy document category
                if (backpd)
                {
                    string view_name       = "";
                    string contorller_name = "PolicyDocuments";
                    RouteValueDictionary controller_paramter = new RouteValueDictionary();

                    if (pdid == 0)
                    {
                        view_name = "Create";

                        controller_paramter.Add("acid", Common.ConstEnum.UserActions.POLICY_DOCUMENT_CREATE);
                    }
                    else if (pdid > 0)
                    {
                        view_name = "Edit";

                        controller_paramter.Add("acid", Common.ConstEnum.UserActions.POLICY_DOCUMENT_EDIT);
                        controller_paramter.Add("pdid", pdid);
                        controller_paramter.Add("view", view);
                    }
                    else
                    {
                        view_name = "index";

                        controller_paramter.Add("acid", Common.ConstEnum.UserActions.RULES_POLICY_DOCUMENT_LIST);
                    }

                    msg = "Policy Document Category " + objComCodeModel.CodeName + " Created Sucessfully";

                    if (frm != "" && frm == "pdcategory")
                    {
                        return(Json(new
                        {
                            status = true,
                            Message = msg,
                            CodeGroupId = objComCodeDTO.CodeGroupId,
                            CodeID = objComCodeDTO.CodeID,
                            DisplayCode = ((objComCodeDTO.DisplayCode != null && objComCodeDTO.DisplayCode != "") ? objComCodeDTO.DisplayCode : objComCodeDTO.CodeName),
                            IsActive = objComCodeDTO.IsActive,
                            IsVisible = objComCodeDTO.IsVisible,
                            ParentCodeId = objComCodeDTO.ParentCodeId
                        }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(RedirectToAction(view_name, contorller_name, controller_paramter).Success(msg));
                    }
                }
                if (frm != "" && frm == "pdcategory")
                {
                    return(Json(new
                    {
                        status = true,
                        Message = Common.Common.getResource("tra_msg_16153"),
                        CodeGroupId = objComCodeModel.CodeGroupId,
                        ParentCodeId = objComCodeModel.ParentCodeId
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(RedirectToAction("Index", "ComCode", new { acid = Common.ConstEnum.UserActions.OTHERMASTER_COMCODE_VIEW, CodeGroupId = objComCodeModel.CodeGroupId, ParentCodeId = objComCodeModel.ParentCodeId }).Success(msg));
                }
            }
            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);
                string ParentLabel = "";

                if (frm != "" && frm == "pdcategory")
                {
                    return(Json(new
                    {
                        status = false,
                        error = ModelState.ToSerializedDictionary(),
                        Message = sErrMessage
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

                    objPopulateComboDTO       = new PopulateComboDTO();
                    objPopulateComboDTO.Key   = "0";
                    objPopulateComboDTO.Value = "Select";
                    if (objComCodeModel.ParentCodeId != null && objComCodeModel.ParentCodeId != 0)
                    {
                        ViewBag.ParentCodeId      = objComCodeModel.ParentCodeId;
                        objPopulateComboDTO.Key   = "0";
                        objPopulateComboDTO.Value = "Select";

                        lstParentCodeGroup = new List <PopulateComboDTO>();
                        lstParentCodeGroup.Add(objPopulateComboDTO);
                        lstParentCodeGroup.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.ListOfCode,
                                                                                   sParentCodeId, null, null, null, null, sLookUpPrefix));

                        lstLabelForParent = new List <PopulateComboDTO>();
                        lstLabelForParent.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList,
                                                                                  null, sParentCodeId, null, null, null, sLookUpPrefix));

                        ParentLabel = lstLabelForParent.ElementAt <PopulateComboDTO>(0).Value;
                        if (ParentLabel.Contains("Master"))
                        {
                            ParentLabel = ParentLabel.Substring(0, (ParentLabel.Length - 7));
                        }

                        ViewBag.ParentCodeName = lstParentCodeGroup;

                        using (ComCodeSL objComCodeSL = new ComCodeSL())
                        {
                            objComCodeDTO = objComCodeSL.GetDetails(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(objComCodeModel.ParentCodeId));

                            ViewBag.ParentName = objComCodeDTO.CodeName;
                        }
                    }
                    else
                    {
                        ViewBag.ParentCodeName = null;
                    }

                    CodeName = new List <PopulateComboDTO>();
                    CodeName.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList,
                                                                     null, Convert.ToString(objComCodeModel.CodeGroupId), null, null, null, sLookUpPrefix));
                    ViewBag.CodeName = CodeName.ElementAt <PopulateComboDTO>(0).Value;


                    objComCodeModel.CodeGroupId = sCodeGroupID;
                    ViewBag.ParentLabel         = ParentLabel;


                    if (objComCodeModel.ParentCodeId == null || objComCodeModel.ParentCodeId == 0)
                    {
                        objComCodeModel.ParentCodeId = 0;
                    }

                    //check if back to policy document id flag is set or not to check if oringial requrest came from policy document page to create policy document category
                    if (backpd)
                    {
                        backToPolicyDocument        = true;
                        ViewBag.PolicyDocument_id   = pdid;
                        ViewBag.PolicyDocument_view = view;
                    }

                    ViewBag.backToPolicyDocument = backToPolicyDocument;
                    ViewBag.UserAction           = acid;
                    return(View("Create", objComCodeModel));
                }
            }
            finally
            {
                objLoginUserDetails = null;
                objPopulateComboDTO = null;
                objComCodeDTO       = null;

                lst = null;
                lstLabelForParent  = null;
                CodeName           = null;
                lstParentCodeGroup = null;
            }
        }
Example #6
0
        public ActionResult Create(string CodeGroupId, int ParentCodeId, int acid, string frm = "", int pdid = 0, string view = "")
        {
            ComCodeModel     objComCodeModel     = null;
            PopulateComboDTO objPopulateComboDTO = null;
            ComCodeDTO       objComCodeDTO       = null;

            LoginUserDetails objLoginUserDetails = null;

            List <PopulateComboDTO> lstParentCodeGroup = null;
            List <PopulateComboDTO> lstLabelForParent  = null;
            List <PopulateComboDTO> CodeName           = null;
            List <PopulateComboDTO> lstCodeGroup       = null;

            try
            {
                bool backToPolicyDocument = false;

                string ParentLabel = "";
                objComCodeModel     = new ComCodeModel();
                objPopulateComboDTO = new PopulateComboDTO();

                objPopulateComboDTO.Key   = "0";
                objPopulateComboDTO.Value = "Select";

                ViewBag.GridType = ConstEnum.GridType.ComCodeList;

                objComCodeDTO = new ComCodeDTO();

                string[] arr = new String[2];
                objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

                objComCodeDTO.CodeGroupId = CodeGroupId;
                arr = CodeGroupId.Split(new string[] { "-" }, StringSplitOptions.None);

                if (arr[1] != "0")
                {
                    objComCodeModel.ParentCodeId = ParentCodeId;
                    objComCodeDTO.ParentCodeId   = ParentCodeId;
                    ViewBag.ParentCodeId         = ParentCodeId;

                    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));
                    }

                    ViewBag.ParentCodeName = lstParentCodeGroup;

                    using (ComCodeSL objComCodeSL = new ComCodeSL())
                    {
                        objComCodeDTO      = objComCodeSL.GetDetails(objLoginUserDetails.CompanyDBConnectionString, ParentCodeId);
                        ViewBag.ParentName = objComCodeDTO.CodeName;
                    }
                }
                else
                {
                    objComCodeDTO.CodeGroupId  = CodeGroupId;
                    objComCodeDTO.ParentCodeId = ParentCodeId;
                    ViewBag.ParentCodeName     = null;
                }

                CodeName = new List <PopulateComboDTO>();
                CodeName.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList,
                                                                 null, arr[0], null, null, null, sLookUpPrefix));
                ViewBag.CodeName = CodeName.ElementAt <PopulateComboDTO>(0).Value;


                ViewBag.ParentLabel = ParentLabel;
                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  = CodeGroupId;
                objComCodeModel.ParentCodeId = ParentCodeId;
                if (objComCodeModel.ParentCodeId == null || objComCodeModel.ParentCodeId == 0)
                {
                    objComCodeModel.ParentCodeId = 0;
                }
                ViewBag.CodeGroupDropDown = lstCodeGroup;

                //check "frm" variable is set or not to check if oringial requrest came from policy document page to create policy document category
                if (frm != "" && frm == "pdcategory")
                {
                    backToPolicyDocument        = true;
                    ViewBag.PolicyDocument_id   = pdid;
                    ViewBag.PolicyDocument_view = view;
                }
                ViewBag.frm = frm;
                ViewBag.backToPolicyDocument = backToPolicyDocument;

                ViewBag.UserAction = acid;

                if (frm != "" && frm == "pdcategory")
                {
                    return(PartialView("Create", objComCodeModel));
                }
                else
                {
                    return(View("Create", objComCodeModel));
                }
            }
            finally
            {
                objPopulateComboDTO = null;
                objComCodeDTO       = null;

                objLoginUserDetails = null;

                lstParentCodeGroup = null;
                lstLabelForParent  = null;
                CodeName           = null;
                lstCodeGroup       = null;
            }
        }
        public ActionResult Index(int FinancialYearId, int acid)
        {
            LoginUserDetails        objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
            List <PopulateComboDTO> lstList             = new List <PopulateComboDTO>();
            ComCodeSL  objComCodeModel    = new ComCodeSL();
            ComCodeDTO objComCodeDTO      = new ComCodeDTO();
            DateTime   objCurrentDateTime = Common.Common.GetCurrentDate(objLoginUserDetails.CompanyDBConnectionString);

            try
            {
                string sFinancialYear;
                objCurrentDateTime    = Common.Common.GetCurrentDate(objLoginUserDetails.CompanyDBConnectionString);
                lstList               = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.FinancialYear).ToString(), null, null, null, null, true);
                ViewBag.FinancialYear = lstList;
                //for showing default current financial year on Trading Window Financial year page.
                sFinancialYear = Convert.ToString(objCurrentDateTime.Year);
                sFinancialYear = sFinancialYear + "-" + (Convert.ToInt32(sFinancialYear.Substring(2, 2)) + 1);
                if (FinancialYearId == 0)
                {
                    foreach (var element in lstList)
                    {
                        if (element.Value == sFinancialYear)
                        {
                            ViewBag.FinancialYearId = element.Key;
                            FinancialYearId         = Convert.ToInt32(element.Key);
                            break;
                        }
                    }
                }
                else
                {
                    ViewBag.FinancialYearId = FinancialYearId;
                }
                objComCodeDTO = objComCodeModel.GetDetails(objLoginUserDetails.CompanyDBConnectionString, FinancialYearId);
                ViewBag.FinancialPeriodTypeId = (objComCodeDTO.ParentCodeId == null ? 0 : Convert.ToInt32(objComCodeDTO.ParentCodeId));
                lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.FinancialPeriodType).ToString(), null, null, null, null, true);
                ViewBag.FinancialPeriodType = lstList;
                ViewBag.acid = acid;
                FillGrid(ConstEnum.GridType.TradingWindowEventListForFinancialPeriod, Convert.ToString(FinancialYearId), null, null);
                if (objLoginUserDetails.BackURL != null && objLoginUserDetails.BackURL != "")
                {
                    ViewBag.BackButton          = true;
                    ViewBag.BackURL             = objLoginUserDetails.BackURL;
                    objLoginUserDetails.BackURL = "";
                    Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);
                }
                else
                {
                    ViewBag.BackButton = false;
                }
                return(View("View"));
            }
            catch (Exception exp)
            {
                string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());
                ModelState.AddModelError("Error", sErrMessage);
                return(View("View"));
            }
            finally
            {
                objLoginUserDetails = null;
                lstList             = null;
                objComCodeModel     = null;
                objComCodeDTO       = null;
            }
        }
Example #8
0
        public ActionResult Index(int RoleId, string CalledFrom, int acid, int uid = 0)
        {
            LoginUserDetails objLoginUserDetails = null;
            Dictionary <string, Dictionary <string, List <InsiderTradingDAL.RoleActivityDTO> > > objRoleActivityDictionary = null;

            RoleActivityModel objRoleActivityModel = null;
            RoleMasterDTO     objRoleMasterDTO     = null;
            ComCodeDTO        objComCodeDTO        = null;

            PopulateComboDTO        objPopulateComboDTO = null;
            List <PopulateComboDTO> lstRoleList         = null;

            try
            {
                objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

                //GenericSLImpl<InsiderTradingDAL.UserInfoDTO> objGenericSLImpl = new GenericSLImpl<InsiderTradingDAL.UserInfoDTO>();


                objRoleActivityModel = new RoleActivityModel();

                if (RoleId != 0)
                {
                    using (RoleActivitySL objRoleActivitySL = new RoleActivitySL())
                    {
                        objRoleActivityDictionary = objRoleActivitySL.GetRoleActivityDetails(objLoginUserDetails.CompanyDBConnectionString, RoleId);
                    }

                    using (RoleMasterSL objRoleMasterSL = new RoleMasterSL())
                    {
                        objRoleMasterDTO = objRoleMasterSL.GetRoleMasterDetails(objLoginUserDetails.CompanyDBConnectionString, RoleId);
                    }

                    using (ComCodeSL objComCodeSL = new ComCodeSL())
                    {
                        objComCodeDTO = objComCodeSL.GetDetails(objLoginUserDetails.CompanyDBConnectionString, objRoleMasterDTO.UserTypeCodeId);
                    }

                    ViewBag.RoleName = objRoleMasterDTO.RoleName;
                    ViewBag.UserType = objComCodeDTO.CodeName;
                }
                else
                {
                    ViewBag.RoleName = "";
                    ViewBag.UserType = "";
                }
                ViewBag.CalledFrom = CalledFrom;

                ViewBag.RoleId      = RoleId;
                ViewBag.ColumnCount = 3;
                if (CalledFrom == "RoleMaster")
                {
                    ViewBag.RoleActivityDictionary = objRoleActivityDictionary;
                }
                else if (CalledFrom == "RoleActivity")
                {
                    if (RoleId != 0)
                    {
                        ViewBag.RoleActivityDictionary = objRoleActivityDictionary;
                    }

                    objPopulateComboDTO       = new PopulateComboDTO();
                    objPopulateComboDTO.Key   = "0";
                    objPopulateComboDTO.Value = "Select";

                    lstRoleList = new List <PopulateComboDTO>();

                    lstRoleList.Add(objPopulateComboDTO);
                    lstRoleList.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.RoleList,
                                                                        null, null, null, null, null, "usr_msg_").ToList <PopulateComboDTO>());
                    ViewBag.RoleList = lstRoleList; // new SelectList(lstRoleList, "Key", "Value");
                }
                else
                {
                    ViewBag.RoleActivityDictionary = objRoleActivityDictionary;
                }

                ViewBag.user_id = uid;

                ViewBag.user_action = acid;

                if (CalledFrom != "" && CalledFrom != "RoleMaster" && CalledFrom != "RoleActivity")
                {
                    return(PartialView("Create", objRoleActivityModel));
                }
                else
                {
                    return(View("Create", objRoleActivityModel));
                }
            }
            finally
            {
                objLoginUserDetails       = null;
                objRoleActivityDictionary = null;
                objRoleMasterDTO          = null;
                objComCodeDTO             = null;

                objPopulateComboDTO = null;
                lstRoleList         = null;
            }
        }
Example #9
0
        public ActionResult Create(int[] chkActivity, int RoleId, string CalledFrom, int acid = 0, int uid = 0)
        {
            bool returnValue = false;

            LoginUserDetails        objLoginUserDetails  = null;
            RoleMasterDTO           objRoleMasterDTO     = null;
            DataTable               tblRoleActivity      = null;
            RoleActivityModel       objRoleActivityModel = null;
            ComCodeDTO              objComCodeDTO        = null;
            PopulateComboDTO        objPopulateComboDTO  = null;
            List <PopulateComboDTO> lstRoleList          = null;

            try
            {
                tblRoleActivity = new DataTable("RoleActivityType");

                if (Request.Params["authorization"] != null && Request.Params["authorization"] != "")
                {
                    acid = Convert.ToInt32(Request.Params["authorization"].Split(':')[1]);
                }

                tblRoleActivity.Columns.Add(new DataColumn("RoleId", typeof(int)));
                tblRoleActivity.Columns.Add(new DataColumn("ActivityId", typeof(int)));

                objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

                if (chkActivity != null)
                {
                    DataRow row = null;
                    foreach (int ActivityId in chkActivity)
                    {
                        row               = tblRoleActivity.NewRow();
                        row["RoleId"]     = RoleId;
                        row["ActivityId"] = ActivityId;
                        tblRoleActivity.Rows.Add(row);
                    }
                    row = null;
                }
                else
                {
                    // When all activity Ids is deleted then the param @inp_tblRoleActivityType have the ActivityId = 0
                    DataRow row = tblRoleActivity.NewRow();
                    row["RoleId"]     = RoleId;
                    row["ActivityId"] = 0;
                    tblRoleActivity.Rows.Add(row);
                }

                using (RoleActivitySL objRoleActivitySL = new RoleActivitySL())
                {
                    returnValue = objRoleActivitySL.InsertDeleteRoleActivities(objLoginUserDetails.CompanyDBConnectionString, tblRoleActivity, objLoginUserDetails.LoggedInUserID);
                }

                using (RoleMasterSL objRoleMasterSL = new RoleMasterSL())
                {
                    objRoleMasterDTO = objRoleMasterSL.GetRoleMasterDetails(objLoginUserDetails.CompanyDBConnectionString, RoleId);
                }

                string successMessage = Common.Common.getResource("usr_msg_12055");

                successMessage = successMessage.Replace("{0}", (objRoleMasterDTO.RoleName.Replace("'", "\'").Replace("\"", "\"")));

                //check "CalledFrom" value and redirect back to show page related page
                if (CalledFrom == "emp" || CalledFrom == "nonemp" || CalledFrom == "corp" || CalledFrom == "cousr")
                {
                    //NOTE - Commented following code because it is not used after redirect call change to JSON response instead of redirect to page
                    #region COMMENTED CODE
                    ////string view_name = "";
                    ////string contorller_name = "";
                    //RouteValueDictionary controller_paramter = new RouteValueDictionary();
                    //string success_msg = Common.Common.getResource("usr_msg_12053");

                    //switch (CalledFrom)
                    //{
                    //    case "emp": //link from employee page
                    //        if (uid == 0)
                    //        {
                    //            //employee create page
                    //            //view_name = "Create";
                    //            //contorller_name = "Employee";
                    //            controller_paramter.Add("acid", InsiderTrading.Common.ConstEnum.UserActions.INSIDER_INSIDERUSER_CREATE);
                    //        }
                    //        else
                    //        {
                    //            //employee edit page
                    //            //view_name = "Create";
                    //            //contorller_name = "Employee";
                    //            controller_paramter.Add("nUserInfoID", uid);
                    //            controller_paramter.Add("acid", InsiderTrading.Common.ConstEnum.UserActions.INSIDER_INSIDERUSER_EDIT);
                    //        }
                    //        break;
                    //    case "nonemp": //link from non employee page
                    //        if (uid == 0)
                    //        {
                    //            //non employee create page
                    //            //view_name = "Create";
                    //            //contorller_name = "NonEmployeeInsider";
                    //            controller_paramter.Add("acid", InsiderTrading.Common.ConstEnum.UserActions.INSIDER_INSIDERUSER_CREATE);
                    //        }
                    //        else
                    //        {
                    //            //non employee edit page
                    //            //view_name = "Create";
                    //            //contorller_name = "NonEmployeeInsider";
                    //            controller_paramter.Add("nUserInfoID", uid);
                    //            controller_paramter.Add("acid", InsiderTrading.Common.ConstEnum.UserActions.INSIDER_INSIDERUSER_EDIT);
                    //        }
                    //        break;
                    //    case "corp": //link from corporate employee page
                    //        if (uid == 0)
                    //        {
                    //            //corporate employee create page
                    //            //view_name = "index";
                    //            //contorller_name = "CorporateUser";
                    //            controller_paramter.Add("acid", InsiderTrading.Common.ConstEnum.UserActions.INSIDER_INSIDERUSER_CREATE);
                    //        }
                    //        else
                    //        {
                    //            //corporate employee edit page
                    //            //view_name = "Edit";
                    //            //contorller_name = "CorporateUser";
                    //            controller_paramter.Add("nUserInfoID", uid);
                    //            controller_paramter.Add("acid", InsiderTrading.Common.ConstEnum.UserActions.INSIDER_INSIDERUSER_EDIT);
                    //        }
                    //        break;
                    //    case "cousr": //link from CO user page
                    //        if (uid == 0)
                    //        {
                    //            //CO user create page
                    //            //view_name = "Create";
                    //            //contorller_name = "UserDetails";
                    //            //controller_paramter.Add("acid", InsiderTrading.Common.ConstEnum.UserActions.CRUSER_COUSER_CREATE);
                    //        }
                    //        else
                    //        {
                    //            //CO user edit page
                    //            //view_name = "Edit";
                    //            //contorller_name = "UserDetails";
                    //            controller_paramter.Add("acid", InsiderTrading.Common.ConstEnum.UserActions.CRUSER_COUSER_EDIT);
                    //            controller_paramter.Add("CalledFrom", "Edit");
                    //            controller_paramter.Add("UserInfoID", uid);

                    //        }
                    //        break;
                    //    default:
                    //        //default return to role master list page
                    //        //view_name = "Index";
                    //        //contorller_name = "RoleMaster";
                    //        controller_paramter.Add("acid", Common.ConstEnum.UserActions.CRUSER_ROLEMASTER_VIEW);
                    //        break;
                    //}
                    #endregion COMMENTED CODE

                    return(Json(new
                    {
                        status = true,
                        Message = Common.Common.getResource("tra_msg_16153"),
                        RoleName = objRoleMasterDTO.RoleName,
                        RoleId = objRoleMasterDTO.RoleId,
                        IsActive = (objRoleMasterDTO.StatusCodeId == ConstEnum.Code.RoleStatusActive ? true : false),
                        CalledFrom = CalledFrom
                    }, JsonRequestBehavior.AllowGet));
                    //return RedirectToAction(view_name, contorller_name, controller_paramter).Success(success_msg);
                }

                //return RedirectToAction("Index", "RoleActivity", new { RoleId = RoleId, CalledFrom = "RoleMaster", acid = InsiderTrading.Common.ConstEnum.UserActions.CRUSER_ROLEMASTER_EDIT }).Success(successMessage);
                return(RedirectToAction("Index", "RoleMaster", new { acid = InsiderTrading.Common.ConstEnum.UserActions.CRUSER_ROLEMASTER_VIEW }).Success(successMessage));
            }
            catch (Exception exp)
            {
                string sErrMessage = "";
                if (exp.InnerException != null && exp.InnerException.Data != null && exp.InnerException.Data.Count > 0)
                {
                    sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());
                }
                else
                {
                    sErrMessage = exp.Message;
                }
                ModelState.AddModelError("Error", sErrMessage);
                if (CalledFrom != "" && (CalledFrom == "emp" || CalledFrom == "nonemp" || CalledFrom == "corp" || CalledFrom == "cousr"))
                {
                    return(Json(new
                    {
                        status = false,
                        error = ModelState.ToSerializedDictionary(),
                        Message = sErrMessage
                    }));
                }
                else
                {
                    objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
                    Dictionary <string, Dictionary <string, List <InsiderTradingDAL.RoleActivityDTO> > > objRoleActivityDictionary = null;
                    //GenericSLImpl<InsiderTradingDAL.UserInfoDTO> objGenericSLImpl = new GenericSLImpl<InsiderTradingDAL.UserInfoDTO>();

                    if (RoleId != 0)
                    {
                        using (RoleActivitySL objRoleActivitySL = new RoleActivitySL())
                        {
                            objRoleActivityDictionary = objRoleActivitySL.GetRoleActivityDetails(objLoginUserDetails.CompanyDBConnectionString, RoleId);
                        }

                        using (RoleMasterSL objRoleMasterSL = new RoleMasterSL())
                        {
                            objRoleMasterDTO = objRoleMasterSL.GetRoleMasterDetails(objLoginUserDetails.CompanyDBConnectionString, RoleId);
                        }

                        using (ComCodeSL objComCodeSL = new ComCodeSL())
                        {
                            objComCodeDTO = objComCodeSL.GetDetails(objLoginUserDetails.CompanyDBConnectionString, objRoleMasterDTO.UserTypeCodeId);
                        }

                        ViewBag.RoleName = objRoleMasterDTO.RoleName;
                        ViewBag.UserType = objComCodeDTO.CodeName;
                    }
                    else
                    {
                        ViewBag.RoleName = "";
                        ViewBag.UserType = "";
                    }
                    ViewBag.CalledFrom = CalledFrom;

                    ViewBag.RoleId      = RoleId;
                    ViewBag.ColumnCount = 3;
                    if (CalledFrom == "RoleMaster")
                    {
                        ViewBag.RoleActivityDictionary = objRoleActivityDictionary;
                    }
                    else if (CalledFrom == "RoleActivity")
                    {
                        if (RoleId != 0)
                        {
                            ViewBag.RoleActivityDictionary = objRoleActivityDictionary;
                        }

                        objPopulateComboDTO       = new PopulateComboDTO();
                        objPopulateComboDTO.Key   = "0";
                        objPopulateComboDTO.Value = "Select";

                        lstRoleList = new List <PopulateComboDTO>();

                        lstRoleList.Add(objPopulateComboDTO);
                        lstRoleList.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.RoleList,
                                                                            null, null, null, null, null, "usr_msg_").ToList <PopulateComboDTO>());
                        ViewBag.RoleList = lstRoleList; // new SelectList(lstRoleList, "Key", "Value");
                    }

                    ViewBag.user_id = uid;

                    ViewBag.user_action = acid;

                    return(View("Create", objRoleActivityModel));
                }
            }
            finally
            {
                objLoginUserDetails = null;
                tblRoleActivity     = null;
                objComCodeDTO       = null;
                objRoleMasterDTO    = null;
                objPopulateComboDTO = null;
                lstRoleList         = null;
            }
        }