Beispiel #1
0
        public ActionResult AddEditPartyRegistration(string IsActionName, string PartyCode)
        {
            PartyModel objModel = new PartyModel();

            objModel.GroupList  = objRegistrationManager.GetGroupList();
            objModel.IsSupplier = false;
            List <SelectListItem> GroupList = new List <SelectListItem>();

            foreach (var obj in objModel.GroupList)
            {
                GroupList.Add(new SelectListItem
                {
                    Text  = obj.GroupName,
                    Value = obj.GroupId.ToString()
                });
            }
            ViewBag.GroupList = GroupList;

            objModel.BankList = objTransactManager.GetBankList();
            List <SelectListItem> BankList = new List <SelectListItem>();

            foreach (var obj in objModel.BankList)
            {
                BankList.Add(new SelectListItem
                {
                    Text  = obj.BankName,
                    Value = obj.BankCode.ToString()
                });
            }
            ViewBag.BankList = BankList;

            List <SelectListItem> objOnWebsite = new List <SelectListItem>();

            objOnWebsite.Add(new SelectListItem
            {
                Text  = "Yes",
                Value = "Y"
            });

            objOnWebsite.Add(new SelectListItem
            {
                Text  = "No",
                Value = "N"
            });
            ViewBag.OnWebsite = objOnWebsite;
            List <SelectListItem> objActiveStatus = new List <SelectListItem>();

            objActiveStatus.Add(new SelectListItem
            {
                Text  = "Yes",
                Value = "Y"
            });

            objActiveStatus.Add(new SelectListItem
            {
                Text  = "No",
                Value = "N"
            });
            ViewBag.ActiveStatus = objActiveStatus;

            objModel.StateList = objRegistrationManager.GetStateList();
            List <SelectListItem> StateList = new List <SelectListItem>();

            foreach (var obj in objModel.StateList)
            {
                if (obj.StateCode != 0)
                {
                    StateList.Add(new SelectListItem
                    {
                        Text  = obj.StateName,
                        Value = obj.StateCode.ToString()
                    });
                }
            }
            ViewBag.StateList  = StateList;
            objModel.StateCode = objModel.StateList.Where(r => r.IsCompanyState == true).Select(m => m.StateCode).FirstOrDefault();

            objModel.CityList = objRegistrationManager.GetCityList();
            List <SelectListItem> CityList = new List <SelectListItem>();

            foreach (var obj in objModel.CityList)
            {
                if (obj.StateCode == objModel.StateCode)
                {
                    if (obj.CityCode != 0)
                    {
                        CityList.Add(new SelectListItem
                        {
                            Text  = obj.CityName,
                            Value = obj.CityCode.ToString()
                        });
                    }
                }
            }
            objModel.CityCode = objModel.CityList.Where(r => r.IsCompanyCity == true).Select(m => m.CityCode).FirstOrDefault();
            objModel.CityName = objModel.CityList.Where(r => r.IsCompanyCity == true).Select(m => m.CityName).FirstOrDefault();
            ViewBag.CityList  = CityList;

            List <PartyModel> objParentPartyList = new List <PartyModel>();

            if (objModel.GroupList.Count > 0)
            {
                objParentPartyList = objRegistrationManager.GetParentParty(objModel.GroupList[0].GroupId);
            }
            List <SelectListItem> ParentParty = new List <SelectListItem>();

            foreach (var obj in objParentPartyList)
            {
                ParentParty.Add(new SelectListItem
                {
                    Text  = obj.PartyName,
                    Value = obj.PartyCode.ToString()
                });
            }

            ViewBag.ParentPartyList = ParentParty;


            if (IsActionName == "Add")
            {
                if (objParentPartyList.Count > 0 && objModel.GroupList.Count > 0)
                {
                    objModel.PartyCode = objRegistrationManager.GetPartyCode(objParentPartyList[0].PartyCode.ToString(), objModel.GroupList[0].GroupId.ToString());
                }
                objModel.GroupId         = objModel.GroupList[0].GroupId;
                objModel.ParentPartyCode = objParentPartyList[0].PartyCode;

                objModel.BankCode     = objModel.BankList[0].BankCode;
                objModel.BankName     = objModel.BankList[0].BankName;
                objModel.OnWebsite    = "Y";
                objModel.ActiveStatus = "Y";
            }
            else
            {
                if (!string.IsNullOrEmpty(PartyCode))
                {
                    objModel = objRegistrationManager.GetParyOnPartyCode(PartyCode, false);
                }
            }

            var AccessTo = new UserController().UserCanAccess((Session["LoginUser"] as User).UserId, "PartyRegistration");

            if (!string.IsNullOrEmpty(AccessTo))
            {
                ViewBag.UserCanAccess = AccessTo;
                return(View(objModel));
            }
            else
            {
                return(RedirectToAction("Dashboard", "Home"));
            }
        }
Beispiel #2
0
        public ActionResult AddEditPartyRegistration(string IsActionName, string PartyCode, bool?IsStallCounter)
        {
            PartyModel objModel = new PartyModel();

            objModel.GroupList  = objRegistrationManager.GetGroupList();
            objModel.GroupList  = objModel.GroupList.Where(r => r.GroupId == 100).ToList();
            objModel.IsSupplier = false;
            List <SelectListItem> GroupList = new List <SelectListItem>();

            foreach (var obj in objModel.GroupList)
            {
                GroupList.Add(new SelectListItem
                {
                    Text  = obj.GroupName,
                    Value = obj.GroupId.ToString()
                });
            }
            ViewBag.GroupList = GroupList;

            //objModel.BankList = objTransactManager.GetBankList();
            //List<SelectListItem> BankList = new List<SelectListItem>();
            //foreach (var obj in objModel.BankList)
            //{
            //    BankList.Add(new SelectListItem
            //    {
            //        Text = obj.BankName,
            //        Value = obj.BankCode.ToString()
            //    });
            //}
            //ViewBag.BankList = BankList;

            //List<SelectListItem> objOnWebsite = new List<SelectListItem>();
            //objOnWebsite.Add(new SelectListItem
            //{
            //    Text="Yes",
            //    Value="Y"
            //});

            //objOnWebsite.Add(new SelectListItem
            //{
            //    Text = "No",
            //    Value = "N"
            //});
            //ViewBag.OnWebsite = objOnWebsite;
            List <SelectListItem> objActiveStatus = new List <SelectListItem>();

            objActiveStatus.Add(new SelectListItem
            {
                Text  = "Yes",
                Value = "Y"
            });

            objActiveStatus.Add(new SelectListItem
            {
                Text  = "No",
                Value = "N"
            });
            ViewBag.ActiveStatus = objActiveStatus;

            objModel.StateList = objRegistrationManager.GetStateList();
            List <SelectListItem> StateList = new List <SelectListItem>();

            foreach (var obj in objModel.StateList)
            {
                if (obj.StateCode != 0)
                {
                    StateList.Add(new SelectListItem
                    {
                        Text  = obj.StateName,
                        Value = obj.StateCode.ToString()
                    });
                }
            }
            ViewBag.StateList  = StateList;
            objModel.StateCode = objModel.StateList.Where(r => r.IsCompanyState == true).Select(m => m.StateCode).FirstOrDefault();

            objModel.CityList = objRegistrationManager.GetCityList();
            List <SelectListItem> CityList = new List <SelectListItem>();

            foreach (var obj in objModel.CityList)
            {
                if (obj.StateCode == objModel.StateCode)
                {
                    if (obj.CityCode != 0)
                    {
                        CityList.Add(new SelectListItem
                        {
                            Text  = obj.CityName,
                            Value = obj.CityCode.ToString()
                        });
                    }
                }
            }
            objModel.CityCode = objModel.CityList.Where(r => r.IsCompanyCity == true).Select(m => m.CityCode).FirstOrDefault();
            objModel.CityName = objModel.CityList.Where(r => r.IsCompanyCity == true).Select(m => m.CityName).FirstOrDefault();
            ViewBag.CityList  = CityList;

            List <PartyModel> objParentPartyList = new List <PartyModel>();

            if (objModel.GroupList.Count > 0)
            {
                objParentPartyList = objRegistrationManager.GetParentParty(objModel.GroupList[0].GroupId, IsStallCounter ?? false);
            }
            List <SelectListItem> ParentParty = new List <SelectListItem>();

            foreach (var obj in objParentPartyList)
            {
                ParentParty.Add(new SelectListItem
                {
                    Text  = obj.PartyName,
                    Value = obj.PartyCode.ToString()
                });
            }

            ViewBag.ParentPartyList = ParentParty;


            if (IsActionName == "Add")
            {
                if (objParentPartyList.Count > 0 && objModel.GroupList.Count > 0)
                {
                    objModel.PartyCode = objRegistrationManager.GetPartyCode(objParentPartyList[0].PartyCode.ToString(), objModel.GroupList[0].GroupId.ToString());
                }
                objModel.GroupId         = objModel.GroupList[0].GroupId;
                objModel.ParentPartyCode = objParentPartyList[0].PartyCode;

                //objModel.BankCode = objModel.BankList[0].BankCode;
                //objModel.BankName = objModel.BankList[0].BankName;
                objModel.OnWebsite    = "Y";
                objModel.ActiveStatus = "Y";
            }
            else
            {
                if (!string.IsNullOrEmpty(PartyCode))
                {
                    objModel = objRegistrationManager.GetParyOnPartyCode(PartyCode, false);
                }
            }
            return(View(objModel));
        }