} //End public void Create public void Update(StudentdetailVM poViewModel, HttpPostedFileBase poFileimage = null) { try { using (var db = new DBMAINContext()) { Student oModel = db.Students.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID); //Map Form Data oModel.InjectFrom(poViewModel); //Set Field Header oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE); //Set DTA_STS oModel.DTA_STS = valFLAG.FLAG_DTA_STS_UPDATE; //Set Image file name if (poFileimage != null) { if ((oModel.STUDENT_IMG == null) || (oModel.STUDENT_IMG == "")) { oModel.STUDENT_IMG = Utility_FileUploadDownload.setImage_Student(); } } //End if (poFileimage != null) //Process CRUD db.Entry(oModel).State = EntityState.Modified; db.SaveChanges(); this.ID = oModel.ID; //Save file if (poFileimage != null) { Utility_FileUploadDownload.saveImage_Student(poFileimage, oModel.STUDENT_IMG); } //End if (poFileimage != null) } //End using } //End try catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch } //End public void Update
} //End public StudentCRUD() public void Create(StudentdetailVM poViewModel, HttpPostedFileBase poFileimage = null) { try { using (var db = new DBMAINContext()) { Student oModel = new Student(); //Map Form Data oModel.InjectFrom(poViewModel); //Set Field Header oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE); //Set Image file name if (poFileimage != null) { oModel.STUDENT_IMG = Utility_FileUploadDownload.setImage_Student(); } //End if (poFileimage != null) //Process CRUD db.Students.Add(oModel); db.SaveChanges(); this.ID = oModel.ID; //Save file if (poFileimage != null) { Utility_FileUploadDownload.saveImage_Student(poFileimage, oModel.STUDENT_IMG); } //End if (poFileimage != null) } //End using } //End try catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Create: " + e.Message; } //End catch } //End public void Create
} //End Method public List <StudentdetailVM> getDatalist_filter_active(StudentdetailVM poViewModel, IQueryable <StudentdetailVM> poFieldsToselect = null) { IQueryable <StudentdetailVM> oQRY = null; if (poFieldsToselect != null) { oQRY = poFieldsToselect; } else { oQRY = this.fieldLookup(); } //Siswa aktif saja yang ditampilkan yang sudah pindah dan/atau lulus tidak ditampilkan oQRY = oQRY.Where(fld => ((fld.STUDENTSTS_ID == 1) || (fld.STUDENTSTS_ID == 4))); //Filter input if (poViewModel.CLASSTYPE_ID != null) { oQRY = oQRY.Where(fld => fld.CLASSTYPE_ID == poViewModel.CLASSTYPE_ID); } if (poViewModel.CLASSROOM_ID != null) { oQRY = oQRY.Where(fld => fld.CLASSROOM_ID == poViewModel.CLASSROOM_ID); } return(oQRY.ToList()); } //End Method
} //End Method public List <StudentdetailVM> getDatalist_filter(StudentdetailVM poViewModel, IQueryable <StudentdetailVM> poFieldsToselect = null) { IQueryable <StudentdetailVM> oQRY = null; if (poFieldsToselect != null) { oQRY = poFieldsToselect; } else { oQRY = this.fieldLookup(); } if (poViewModel.CLASSTYPE_ID != null) { oQRY = oQRY.Where(fld => fld.CLASSTYPE_ID == poViewModel.CLASSTYPE_ID); } if (poViewModel.CLASSROOM_ID != null) { oQRY = oQRY.Where(fld => fld.CLASSROOM_ID == poViewModel.CLASSROOM_ID); } if (poViewModel.STUDENTSTS_ID != null) { oQRY = oQRY.Where(fld => fld.STUDENTSTS_ID == poViewModel.STUDENTSTS_ID); } return(oQRY.ToList()); } //End Method
} //End public StudentCRUD() public void Create(StudentdetailVM poViewModel, HttpPostedFileBase poFileimage = null) { try { using (var db = new DBMAINContext()) { using (var edupar = new hlpEduparInfo(poViewModel.REG_DT, poViewModel.CLASSLEVEL_ID, poViewModel.CLASSROOM_ID)) { Student oModel = new Student(); //Map Form Data oModel.InjectFrom(poViewModel); //Set Field Header oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE); //Set DTA_STS oModel.DTA_STS = valFLAG.FLAG_DTA_STS_CREATE; //Set main parameter fields oModel.BRANCH_ID = edupar.DEFBRANCH_ID; oModel.YEAR_ID = edupar.YEAR_ID; oModel.SEMESTER_ID = edupar.SEMESTER_ID; oModel.CLASSLEVEL_ID = oDSClassroom.getData(poViewModel.CLASSROOM_ID).CLASSLEVEL_ID; oModel.CLASSTYPE_ID = oDSClasslevel.getData(oModel.CLASSLEVEL_ID).CLASSTYPE_ID; oModel.CLASSROOM_ID = poViewModel.CLASSROOM_ID; //Set Image file name if (poFileimage != null) { oModel.STUDENT_IMG = Utility_FileUploadDownload.setImage_Student(); } //End if (poFileimage != null) //Process CRUD db.Students.Add(oModel); db.SaveChanges(); this.ID = oModel.ID; //Save file if (poFileimage != null) { Utility_FileUploadDownload.saveImage_Student(poFileimage, oModel.STUDENT_IMG); } //End if (poFileimage != null) } //End using (var edupar = new hlpEduparInfo()) } //End using } //End try catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Create: " + e.Message; } //End catch } //End public void Create
} //End public void executeReport_TUNGGAKAN() //METHOD-CALC private Reportin_tunggakanVM calcTUNGGAKAN (Reportin_tunggakanVM poTUNGGAKAN, StudentdetailVM poSTUDENT, ClassleveldetailVM poCLASSLEVEL, TrintypedetailVM poTRINTYPES) { Boolean isCheck = true; Reportin_tunggakanVM vReturn = new Reportin_tunggakanVM(); vReturn = poTUNGGAKAN; Installment_indetailVM oINST = this.INSTALLMENTS_TUNGGAKAN. Where(fld => fld.INST_TYPEID == poTRINTYPES.ID && fld.STUDENT_ID == poSTUDENT.ID).SingleOrDefault(); //SPP if ((poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_SPP) && (isCheck)) { isCheck = false; //Map Tunggakan vReturn = mapMONTHLY_SPP(poTUNGGAKAN, poCLASSLEVEL, oINST); } //End if (poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_SPP) //EKSKUL if ((poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_EKSKUL) && (isCheck)) { isCheck = false; //Map Tunggakan vReturn = mapMONTHLY_EKSKUL(poTUNGGAKAN, oINST); } //End if (poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_EKSKUL) //SCLUB if ((poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_SCLUB) && (isCheck)) { isCheck = false; //Map Tunggakan vReturn = mapMONTHLY_SCLUB(poTUNGGAKAN, oINST); } //End if (poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_SCLUB) //OTHER if (isCheck) { isCheck = false; //Map Tunggakan vReturn = mapMONTHLY_OTHER(poTUNGGAKAN, oINST); } //End if (isCheck) return(vReturn); } //End private Reportin_tunggakanVM calcTUNGGAKAN(StudentdetailVM poSTUDENT, TrintypedetailVM poTRINTYPES)
} //End private Reportin_tunggakanVM sumTUNGGAKAN(Reportin_tunggakanVM poTUNGGAKAN) //METHOD-MAP-INIT private Reportin_tunggakanVM initMAP(StudentdetailVM poSTUDENT) { Reportin_tunggakanVM vReturn = new Reportin_tunggakanVM(); vReturn.ID = poSTUDENT.ID; vReturn.STUDENT_ID = poSTUDENT.ID; vReturn.NAME = poSTUDENT.NAME; vReturn.NIS = poSTUDENT.NIS; vReturn.TRN_AMOUNT_SPP = 0; vReturn.TRN_AMOUNT_EKSKUL = 0; vReturn.TRN_AMOUNT_MIDGANJIL = 0; vReturn.TRN_AMOUNT_MIDGENAP = 0; vReturn.TRN_AMOUNT_SEMGANJIL = 0; vReturn.TRN_AMOUNT_SEMGENAP = 0; vReturn.TRN_AMOUNT_DU = 0; vReturn.TRN_AMOUNT_UAT = 0; vReturn.TRN_AMOUNT_UPANGKAL = 0; vReturn.TRN_AMOUNT_PRAKERIN = 0; vReturn.TRN_AMOUNT = 0; return(vReturn); } //End private Reportin_tunggakanVM mapMONTHLY(StudentdetailVM poSTUDENT, TrintypedetailVM poTRINTYPES, Installment_indetailVM poINST)
//METHOD public void InjectFromStudentVM(StudentdetailVM poViewModel) { this.STUDENT_NAME = poViewModel.NAME; this.STUDENT_NICKNAME = poViewModel.NICKNAME; this.STUDENT_NIS = poViewModel.NIS; this.STUDENT_NISN = poViewModel.NISN; //ALTERED this.IS_PINDAHAN = poViewModel.IS_PINDAHAN; this.SPP_AMOUNT = poViewModel.SPP_AMOUNT; //Custom this.STUDENT_IMG = poViewModel.STUDENT_IMG; this.STUDENT_CLASSTYPE_ID = poViewModel.CLASSTYPE_ID; this.STUDENT_CLASSTYPE_CODE = poViewModel.CLASSTYPE_CODE; this.STUDENT_CLASSTYPE_SHORTDESC = poViewModel.CLASSTYPE_SHORTDESC; this.STUDENT_CLASSROOM_ID = poViewModel.CLASSROOM_ID; this.STUDENT_CLASSROOM_CODE = poViewModel.CLASSROOM_CODE; this.STUDENT_CLASSROOM_SHORTDESC = poViewModel.CLASSROOM_SHORTDESC; this.STUDENT_CLASSLEVEL_ID = poViewModel.CLASSLEVEL_ID; this.STUDENT_CLASSLEVEL_CODE = poViewModel.CLASSLEVEL_CODE; this.STUDENT_CLASSLEVEL_SHORTDESC = poViewModel.CLASSLEVEL_SHORTDESC; this.STUDENT_CLASSLEVEL_NUM = poViewModel.CLASSLEVEL_NUM; } //End public void InjectFromStudentVM(StudentdetailVM poViewModel)
} //End private Reportin_tunggakanVM mapMONTHLY_OTHER(Reportin_tunggakanVM poTUNGGAKAN, Installment_indetailVM poINST) //METHOD-MAP-OTHER private Reportin_tunggakanVM mapOTHER(StudentdetailVM poSTUDENT, TrintypedetailVM poTRINTYPES, Installment_indetailVM poINST) { Reportin_tunggakanVM vReturn = null; return(vReturn); } //End private Reportin_tunggakanVM mapOTHER(StudentdetailVM poSTUDENT, TrintypedetailVM poTRINTYPES, Installment_indetailVM poINST)
//Constructor 1 public Student_Validation(StudentdetailVM poViewModel) { oViewModel = poViewModel; } //End public Student_Validation()