示例#1
0
        public ActionResult Edit(StudentTransactionVM viewModel)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    Entities.StudentTransaction entity = new Entities.StudentTransaction();
                    entity.StudentTransactionId = viewModel.StudentTransactionId;
                    entity.ClassDivisionId      = viewModel.ClassDivisionId;
                    ClassDivisionBAL classDivisionBAL = new ClassDivisionBAL();
                    entity.ClassDivisionId = classDivisionBAL.FindBy(cd => cd.ClassId == viewModel.ClassId && cd.DivisionId == viewModel.DivisionId).FirstOrDefault().ClassDivisionId;
                    entity.StudentId       = viewModel.StudentId;
                    entity.TransactionDate = viewModel.TransactionDate;
                    entity.Status          = viewModel.Status;
                    entity.Remark          = viewModel.Remark;


                    StudentTransactionBAL balObject = new StudentTransactionBAL();
                    balObject.Edit(entity);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(viewModel));
                }
            }
            catch
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult Index()
        {
            List <StudentTransactionVM> viewModels           = new List <StudentTransactionVM>();
            StudentTransactionBAL       balObject            = new StudentTransactionBAL();
            IQueryable <Entities.StudentTransaction> entites = balObject.GetAll(SessionHelper.SchoolId);

            foreach (Entities.StudentTransaction entity in entites)
            {
                StudentTransactionVM viewModel = new StudentTransactionVM();
                viewModel.StudentTransactionId = entity.StudentTransactionId;

                viewModel.ClassDivisionId = entity.ClassDivisionId;

                viewModel.ClassId      = entity.ClassId;
                viewModel.DivisionId   = entity.DivisionId;
                viewModel.ClassName    = entity.ClassName;
                viewModel.DivisionName = entity.DivisionName;
                viewModel.StudentId    = entity.StudentId;

                viewModel.StudentFullNameWithTitle = entity.StudentFullNameWithTitle;
                viewModel.TransactionDate          = entity.TransactionDate;
                viewModel.Status       = entity.Status;
                viewModel.Remark       = entity.Remark;
                viewModel.ReceiptNo    = entity.ReceiptNo;
                viewModel.ReceiptTotal = entity.ReceiptTotal;
                viewModel.BankName     = entity.BankName;
                viewModel.ChequeNumber = entity.ChequeNumber;
                viewModels.Add(viewModel);
            }

            return(View(new GridModel <StudentTransactionVM> {
                Data = viewModels
            }));
        }
示例#3
0
        //
        // GET: /SysAdmin/Division/Create
        public ActionResult Create()
        {
            StudentTransactionVM viewModel = new StudentTransactionVM();
            ClassBAL             classBAL  = new ClassBAL();

            viewModel.Classes = from obj in classBAL.GetAll() where obj.Status == true select new SelectListItem()
            {
                Text = obj.ClassName, Value = obj.ClassId.ToString()
            };


            viewModel.Status = true;
            return(View(viewModel));
        }
示例#4
0
        public ActionResult Select()
        {
            string mode = Request.QueryString["Grid-mode"];

            if (!string.IsNullOrEmpty(mode))
            {
                return(this.RedirectToAction("Create"));
            }
            else
            {
                List <StudentTransactionVM> viewModels           = new List <StudentTransactionVM>();
                StudentTransactionBAL       balObject            = new StudentTransactionBAL();
                IQueryable <Entities.StudentTransaction> entites = balObject.GetAll(SessionHelper.SchoolId);

                foreach (Entities.StudentTransaction entity in entites)
                {
                    StudentTransactionVM viewModel = new StudentTransactionVM();
                    viewModel.StudentTransactionId = entity.StudentTransactionId;

                    viewModel.ClassDivisionId = entity.ClassDivisionId;

                    viewModel.ClassId      = entity.ClassId;
                    viewModel.DivisionId   = entity.DivisionId;
                    viewModel.ClassName    = entity.ClassName;
                    viewModel.DivisionName = entity.DivisionName;
                    viewModel.StudentId    = entity.StudentId;

                    viewModel.StudentFullNameWithTitle = entity.StudentFullNameWithTitle;
                    viewModel.TransactionDate          = entity.TransactionDate;
                    viewModel.Status       = entity.Status;
                    viewModel.Remark       = entity.Remark;
                    viewModel.ReceiptNo    = entity.ReceiptNo;
                    viewModel.ReceiptTotal = entity.ReceiptTotal;
                    viewModel.BankName     = entity.BankName;
                    viewModel.ChequeNumber = entity.ChequeNumber;
                    viewModels.Add(viewModel);
                }
                return(this.View("Index", new GridModel <StudentTransactionVM> {
                    Data = viewModels
                }));
            }
        }
示例#5
0
        //
        // GET: /SysAdmin/Division/Details/5
        public ActionResult Details(int id)
        {
            StudentTransactionVM viewModel = new StudentTransactionVM();

            return(View(viewModel));
        }
示例#6
0
        public ActionResult Create(FormCollection formCollection)
        {
            StudentTransactionVM viewModel = new StudentTransactionVM();

            try
            {
                if (formCollection["ReceiptNo"] != null)
                {
                    viewModel.ReceiptNo = Convert.ToInt32(formCollection["ReceiptNo"]);
                }
                if (formCollection["StudentTransactionId"] != null && formCollection["StudentTransactionId"] != "")
                {
                    viewModel.StudentTransactionId = Convert.ToInt32(formCollection["StudentTransactionId"]);
                }

                if (formCollection["ClassId"] != null && formCollection["ClassId"] != "")
                {
                    viewModel.ClassId = Convert.ToInt32(formCollection["ClassId"]);
                }
                if (formCollection["DivisionId"] != null && formCollection["DivisionId"] != "")
                {
                    viewModel.DivisionId = Convert.ToInt32(formCollection["DivisionId"]);
                }
                if (formCollection["StudentId"] != null && formCollection["StudentId"] != "")
                {
                    viewModel.StudentId = Convert.ToInt32(formCollection["StudentId"]);
                }
                if (formCollection["TransactionDate"] != null)
                {
                    viewModel.TransactionDate = Convert.ToDateTime(formCollection["TransactionDate"]);
                }
                viewModel.Remark = Convert.ToString(formCollection["Remark"]);
                if (formCollection["ReceiptTotal"] != null && formCollection["ReceiptTotal"] != "")
                {
                    viewModel.ReceiptTotal = Convert.ToDecimal(formCollection["ReceiptTotal"]);
                }
                viewModel.BankName     = Convert.ToString(formCollection["BankName"]);
                viewModel.ChequeNumber = Convert.ToString(formCollection["ChequeNumber"]);
                TryUpdateModel <StudentTransactionVM>(viewModel);
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    Entities.StudentTransaction entity = new Entities.StudentTransaction();
                    if (formCollection["ReceiptNo"] != null)
                    {
                        entity.ReceiptNo = Convert.ToInt32(formCollection["ReceiptNo"]);
                    }
                    if (formCollection["StudentTransactionId"] != null && formCollection["StudentTransactionId"] != "")
                    {
                        entity.StudentTransactionId = Convert.ToInt32(formCollection["StudentTransactionId"]);
                    }

                    if (formCollection["ClassId"] != null && formCollection["ClassId"] != "" && formCollection["DivisionId"] != null && formCollection["DivisionId"] != "")
                    {
                        ClassDivisionBAL classDivisionBAL = new ClassDivisionBAL();
                        entity.ClassDivisionId = classDivisionBAL.FindBy(cd => cd.ClassId == Convert.ToInt32(formCollection["ClassId"]) && cd.DivisionId == Convert.ToInt32(formCollection["DivisionId"])).FirstOrDefault().ClassDivisionId;
                    }
                    if (formCollection["StudentId"] != null && formCollection["StudentId"] != "")
                    {
                        entity.StudentId = Convert.ToInt32(formCollection["StudentId"]);
                    }
                    if (formCollection["TransactionDate"] != null)
                    {
                        entity.TransactionDate = Convert.ToDateTime(formCollection["TransactionDate"]);
                    }
                    entity.Status = true;
                    entity.Remark = Convert.ToString(formCollection["Remark"]);
                    if (formCollection["ReceiptTotal"] != null && formCollection["ReceiptTotal"] != "")
                    {
                        entity.ReceiptTotal = Convert.ToDecimal(formCollection["ReceiptTotal"]);
                    }
                    entity.BankName     = Convert.ToString(formCollection["BankName"]);
                    entity.ChequeNumber = Convert.ToString(formCollection["ChequeNumber"]);
                    entity.StudentTransactionSubList = new List <Entities.StudentTransactionSub>();
                    //item.StudentTransactionId
                    string itemFeeId   = Convert.ToString(formCollection["item.FeeHeadId"]);
                    string itemCr      = Convert.ToString(formCollection["item.Cr"]);
                    string itemDr      = Convert.ToString(formCollection["item.Dr"]);
                    string itemBalance = Convert.ToString(formCollection["item.Balance"]);

                    if (!string.IsNullOrEmpty(itemFeeId))
                    {
                        string[] strArrFeeId   = itemFeeId.Split(',');
                        string[] strArrCr      = itemCr.Split(',');
                        string[] strArrDr      = itemDr.Split(',');
                        string[] strArrBalance = itemBalance.Split(',');
                        if (itemFeeId.Length > 0)
                        {
                            for (int i = 0; i < strArrFeeId.Length; i++)
                            {
                                Entities.StudentTransactionSub entitySub = new Entities.StudentTransactionSub();
                                entitySub.FeeHeadId = Convert.ToInt32(strArrFeeId[i]);
                                entitySub.Cr        = Convert.ToDecimal(strArrCr[i]);
                                entitySub.Dr        = Convert.ToDecimal(strArrDr[i]);
                                entitySub.Balance   = Convert.ToDecimal(strArrBalance[i]);
                                entity.StudentTransactionSubList.Add(entitySub);
                            }
                        }
                    }

                    StudentTransactionBAL balObject = new StudentTransactionBAL();
                    balObject.Add(entity, SessionHelper.SchoolId);
                    PresentationLayer.Helpers.SessionHelper.ReportIndex = 2;
                    return(Redirect(@"~\Report.aspx"));
                    //return RedirectToAction("Index");
                }
                else
                {
                    ClassBAL classBAL = new ClassBAL();
                    viewModel.Classes = from obj in classBAL.GetAll() where obj.Status == true select new SelectListItem()
                    {
                        Text = obj.ClassName, Value = obj.ClassId.ToString()
                    };

                    return(View(viewModel));
                }
            }
            catch
            {
                ClassBAL classBAL = new ClassBAL();
                viewModel.Classes = from obj in classBAL.GetAll() where obj.Status == true select new SelectListItem()
                {
                    Text = obj.ClassName, Value = obj.ClassId.ToString()
                };

                return(View(viewModel));
            }
        }