public ActionResult Edit(int Id)
        {
            TravelSession     obj   = (TravelSession)Session["TravelPortalSessionInfo"];
            LedgerMasterModel model = new LedgerMasterModel();

            LedgerMasterModel viewModel = new LedgerMasterModel()
            {
                ProductNameList     = _pro.GetAllProductList(),
                AccGroupNameList    = _pro.GetAllAccountGroupList(),
                AccSubGroupNameList = _pro.GetAllAccountSubGroupName(),
                AccTypeNameList     = _pro.GetAllAccountTypeName(),
                ddlAirLinesList     = _pro.GetAllAirlinesName()
            };



            viewModel = _pro.Detail(Id);



            ViewData["Product Name"]           = new SelectList(_pro.GetProductList(), "ProductId", "ProductName");
            ViewData["Account Group Name"]     = new SelectList(_pro.GetAccountGroupList(), "AccGroupId", "AccGroupName");
            ViewData["Account Sub Group Name"] = new SelectList(_pro.GetAccountSubGroupName(), "AccSubGroupId", "AccSubGroupName");
            ViewData["Account Type Name"]      = new SelectList(_pro.GetAccountTypeName(), "AccTypeId", "AccTypeName");



            ViewData["Type Name"] = new SelectList(_pro.GetAllAirlineNameBasedonAccTypeName(viewModel.MapTable, viewModel.DisplayMember, viewModel.ValueMember), "ValueMember", "DisplayMember");



            return(View(viewModel));
        }
        //for listing
        public IEnumerable <LedgerMasterModel> List()
        {
            int sno = 0;
            List <LedgerMasterModel> model = new List <LedgerMasterModel>();
            var result = ent.GL_Ledgers.Where(x => x.GL_AccTypes.AccTypeName != "Agent");

            foreach (var item in result)
            {
                sno = sno + 1;
                LedgerMasterModel obj = new LedgerMasterModel
                {
                    SNO = sno,
                    // AccTypeName =item.GL_AccTypes.AccTypeName ,
                    // AccTypeId = item.AccTypeId,
                    //  ProductId = item.ProductId,
                    //AccGroupId = item.AccGroupId,
                    // AccSubGroupId = item.AccSubGroupId,
                    // ddlAirLines = item.Id,
                    // AirlineName = item.
                    LedgerId        = (int)item.LedgerId,
                    ProductName     = item.Core_Products.ProductName,
                    AccGroupName    = item.GL_AccGroups.AccGroupName,
                    AccSubGroupName = item.GL_AccSubGroups.AccSubGroupName,
                    AccTypeName     = item.GL_AccTypes.AccTypeName,
                    LedgerName      = item.LedgerName
                };
                model.Add(obj);
            }
            //return model.Where(x => x.AccTypeName != "Agent" ).AsEnumerable();
            return(model.AsEnumerable());
        }
        public ActionResult Detail(int id)
        {
            _model = _pro.Detail(id);

            ViewData["Type Name"] = _pro.GetddlAirlinesDetail(_model.MapTable, _model.DisplayMember, _model.ValueMember);

            return(View(_model));
        }
        ///////////////////////////////////////////////////////////////////


        public LedgerMasterModel FillDdl(LedgerMasterModel model)
        {
            model.ProductNameList     = GetAllProductList();
            model.AccGroupNameList    = GetAllAccountGroupList();
            model.AccSubGroupNameList = GetAllAccountSubGroupName();
            model.AccTypeNameList     = GetAllAccountTypeName();
            model.ddlAirLinesList     = GetAllAirlinesName();
            return(model);
        }
        //to get ddlairlinesdetail
        public string GetddlAirlinesDetail(string MapTable, string DisplayMember, string ValueMember)
        {
            var result = ent.Air_GetAccMappedValues(MapTable, DisplayMember, ValueMember).FirstOrDefault();

            LedgerMasterModel model = new LedgerMasterModel();

            model.DisplayMember = result.DisplayMember;

            return(model.DisplayMember);
        }
        //to get airline detail
        public string GetAirlineDetail(int?id)
        {
            TravelPortalEntity.Airlines result = ent.Airlines.Where(x => x.AirlineId == id).FirstOrDefault();

            LedgerMasterModel model = new LedgerMasterModel();

            model.AirlineId   = result.AirlineId;
            model.AirlineName = result.AirlineName;

            return(model.AirlineName);
        }
        //to get agent detail
        public string GetAgentDetail(int?id)
        {
            Agents result = ent.Agents.Where(x => x.AgentId == id).FirstOrDefault();

            LedgerMasterModel model = new LedgerMasterModel();

            model.AgentId   = result.AgentId;
            model.AgentName = result.AgentName;

            return(model.AgentName);
        }
        //to get account group detail
        public string GetAccountGroupDetail(int id)
        {
            GL_AccGroups result = ent.GL_AccGroups.Where(x => x.AccGroupId == id).FirstOrDefault();

            LedgerMasterModel model = new LedgerMasterModel();

            model.AccGroupId   = result.AccGroupId;
            model.AccGroupName = result.AccGroupName;

            return(model.AccGroupName);
        }
        //to get ledger name
        public string GetLedgerDetail(int id)
        {
            GL_Ledgers result = ent.GL_Ledgers.Where(x => x.LedgerId == id).FirstOrDefault();

            LedgerMasterModel model = new LedgerMasterModel();

            model.LedgerId   = (int)result.LedgerId;
            model.LedgerName = result.LedgerName;

            return(model.LedgerName);
        }
Esempio n. 10
0
        //to get product detail
        public string GetProductDetail(int id)
        {
            Core_Products result = ent.Core_Products.Where(x => x.ProductId == id).FirstOrDefault();

            LedgerMasterModel model = new LedgerMasterModel();

            model.ProductId   = result.ProductId;
            model.ProductName = result.ProductName;

            return(model.ProductName);
        }
Esempio n. 11
0
        //to get ledger account type detail
        public string GetLedgerAccountTypesDetail(int?id)
        {
            GL_LedgerAccTypes result = ent.GL_LedgerAccTypes.Where(x => x.LedgerAccTypeId == id).FirstOrDefault();

            LedgerMasterModel model = new LedgerMasterModel();

            model.LedgerAccTypeId   = result.LedgerAccTypeId;
            model.LedgerAccTypeName = result.LedgerAccTypeName;

            return(model.LedgerAccTypeName);
        }
        //public JsonResult GetMapTableList(int id)
        //{
        //    var result = new JsonResult();
        //    var lists = new SelectList(_ser.GetAllAccTypesName(id), "ValueMember", "DisplayMember");
        //    result.Data = lists;
        //    result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
        //    return result;
        //}


        public JsonResult GetMapTableList(int id)
        {
            var result              = new JsonResult();
            var AccMember           = _ser.GetGLAccTypesBasedOnTypeName(id);
            LedgerMasterModel model = new LedgerMasterModel();
            //var test = _ser.GetAllDisplayValueMenberForDropdown(AccMember.MapTable, AccMember.DisplayMember, AccMember.ValueMember);
            var lists = new SelectList(_ser.GetAllDisplayValueMenberForDropdown(AccMember.MapTable, AccMember.DisplayMember, AccMember.ValueMember), "Value", "Text");

            // model.DisplayMemberList = _ser.GetAllDisplayValueMenberForDropdown(AccMember.MapTable, AccMember.DisplayMember, AccMember.ValueMember);
            result.Data = lists;
            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(result);
        }
Esempio n. 13
0
        //for edit
        public void EditLedgerMaster(LedgerMasterModel model)
        {
            GL_Ledgers result = ent.GL_Ledgers.Where(x => x.LedgerId == model.LedgerId).FirstOrDefault();

            result.LedgerId      = model.LedgerId;
            result.ProductId     = model.ProductId;
            result.AccGroupId    = model.AccGroupId;
            result.AccSubGroupId = model.AccSubGroupId;
            result.AccTypeId     = model.AccTypeId;
            result.Id            = model.ddlAirLines;
            result.LedgerName    = model.LedgerName;

            ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
            ent.SaveChanges();
        }
Esempio n. 14
0
        //to get account type detail
        public int GetAccountTypeDetail(int id)
        {
            GL_AccTypes result = ent.GL_AccTypes.Where(x => x.AccTypeId == id).FirstOrDefault();

            LedgerMasterModel model = new LedgerMasterModel();

            model.AccTypeId   = result.AccTypeId;
            model.AccTypeName = result.AccTypeName;

            model.MapTable      = result.MapTable;
            model.DisplayMember = result.DisplayMember;
            model.ValueMember   = result.ValueMember;

            return(model.AccTypeId);
        }
Esempio n. 15
0
        //for adding into GL_Ledgers Table
        public void LedgerAdd(LedgerMasterModel modelToSave)
        {
            GL_Ledgers datamodel = new GL_Ledgers
            {
                ProductId     = modelToSave.ProductId,
                AccGroupId    = modelToSave.AccGroupId,
                AccSubGroupId = modelToSave.AccSubGroupId,
                AccTypeId     = modelToSave.AccTypeId,
                Id            = modelToSave.ddlAirLines,
                LedgerName    = modelToSave.LedgerName,
                CreatedDate   = DateTime.Now,
            };

            ent.AddToGL_Ledgers(datamodel);
            ent.SaveChanges();
        }
Esempio n. 16
0
        //public List<LedgerMasterModel> GetAllAccTypesName(int id)
        //{

        //    TravelPortalEntity.EntityModel ent = new TravelPortalEntity.EntityModel();
        //    var cc = (from aa in ent.GL_AccTypes

        //              select new LedgerMasterModel
        //              {


        //              }).ToList();
        //    return cc;

        //}


        /*-----------------------------------------------------------------------------------------------------------------------------------------*/

        /// <summary>
        /// /
        /// </summary>
        /// <param name="MapTable"></param>
        /// <param name="DisplayMember"></param>
        /// <param name="ValueMember"></param>
        /// <returns></returns>
        public List <LedgerMasterModel> GetAllAirlineNameBasedonAccTypeName(string MapTable, string DisplayMember, string ValueMember)
        {
            TravelPortalEntity.EntityModel ent = new TravelPortalEntity.EntityModel();
            var result = ent.Air_GetAccMappedValues(MapTable, DisplayMember, ValueMember);
            List <LedgerMasterModel> Search = new List <LedgerMasterModel>();

            foreach (var item in result)
            {
                LedgerMasterModel obj = new LedgerMasterModel
                {
                    ValueMember   = item.ValueMember.ToString(),
                    DisplayMember = item.DisplayMember,
                };
                Search.Add(obj);
            }
            return(Search.ToList());
        }
        public ActionResult Create(LedgerMasterModel model)
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            if (!ModelState.IsValid)
            {
                LedgerMasterModel viewModel = new LedgerMasterModel()
                {
                    ProductNameList     = _pro.GetAllProductList(),
                    AccGroupNameList    = _pro.GetAllAccountGroupList(),
                    AccSubGroupNameList = _pro.GetAllAccountSubGroupName(),
                    AccTypeNameList     = _pro.GetAllAccountTypeName(),
                    ddlAirLinesList     = _pro.GetAllAirlinesName()
                };
                return(View(viewModel));
            }
            else
            {
                //if((string.IsNullOrEmpty(model.ddlAirLines.ToString())==true)
                //    model.ddlAirLines=null;

                bool checkLedgerName = _pro.CheckDuplicateLedgerName(model.ddlAirLines, model.LedgerName);
                if (checkLedgerName == false)
                {
                    _pro.LedgerAdd(model);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    TempData["success"] = "Ledger Name already exists!";

                    LedgerMasterModel viewModel1 = new LedgerMasterModel()
                    {
                        ProductNameList     = _pro.GetAllProductList(),
                        AccGroupNameList    = _pro.GetAllAccountGroupList(),
                        AccSubGroupNameList = _pro.GetAllAccountSubGroupName(),
                        AccTypeNameList     = _pro.GetAllAccountTypeName(),
                        ddlAirLinesList     = _pro.GetAllAirlinesName()
                    };
                    return(View(viewModel1));
                }


                // ser.LedgerAdd(model);
            }
        }
        public ActionResult Edit(int id, LedgerMasterModel model)
        {
            // model = ser.GetLedgerMasterDetail(id);
            model.LedgerId = id;

            bool checkDuplicateLedgerName = _pro.CheckDuplicateLedgerNameforEdit(id, model.ddlAirLines, model.LedgerName);

            if (checkDuplicateLedgerName == false)
            {
                _pro.EditLedgerMaster(model);
                return(RedirectToAction("Index"));
            }
            else
            {
                TempData["success"] = "Ledger Name already exists!";

                try
                {
                    LedgerMasterModel viewModel = new LedgerMasterModel()
                    {
                        ProductNameList     = _pro.GetAllProductList(),
                        AccGroupNameList    = _pro.GetAllAccountGroupList(),
                        AccSubGroupNameList = _pro.GetAllAccountSubGroupName(),
                        AccTypeNameList     = _pro.GetAllAccountTypeName(),
                        ddlAirLinesList     = _pro.GetAllAirlinesName()
                    };

                    viewModel = _pro.Detail(id);



                    ViewData["Product Name"]           = new SelectList(_pro.GetProductList(), "ProductId", "ProductName");
                    ViewData["Account Group Name"]     = new SelectList(_pro.GetAccountGroupList(), "AccGroupId", "AccGroupName");
                    ViewData["Account Sub Group Name"] = new SelectList(_pro.GetAccountSubGroupName(), "AccSubGroupId", "AccSubGroupName");
                    ViewData["Account Type Name"]      = new SelectList(_pro.GetAccountTypeName(), "AccTypeId", "AccTypeName");

                    ViewData["Type Name"] = new SelectList(_pro.GetAllAirlineNameBasedonAccTypeName(viewModel.MapTable, viewModel.DisplayMember, viewModel.ValueMember), "ValueMember", "DisplayMember");
                }
                catch
                {
                }
                return(View(model));
            }
        }
Esempio n. 19
0
        ////////////////////////////////////////////////for detail/////////////////////////////////////////////
        public LedgerMasterModel Detail(int id)
        {
            GL_Ledgers        result = ent.GL_Ledgers.Where(x => x.LedgerId == id).FirstOrDefault();
            LedgerMasterModel model  = new LedgerMasterModel();

            model.LedgerId        = (int)result.LedgerId;
            model.ProductId       = result.ProductId;
            model.ProductName     = result.Core_Products.ProductName;
            model.AccGroupId      = result.AccGroupId;
            model.AccGroupName    = result.GL_AccGroups.AccGroupName;
            model.AccSubGroupId   = result.AccSubGroupId;
            model.AccSubGroupName = result.GL_AccSubGroups.AccSubGroupName;
            model.AccTypeId       = result.AccTypeId;
            model.AccTypeName     = result.GL_AccTypes.AccTypeName;
            model.ddlAirLines     = result.Id;
            model.LedgerName      = result.LedgerName;
            model.MapTable        = result.GL_AccTypes.MapTable;
            model.ValueMember     = result.GL_AccTypes.ValueMember;
            model.DisplayMember   = result.GL_AccTypes.DisplayMember;


            return(model);
        }
 public ActionResult Create(int?page)
 {
     _model = _pro.FillDdl(_model);
     return(View(_model));
 }