コード例 #1
0
        //[OutputCache(Duration = 86400)]
        public ActionResult GetAllCity()
        {
            var cityBAL = new CityBAL();
            var lstCity = cityBAL.GetAll();

            return(View(lstCity));
        }
コード例 #2
0
        public ActionResult Select()
        {
            string mode = Request.QueryString["Grid-mode"];

            if (!string.IsNullOrEmpty(mode))
            {
                return(this.RedirectToAction("Create"));
            }
            else
            {
                List <CityVM> viewModels           = new List <CityVM>();
                CityBAL       balObject            = new CityBAL();
                IQueryable <Entities.City> entites = balObject.GetAll();

                foreach (Entities.City entity in entites)
                {
                    CityVM viewModel = new CityVM();
                    viewModel.CityId       = entity.CityId;
                    viewModel.CityName     = entity.CityName;
                    viewModel.DistrictName = entity.DistrictName;
                    viewModel.Status       = entity.Status;
                    viewModel.Remark       = entity.Remark;
                    viewModels.Add(viewModel);
                }
                return(View(new GridModel <CityVM> {
                    Data = viewModels
                }));
            }
        }
コード例 #3
0
        public ActionResult Index()
        {
            List <StudentAddressVM> viewModels           = new List <StudentAddressVM>();
            StudentAddressBAL       balObject            = new StudentAddressBAL();
            IQueryable <Entities.StudentAddress> entites = balObject.GetAll();

            CountryBAL countryBAL = new CountryBAL();
            IQueryable <Entities.Country> countries = countryBAL.GetAll();

            StateBAL stateBAL = new StateBAL();
            IQueryable <Entities.State> states = stateBAL.GetAll();

            DistrictBAL DistrictObject = new DistrictBAL();
            IQueryable <Entities.District> districts = DistrictObject.GetAll();

            CityBAL CityObject = new CityBAL();
            IQueryable <Entities.City> cities = CityObject.GetAll();

            StudentBAL studentObject = new StudentBAL();
            IQueryable <Entities.Student> students = studentObject.GetAll();


            foreach (Entities.StudentAddress entity in entites)
            {
                StudentAddressVM viewModel = new StudentAddressVM();
                viewModel.StudentId           = entity.StudentId;
                viewModel.CurrentAddress      = entity.CurrentAddress;
                viewModel.CurrentCountryId    = entity.CurrentCountryId;
                viewModel.CurrentStateId      = entity.CurrentStateId;
                viewModel.CurrentDistrictId   = entity.CurrentDistrictId;
                viewModel.CurrentCityId       = entity.CurrentCityId;
                viewModel.CurrentCountryName  = countries.Where(c => c.CountryId == entity.CurrentCountryId).FirstOrDefault().CountryName;
                viewModel.CurrentStateName    = states.Where(s => s.StateId == entity.CurrentStateId).FirstOrDefault().StateName;
                viewModel.CurrentDistrictName = districts.Where(c => c.DistrictId == entity.CurrentDistrictId).FirstOrDefault().DistrictName;

                viewModel.CurrentCityName = cities.Where(c => c.CityId == entity.CurrentDistrictId).FirstOrDefault().CityName;

                viewModel.PermentAddress    = entity.PermentAddress;
                viewModel.PermentCountryId  = entity.PermentCountryId;
                viewModel.PermentStateId    = entity.PermentStateId;
                viewModel.PermentDistrictId = entity.PermentDistrictId;
                viewModel.PermentCityId     = entity.PermentCityId;

                viewModel.PermentCountryName  = countries.Where(c => c.CountryId == entity.PermentCountryId).FirstOrDefault().CountryName;
                viewModel.PermentStateName    = states.Where(s => s.StateId == entity.PermentStateId).FirstOrDefault().StateName;
                viewModel.PermentDistrictName = districts.Where(c => c.DistrictId == entity.PermentDistrictId).FirstOrDefault().DistrictName;

                viewModel.PermentCityName = cities.Where(c => c.CityId == entity.PermentCityId).FirstOrDefault().CityName;

                viewModel.Status = entity.Status;
                viewModel.Remark = entity.Remark;
                Entities.Student student = students.Where(s => s.StudentId == entity.StudentId).FirstOrDefault();
                viewModel.StudentFullNameWithTitle = string.Concat(student.Title, " ", student.FirstName, " ", student.MiddleName, " ", student.LastName);
                viewModels.Add(viewModel);
            }
            return(View(new GridModel <StudentAddressVM> {
                Data = viewModels
            }));
        }
コード例 #4
0
ファイル: AccountController.cs プロジェクト: hazu90/git-hoc
        public ActionResult Register()
        {
            var registerInfo = new RegisterInfoModel();
            // Get list of city
            var cityBAL = new CityBAL();

            registerInfo.LstCity = cityBAL.GetAll();
            return(View(registerInfo));
        }
コード例 #5
0
        /// <summary>
        /// method for get cities list
        /// </summary>
        /// <returns>Cities list</returns>
        public JsonResult GetPermentCitiesList(int PermentDistrictId)
        {
            CityBAL balObject = new CityBAL();
            var     cityList  = from obj in balObject.GetAll().Where(c => c.DistrictId == PermentDistrictId && c.Status == true) select new SelectListItem()
            {
                Text = obj.CityName, Value = obj.CityId.ToString()
            };

            return(this.Json(cityList, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
ファイル: AccountController.cs プロジェクト: hazu90/git-hoc
        public ActionResult Register(RegisterInfoModel model)
        {
            var googleCaptchaBAL = new GoogleCaptchaBAL();

            if (googleCaptchaBAL.Authenticate(Request["g-recaptcha-response"]) && ModelState.IsValid)
            {
                try
                {
                    // Tách lấy username của người dùng
                    var userName = model.UserEmail.Split('@')[0];

                    // Kiểm tra thông tin người dùng này đã tồn tại chưa
                    // Nếu tồn tại rồi thì đánh chỉ số cho người dùng đó
                    var id = WebSecurity.GetUserId(userName);
                    if (id > 0)
                    {
                        var indexUser = (new Random()).Next(1, 10000);
                        userName += indexUser.ToString();
                    }
                    model.UserName = userName;

                    // Tạo tài khoản
                    var tokenKey = WebSecurity.CreateUserAndAccount(model.UserName, model.Password, null, true);
                    // Bổ sung thông tin tài khoản tài khoản
                    var userInformationBAL = new UserInformationBAL();
                    userInformationBAL.Create(new UserInformation()
                    {
                        FirstName = model.FirstName,
                        LastName  = model.LastName,
                        UserEmail = model.UserEmail,
                        UserName  = model.UserName,
                        CityCode  = model.CityCode
                    });
                    //Gui mail yeu cau kich hoat tai khoan
                    var mailConfirmAccountBAL = new MailConfirmAccountBAL();
                    mailConfirmAccountBAL.SendConfirmMail(model.UserEmail, model.UserName, tokenKey);
                    return(RedirectToAction("ActivateNotification", "Account", new { username = model.UserEmail }));
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // Get list of city
            var cityBAL = new CityBAL();

            model.LstCity = cityBAL.GetAll();
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
コード例 #7
0
        public ActionResult Index()
        {
            List <CityVM> viewModels           = new List <CityVM>();
            CityBAL       balObject            = new CityBAL();
            IQueryable <Entities.City> entites = balObject.GetAll();


            foreach (Entities.City entity in entites)
            {
                CityVM viewModel = new CityVM();
                viewModel.CityId       = entity.CityId;
                viewModel.CityName     = entity.CityName;
                viewModel.DistrictName = entity.DistrictName;
                viewModel.Status       = entity.Status;
                viewModel.Remark       = entity.Remark;
                viewModels.Add(viewModel);
            }
            return(View(new GridModel <CityVM> {
                Data = viewModels
            }));
        }
コード例 #8
0
        private DataSet LeavingCertificate(int StudentId)
        {
            DataSet ds = new DataSet();

            ds.DataSetName = "DataSourceForReport";

            DataTable dt = new DataTable("LeavingCertificate");

            dt.TableName = "LeavingCertificate";
            dt.Columns.Add(new DataColumn("StudentId", typeof(string)));
            dt.Columns.Add(new DataColumn("FirstName", typeof(string)));
            dt.Columns.Add(new DataColumn("MiddleName", typeof(string)));
            dt.Columns.Add(new DataColumn("LastName", typeof(string)));
            dt.Columns.Add(new DataColumn("MotherName", typeof(string)));
            dt.Columns.Add(new DataColumn("MotherTounge", typeof(string)));
            dt.Columns.Add(new DataColumn("ReligionName", typeof(string)));
            dt.Columns.Add(new DataColumn("CastName", typeof(string)));
            dt.Columns.Add(new DataColumn("SubCast", typeof(string)));
            dt.Columns.Add(new DataColumn("Nationality", typeof(string)));
            dt.Columns.Add(new DataColumn("PlaceOfBirth", typeof(string)));
            dt.Columns.Add(new DataColumn("DateOfBirth", typeof(DateTime)));
            dt.Columns.Add(new DataColumn("DateOfBirthInWord", typeof(string)));
            dt.Columns.Add(new DataColumn("LastSchool", typeof(string)));
            dt.Columns.Add(new DataColumn("DateOfAdmission", typeof(DateTime)));
            dt.Columns.Add(new DataColumn("Progress", typeof(string)));
            dt.Columns.Add(new DataColumn("Conduct", typeof(string)));
            dt.Columns.Add(new DataColumn("DateOfLeaveingSchool", typeof(DateTime)));
            dt.Columns.Add(new DataColumn("ClassInWhichStudingAndSinceWhen", typeof(string)));
            dt.Columns.Add(new DataColumn("Reason", typeof(string)));
            dt.Columns.Add(new DataColumn("Remark", typeof(string)));
            dt.Columns.Add(new DataColumn("RegisterNo", typeof(int)));
            dt.Columns.Add(new DataColumn("TCNo", typeof(string)));
            dt.Columns.Add(new DataColumn("TCPrinted", typeof(bool)));
            dt.Columns.Add(new DataColumn("AdharcardNo", typeof(string)));
            dt.Columns.Add(new DataColumn("DateOfLeaveingSchoolInWords", typeof(string)));
            dt.Columns.Add(new DataColumn("Taluka", typeof(string)));
            dt.Columns.Add(new DataColumn("District", typeof(string)));
            dt.Columns.Add(new DataColumn("state", typeof(string)));
            dt.Columns.Add(new DataColumn("Country", typeof(string)));

            int studentId = (int)PresentationLayer.Helpers.SessionHelper.StudentId;

            // Fetch the District, State, Country from database ***********

            string strDistrict, strState, strCountry, strCity;

            strDistrict = strState = strCountry = strCity = "";

            //balObject.FindBy(s => s.StudentId == studentId );

            StudentParentBAL balObjectAddr = new StudentParentBAL();
            IQueryable <Entities.StudentParent> entites1 = balObjectAddr.FindBy(s => s.StudentId == studentId);

            if (entites1 != null && entites1.Count() > 0)
            {
                Entities.StudentParent entity1 = entites1.FirstOrDefault();

                CountryBAL countryBAL = new CountryBAL();
                IQueryable <Entities.Country> countries = countryBAL.GetAll();

                StateBAL stateBAL = new StateBAL();
                IQueryable <Entities.State> states = stateBAL.GetAll();

                DistrictBAL DistrictObject = new DistrictBAL();
                IQueryable <Entities.District> District = DistrictObject.GetAll();

                CityBAL CityObject = new CityBAL();
                IQueryable <Entities.City> Cities = CityObject.GetAll();


                strCountry  = countries.Where(c => c.CountryId == entity1.CountryId).FirstOrDefault().CountryName;
                strState    = states.Where(s => s.StateId == entity1.StateId).FirstOrDefault().StateName;
                strDistrict = District.Where(c => c.DistrictId == entity1.DistrictId).FirstOrDefault().DistrictName;
                strCity     = Cities.Where(c => c.CityId == entity1.CityId).FirstOrDefault().CityName;
            }


            // *********

            StudentBAL balObject = new StudentBAL();
            //IQueryable<Entities.Student> entites = balObject.FindBy(s => s.StudentId == studentId );
            IQueryable <Entities.Student> entites = balObject.GetAll(SessionHelper.SchoolId).Where(c => c.StudentId == studentId);

            if (entites != null && entites.Count() > 0)
            {
                Entities.Student entity = entites.FirstOrDefault();
                DataRow          dr     = dt.NewRow();

                dr["StudentId"]    = entity.UStudentId;
                dr["FirstName"]    = entity.FirstName.Trim();
                dr["MiddleName"]   = entity.MiddleName.Trim();;
                dr["LastName"]     = entity.LastName.Trim();;
                dr["MotherName"]   = entity.MotherName.Trim();;
                dr["ReligionName"] = entity.ReligionName.Trim();;
                dr["CastName"]     = entity.CastName.Trim();
                dr["SubCast"]      = "";                 //TODO
                dr["Nationality"]  = entity.Nationality.Trim();
                dr["DateOfBirth"]  = entity.DateOfBirth; //Date
                dr["PlaceOfBirth"] = entity.PlaceOfBirth;

                if (entity.DateOfBirth != null)
                {
                    dr["DateOfBirthInWord"] = DateToText(entity.DateOfBirth);
                }
                else
                {
                    dr["DateOfBirthInWord"] = "";
                }

                dr["LastSchool"]      = entity.LastSchoolAttended;
                dr["DateOfAdmission"] = entity.DateOfAdmission; //Date
                if (entity.DateOfAdmission != null)
                {
                    dr["DateOfAdmission"] = entity.DateOfAdmission;//Date
                }
                dr["Progress"] = entity.Progress;
                dr["Conduct"]  = entity.Conduct;
                if (entity.DateOfLeavingSchool != null)
                {
                    dr["DateOfLeaveingSchool"]        = entity.DateOfLeavingSchool;//Date
                    dr["DateOfLeaveingSchoolInWords"] = DateToText((System.DateTime)entity.DateOfLeavingSchool);
                }
                else
                {
                    dr["DateOfLeaveingSchoolInWords"] = "";
                }


                dr["ClassInWhichStudingAndSinceWhen"] = entity.ClassInWhichStudingAndSinceWhen;
                dr["Reason"]     = entity.ReasonForLeavingSchool;
                dr["Remark"]     = entity.RemarkOnTC;
                dr["RegisterNo"] = entity.RegisterId;

                dr["TCPrinted"] = entity.TCPrinted;
                if (!entity.TCPrinted)
                {
                    long maxTCNo = balObject.GetMaxTCNo();
                    dr["TCNo"] = FormatedTCNo(Convert.ToString(maxTCNo + 1));

                    //if (isPrintExport)
                    //  UpdateTCDetails(studentId);
                }
                else
                {
                    dr["TCNo"] = FormatedTCNo(Convert.ToString(entity.TCNo));
                }

                if (isPrintExport)
                {
                    UpdateTCDetails(studentId);
                }

                dr["AdharcardNo"]  = entity.AdharcardNo;
                dr["MotherTounge"] = entity.MotherTounge;

                // ****
                dr["Taluka"]   = strCity;
                dr["District"] = strDistrict;
                dr["state"]    = strState;
                dr["Country"]  = strCountry;

                dt.Rows.Add(dr);
                reportName = entity.RegisterId + "_" + entity.LastName.Trim() + "_" + entity.FirstName.Trim();
            }

            ds.Tables.Add(getSchoolDetails());
            ds.Tables.Add(dt);
            return(ds);
        }