예제 #1
0
        public ActionResult AddUser(string IsActionName, string UserCode)
        {
            User objModel = new User();
            var  result   = objUserManager.GetPartyListForUsers();

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

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


            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;
            if (result.Count > 0)
            {
                objModel.FCode = result[0].PartyCode;
            }
            if (IsActionName == "Add")
            {
                objModel.ActiveStatus = "Y";
            }
            else
            {
                if (!string.IsNullOrEmpty(UserCode))
                {
                    int UId = int.Parse(UserCode);
                    objModel = objUserManager.GetUser(UId);
                }
            }
            objModel.IsActionName = IsActionName;

            var GroupLists = objRegistrationManager.GetGroupList();

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

            foreach (var obj in GroupLists)
            {
                if (IsActionName == "Add")
                {
                    if (obj.GroupId != 0 && obj.GroupId != 100 && obj.GroupId != 105 && obj.GroupId != 101)
                    {
                        GroupList.Add(new SelectListItem
                        {
                            Text  = obj.GroupName,
                            Value = obj.GroupId.ToString()
                        });
                    }
                }
                else
                {
                    if (obj.GroupId != 0 && obj.GroupId != 100 && obj.GroupId != 105)
                    {
                        GroupList.Add(new SelectListItem
                        {
                            Text  = obj.GroupName,
                            Value = obj.GroupId.ToString()
                        });
                    }
                }
            }
            ViewBag.GroupList = GroupList;

            return(View(objModel));
        }
예제 #2
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"));
            }
        }
예제 #3
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));
        }