示例#1
0
        public ActionResult Create(SchoolAccount model)
        {
            try
            {
                // TODO: Add insert logic here
                // model.Amount = theFeetoBeApproved.Paid;
                model.ApprovedBy           = User.Identity.Name;
                model.BankDraftNumber      = "";
                model.ChequeNumber         = "";
                model.DateApproved         = DateTime.Now;
                model.EnteredBy            = User.Identity.Name;
                model.PaidDate             = DateTime.Now;
                model.POSTransactionNumber = "";
                model.StudentID            = 0;
                model.TellerNumber         = "";
                model.TransactionMethod    = "";
                model.TransactionType      = "Credit";
                model.Session = "";

                model.Balance = new SchoolAccountBalanceHelper().getSchoolAccountBalance(model.Amount);
                work.SchoolAccountRepository.Insert(model);
                work.Save();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#2
0
        //public ActionResult Student(string school, string code)
        public ActionResult Student(string id)
        {
            if (id != null)
            {
                AccessCodeClient acc  = new AccessCodeClient();
                AccessCode       code = acc.GetByPartitionAndRowKey("accesscode", id);

                //AssessmentGroupPinCodeClient agpcc = new AssessmentGroupPinCodeClient();
                //AssessmentGroupPinCode groupInfo = agpcc.GetByPartitionAndRowKey("pincodes", id);
                if (code != null && code.School != "CareerThesaurus Demo School")
                {
                    SchoolAccountClient sac           = new SchoolAccountClient();
                    SchoolAccount       schoolAccount = sac.GetByPartitionAndRowKey("school", code.School);
                    ViewBag.SignUpSchoolZip  = schoolAccount.ZipCode;
                    ViewBag.SignUpSchool     = code.School;
                    ViewBag.SignUpSchoolName = schoolAccount.SchoolName;
                    ViewBag.SignUpCode       = code.Code;
                    ViewBag.SignUpGrade      = code.Grade;
                    ViewBag.SignUpCounselor  = code.Counselor;
                    ViewBag.SignUpGroupName  = code.GroupName;
                }
                else
                {
                    ViewBag.InvalidLink = true;
                }
            }
            return(View());
        }
        public ActionResult Edit2(int id)
        {
            try
            {
                SchoolFeePayment theFeetoBeApproved = work.SchoolFeePaymentRepository.GetByID(id);
                theFeetoBeApproved.Approved = true;
                work.SchoolFeePaymentRepository.Update(theFeetoBeApproved);

                SchoolFeesAccount thePayment = new SchoolFeesAccount();

                thePayment.Amount               = theFeetoBeApproved.Paid;
                thePayment.ApprovedBy           = User.Identity.Name;
                thePayment.BankDraftNumber      = theFeetoBeApproved.BankDraftNumber;
                thePayment.ChequeNumber         = theFeetoBeApproved.ChequeNumber;
                thePayment.DateApproved         = DateTime.Now;
                thePayment.EnteredBy            = theFeetoBeApproved.EnteredBy;
                thePayment.PaidDate             = theFeetoBeApproved.DatePaid;
                thePayment.POSTransactionNumber = theFeetoBeApproved.POSTransactionNumber;
                thePayment.StudentID            = theFeetoBeApproved.StudentID;
                thePayment.TellerNumber         = theFeetoBeApproved.TellerNumber;
                thePayment.TransactionMethod    = theFeetoBeApproved.PaymentMethod;
                thePayment.TransactionType      = "Credit";
                thePayment.Session              = theFeetoBeApproved.Session;
                thePayment.Level = theFeetoBeApproved.Level;
                work.SchoolFeesAccountRepository.Insert(thePayment);



                SchoolAccount thePayment1 = new SchoolAccount();

                thePayment1.Amount               = theFeetoBeApproved.Paid;
                thePayment1.ApprovedBy           = User.Identity.Name;
                thePayment1.BankDraftNumber      = theFeetoBeApproved.BankDraftNumber;
                thePayment1.ChequeNumber         = theFeetoBeApproved.ChequeNumber;
                thePayment1.DateApproved         = DateTime.Now;
                thePayment1.EnteredBy            = theFeetoBeApproved.EnteredBy;
                thePayment1.PaidDate             = theFeetoBeApproved.DatePaid;
                thePayment1.POSTransactionNumber = theFeetoBeApproved.POSTransactionNumber;
                thePayment1.StudentID            = theFeetoBeApproved.StudentID;
                thePayment1.TellerNumber         = theFeetoBeApproved.TellerNumber;
                thePayment1.TransactionMethod    = theFeetoBeApproved.PaymentMethod;
                thePayment1.TransactionType      = "Credit";
                thePayment1.Session              = theFeetoBeApproved.Session;
                thePayment1.Level   = theFeetoBeApproved.Level;
                thePayment1.Balance = new SchoolAccountBalanceHelper().getSchoolAccountBalance(thePayment1.Amount);
                work.SchoolAccountRepository.Insert(thePayment1);
                work.Save();
                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#4
0
        public ActionResult Edit(string id)
        {
            try
            {
                Int32 theId = Convert.ToInt32(Models.Encript.DecryptString(id, true));

                Order theOrder = work.OrderRepository.GetByID(theId);

                theOrder.Approved = true;


                SchoolAccount thePayment1 = new SchoolAccount();

                thePayment1.Amount     = theOrder.TotalAmount;
                thePayment1.ApprovedBy = User.Identity.Name;
                //thePayment1.BankDraftNumber = ;
                // thePayment1.ChequeNumber = theFeetoBeApproved.ChequeNumber;
                thePayment1.DateApproved = DateTime.Now;
                // thePayment1.EnteredBy = theFeetoBeApproved.EnteredBy;
                thePayment1.PaidDate = Convert.ToDateTime(theOrder.OrderDate);
                // thePayment1.POSTransactionNumber = theFeetoBeApproved.POSTransactionNumber;
                thePayment1.StudentID = theOrder.studentID;
                //  thePayment1.TellerNumber = theFeetoBeApproved.TellerNumber;
                thePayment1.TransactionMethod = Convert.ToString(theOrder.OrderNumber);
                thePayment1.TransactionType   = "Credit, Stored Item Sold";
                thePayment1.Balance           = new SchoolAccountBalanceHelper().getSchoolAccountBalance(thePayment1.Amount);
                List <TermRegistration> theTermReg = new List <TermRegistration>();
                theTermReg = work.TermRegistrationRepository.Get(a => a.StudentID == theOrder.studentID).OrderByDescending(a => a.DateRegistered).ToList();

                if (theTermReg.Count() > 0)
                {
                    thePayment1.Session = theTermReg[0].Session;
                }

                thePayment1.Level = theOrder.Level;// theFeetoBeApproved.Level;
                work.SchoolAccountRepository.Insert(thePayment1);
                work.Save();
                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#5
0
        public ActionResult Student(FormCollection collection)
        {
            UserAccountClient uac     = new UserAccountClient();
            UserAccount       account = uac.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(collection["email"].ToLower()), collection["email"]);

            if (account == null)
            {
                AccessCodeClient aac  = new AccessCodeClient();
                AccessCode       code = aac.GetBySchoolPinCodeCounselorGrade(collection["school"], collection["accesscode"], collection["counselor"], collection["grade"]);

                if (code == null || code.School == "7181234567")
                {
                    ViewBag.ErrorMessage = "Invalid fields";
                    return(RedirectToAction("Index"));
                }

                uac.AddNewItem(new UserAccount {
                    PartitionKey = UserAccountClient.GetPartitionKeyForEmail(collection["email"].ToLower()), RowKey = collection["email"].ToLower(), FirstName = collection["firstname"], LastName = collection["lastname"], Email = collection["email"], Password = collection["password"], ProfileType = "student"
                });

                StudentAccountClient sac = new StudentAccountClient();
                sac.AddNewItem(new StudentAccount {
                    PartitionKey = StudentAccountClient.GetPartitionKeyForEmail(collection["email"].ToLower()), RowKey = collection["email"].ToLower(), Gender = collection["gender"], StudentID = collection["studentid"], School = collection["school"], Counselor = collection["counselor"], Year = code.Year, Grade = collection["grade"], GroupName = code.GroupName
                });

                //StudentProfileClient spc = new StudentProfileClient();
                //spc.AddNewItem(new StudentProfile { PartitionKey = StudentProfileClient.GetPartitionKeyForEmail(collection["email"]), RowKey = collection["email"].ToLower(), Gender = collection["gender"], GradYear = collection["gradyear"], School = school, SchoolZip = collection["zipcode"], Teacher = teacher, Group = group });
            }
            else
            {
                ViewBag.ErrorMessage = "There is an account already associated with this email. Please log in instead.";
                return(View());
            }

            SendVerificationEmail(collection["email"].ToLower(), collection["firstname"]);

            SchoolAccountClient saclient      = new SchoolAccountClient();
            SchoolAccount       schoolAccount = saclient.GetByPartitionAndRowKey("school", collection["school"]);
            UserAccount         adminAccount  = uac.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(collection["counselor"]), collection["counselor"]);
            EmailManager        emailManager  = new EmailManager();
            string str = "<p>Full name: " + collection["firstname"] + " " + collection["lastname"] + "</p><p>Email: " + collection["email"].ToLower() + "</p><p>School: " + (schoolAccount != null ? schoolAccount.SchoolName : "") + "</p><p>Counselor: " + (adminAccount != null ? adminAccount.FirstName + " " + adminAccount.LastName : "") + "</p><p>Grade: " + collection["grade"] + "</p><p>Year: " + collection["year"] + "</p>";

            emailManager.SendMail("*****@*****.**", "Admin", "*****@*****.**", "HS Student", str);
            return(RedirectToAction("Complete"));
        }
        public ActionResult ChangeRole(string counselor)
        {
            if (AuthTokens[0] == "demo")
            {
                return(RedirectToAction("Index", "AdminPortal"));;
            }
            string currentAdminEmail = AuthTokens[1];

            AdminAccountClient     aac = new AdminAccountClient();
            CounselorAccountClient cac = new CounselorAccountClient();
            UserAccountClient      uac = new UserAccountClient();
            SchoolAccountClient    sac = new SchoolAccountClient();

            AdminAccount     admin            = aac.GetByPartitionAndRowKey("admin", currentAdminEmail);
            CounselorAccount counselorAccount = cac.GetByPartitionAndRowKey("counselor", counselor);
            UserAccount      currentAdmin     = uac.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(currentAdminEmail), currentAdminEmail);
            UserAccount      newAdmin         = uac.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(counselor), counselor);
            SchoolAccount    school           = sac.GetByPartitionAndRowKey("school", admin.School);

            if (admin != null && counselorAccount != null && currentAdmin != null && newAdmin != null && school != null)
            {
                aac.AddNewItem(new AdminAccount {
                    RowKey = counselor, PhoneNumber = counselorAccount.PhoneNumber, PhoneExtension = counselorAccount.PhoneExtension, School = school.RowKey, SchoolSelected = true, ConnectionToSchoolConfirmed = true
                });
                cac.AddNewItem(new CounselorAccount {
                    RowKey = currentAdminEmail, PhoneNumber = admin.PhoneNumber, PhoneExtension = admin.PhoneExtension, School = school.RowKey
                });
                currentAdmin.ProfileType = "counselor";
                uac.Update(currentAdmin);
                newAdmin.ProfileType = "administrator";
                uac.Update(newAdmin);
                school.Admin = counselor;
                sac.Update(school);
                aac.Delete(admin);
                cac.Delete(counselorAccount);
            }
            return(RedirectToAction("LogOut", "Account"));
        }
示例#7
0
        public ActionResult Counselor(FormCollection collection)
        {
            string                adminEmail = "";
            UserAccountClient     uac        = new UserAccountClient();
            CounselorInviteClient cic        = new CounselorInviteClient();
            SchoolAccountClient   sac        = new SchoolAccountClient();
            UserAccount           account    = uac.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(collection["email"].ToLower()), collection["email"].ToLower());
            CounselorInvite       invite     = cic.GetByPartitionAndRowKey("invite", collection["invite"]);
            SchoolAccount         school     = sac.GetByPartitionAndRowKey("school", collection["school"]);

            if (invite != null)
            {
                if (invite.Email == collection["email"].ToLower())
                {
                    if (account == null)
                    {
                        uac.AddNewItem(new UserAccount {
                            PartitionKey = UserAccountClient.GetPartitionKeyForEmail(collection["email"].ToLower()), RowKey = collection["email"].ToLower(), FirstName = collection["firstname"], LastName = collection["lastname"], Email = collection["email"], Password = collection["password"], ProfileType = "counselor", EmailConfirmed = true
                        });
                        CounselorAccountClient сac   = new CounselorAccountClient();
                        AdminAccountClient     aac   = new AdminAccountClient();
                        AdminAccount           admin = aac.GetBySchool(collection["school"]);
                        if (admin != null)
                        {
                            adminEmail = admin.RowKey;
                        }
                        сac.AddNewItem(new CounselorAccount {
                            RowKey = collection["email"].ToLower(), PhoneNumber = collection["phonenumber"], PhoneExtension = collection["extension"], School = collection["school"]
                        });
                        cic.Delete(invite);
                    }
                    else
                    {
                        ViewBag.Invite       = invite;
                        ViewBag.ErrorMessage = "There is an account already associated with this email. Please log in instead.";
                        return(View());
                    }
                }
                else
                {
                    ViewBag.Invite     = invite;
                    ViewBag.EmailMatch = "Email has to match";
                    return(View());
                }
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }

            string sessionkey = ClientSession.GetClientSessionKey("user", collection["email"].ToLower(), collection["firstname"] + " " + collection["lastname"], "counselor");

            Response.Cookies["sessionkey"].Value        = sessionkey;
            Response.Cookies["sessionkey"].Expires      = DateTime.UtcNow.AddDays(7);
            Response.Cookies["sessionusername"].Value   = collection["email"].ToLower();
            Response.Cookies["sessionusername"].Expires = DateTime.UtcNow.AddDays(7);
            Response.Cookies["cbnvm"].Value             = "1";
            Response.Cookies["cbnvm"].Expires           = DateTime.UtcNow.AddDays(7);
            SendCongratulationsEmailToCounselor(collection["email"], collection["firstname"] + " " + collection["lastname"]);
            SendUpdateEmailToAdmin(adminEmail, collection["firstname"] + " " + collection["lastname"]);

            EmailManager emailManager = new EmailManager();
            string       schooStr     = "";

            if (school != null)
            {
                schooStr = "<p>School name: " + school.SchoolName + "</p>";
            }
            string str = "<p>Full name: " + collection["firstname"] + " " + collection["lastname"] + "</p><p>Email: " + collection["email"] + "</p><p>Phone Number: " + collection["phonenumber"] + "</p><p>" + collection["extension"] + "</p>" + schooStr;

            emailManager.SendMail("*****@*****.**", "Admin", "*****@*****.**", "HS Counselor", str);
            TempData["counselor"] = true;
            return(RedirectToAction("Index", "CounselorPortal"));
        }
        public HttpResponse AddSchoolPost(string rowkey)
        {
            if (AuthTokens[0] == "demo")
            {
                Response.ContentType = "application/json";
                Response.Write("{\"result\": \"done\"}");
                Response.End();
                return(null);
            }

            string response            = "";
            SchoolAccountClient sac    = new SchoolAccountClient();
            SchoolAccount       school = sac.GetByPartitionAndRowKey("school", rowkey);

            if (school != null)
            {
                AdminAccountClient aac   = new AdminAccountClient();
                AdminAccount       admin = aac.GetByPartitionAndRowKey("admin", AuthTokens[1].ToLower());
                if (school.Admin != null && school.Admin != "")
                {
                    response = "{\"result\": \"exist\"}";
                }
                else
                {
                    if (admin.SchoolSelected && !admin.ConnectionToSchoolConfirmed)
                    {
                        response = "{\"result\": \"not confirm\"}";
                    }
                    else if (admin.ConnectionToSchoolConfirmed)
                    {
                        response = "{\"result\": \"dup\"}";
                    }
                    else
                    {
                        admin.School         = school.RowKey;
                        admin.SchoolSelected = true;
                        aac.Update(admin);
                        UserAccountClient uac          = new UserAccountClient();
                        UserAccount       user         = uac.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(admin.RowKey), admin.RowKey);
                        EmailManager      emailManager = new EmailManager();
                        string            body         = "<div>Admin name: " + user.FirstName + " " + user.LastName + "</div><div>Admin phone number and extension:" + admin.PhoneNumber + " x " + admin.PhoneExtension + "</div><div>Admin Email: " + admin.RowKey + "</div>" +
                                                         "<div>School name: " + school.SchoolName + "</div><div>School address" + school.Address + " " + school.City + " " + school.State + " " + school.ZipCode + "</div>" +
                                                         "<div>School phone number: " + school.PhoneNumber + "</div>";
                        emailManager.SendMail("*****@*****.**", "Admin", "*****@*****.**", "Admin request", body);
                        response = "{\"result\": \"done\"}";
                    }
                }
            }
            else
            {
                response = "{\"result\": \"error\"}";
            }



            //if (school != null)
            //{
            //    //AdminProfileClient apc = new AdminProfileClient();
            //    //AdminProfile admin = apc.GetByPartitionAndRowKey("adminProfile", AuthTokens[1].ToLower());
            //    if (admin != null)
            //    {
            //        TeacherToSchoolConnectionClient ttscc = new TeacherToSchoolConnectionClient();
            //        TeacherToSchoolConnection connection = ttscc.GetByPartitionAndRowKey(rowkey, admin.RowKey);
            //        SchoolToTeacherConnectionClient sttcc = new SchoolToTeacherConnectionClient();
            //        SchoolToTeacherConnection s2tconnection = sttcc.GetByPartitionAndRowKey(admin.RowKey, rowkey);
            //        if (connection == null)
            //        {
            //            ttscc.AddNewItem(new TeacherToSchoolConnection { PartitionKey = rowkey, RowKey = admin.RowKey });
            //            sttcc.AddNewItem(new SchoolToTeacherConnection { PartitionKey = admin.RowKey, RowKey = rowkey });
            //            response = "{\"result\": \"done\"}";
            //        }
            //        else
            //        {
            //            response = "{\"result\": \"already exist\"}";
            //        }
            //    }
            //    else
            //    {
            //        response = "{\"result\": \"fail\"}";
            //    }
            //}
            //else
            //{
            //    response = "{\"result\": \"fail\"}";
            //}
            Response.ContentType = "application/json";
            Response.Write(response);
            Response.End();
            return(null);
        }
示例#9
0
        //
        // GET: /SchoolAccount/Edit/5

        public ActionResult Edit()
        {
            SchoolAccount theAccount = new SchoolAccount();

            return(View(theAccount));
        }
示例#10
0
        public ActionResult Edit(string id)
        {
            Int32        theId           = Convert.ToInt32(Models.Encript.DecryptString(id, true));
            OrderItem    theOrderItem    = work.OrderItemRepository.GetByID(theId);
            string       theItemName     = theOrderItem.ItemName;
            int          theItemQuantity = theOrderItem.Quantity;
            List <Store> theStore        = work.StoreRepository.Get(a => a.ItemName.Equals(theItemName)).ToList();

            if (theStore.Count > 0)
            {
                Store theStoreItem = theStore[0];

                theStoreItem.Quanity = theItemQuantity + theStoreItem.Quanity;

                work.StoreRepository.Update(theStoreItem);
                work.Save();

                Order theOrder = work.OrderRepository.GetByID(theOrderItem.OrderID);
                theOrder.ItemQuantity = theOrder.ItemQuantity - theItemQuantity;
                theOrder.TotalAmount  = theOrder.TotalAmount - theOrderItem.SubTotal;
                //  theOrder.OrderDate = theOrder.OrderDate;

                if (theOrder.ItemQuantity == 0)
                {
                    work.OrderRepository.Delete(theOrder);
                }
                else
                {
                    work.OrderRepository.Update(theOrder);
                }

                work.OrderItemRepository.Delete(theOrderItem);

                string orderNumberString        = theOrderItem.OrderNumber.ToString();
                List <SchoolAccount> theAccount = new List <SchoolAccount>();
                theAccount = work.SchoolAccountRepository.Get(a => a.TransactionMethod == orderNumberString).ToList();

                if (theAccount.Count() > 0)
                {
                    decimal       theAmount             = theOrderItem.SubTotal;
                    SchoolAccount thePaymenttoBeDeleted = new SchoolAccount();
                    thePaymenttoBeDeleted        = theAccount[0];
                    thePaymenttoBeDeleted.Amount = thePaymenttoBeDeleted.Amount - theAmount;
                    if (thePaymenttoBeDeleted.Amount == 0)
                    {
                        work.SchoolAccountRepository.Delete(thePaymenttoBeDeleted);
                    }
                    else
                    {
                        work.SchoolAccountRepository.Update(thePaymenttoBeDeleted);
                    }
                }
                work.Save();
                if (User.Identity.Name != "5000001")
                {
                    AuditTrail audit = new AuditTrail {
                        Date = DateTime.Now, Action = "An Order was reversed, item name:-" + " " + theItemName + " " + "Quntities :- " + theItemQuantity, UserID = User.Identity.Name
                    };
                    work.AuditTrailRepository.Insert(audit);
                    work.Save();
                }
            }
            return(RedirectToAction("Index", "Order"));
            //  return View("Order");
        }