protected void lstBorrow_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); SchoolInformation info = new SchoolInformation(); var schoolId = info.getId(); var semesterId = MyDate.getCurrentSemesterId(); ltrSecretaryLearningResourceCenter.Text = info.getLearningResources(); var preInfo = (from k in km.BorrowsofEmployees join ee in km.Employees on k.EmployeeId equals ee.IdentityNumber where k.SchoolId == schoolId && k.SemesterId == semesterId orderby k.DateReturn, k.DateBorrow select new { ee.Name, k.DateReturn, k.DateBorrow, k.BookId, auther = (from b in km.Books where b.Id == k.BookId select b.Auther).FirstOrDefault(), bookname = (from b in km.Books where b.Id == k.BookId select b.Title).FirstOrDefault(), k.isReturn }).ToList(); lstBorrow.DataSource = preInfo; lstBorrow.DataBind(); }
protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e) { try { MembershipUser mu = Membership.GetUser(Login1.UserName); if (mu != null) { if (Roles.GetRolesForUser(Login1.UserName).Contains("Admin")) { ((Literal)Login1.FindControl("FailureText")).Text = "هذا الحساب غير فعال"; e.Cancel = true; return; } OnlineSchoolEntities km = new OnlineSchoolEntities(); var emp = (from k in km.Employees where k.IdentityNumber.Trim() == mu.UserName select k).FirstOrDefault(); var userSchool = (from k in km.Schools where k.Id == emp.SchoolId select k).FirstOrDefault(); if (userSchool != null && userSchool.IsActive == false) { ((Literal)Login1.FindControl("FailureText")).Text = "تم ايقاف اشتراك المدرسة"; e.Cancel = true; } } }catch (Exception exx) { ((Literal)Login1.FindControl("FailureText")).Text = "هذا الحساب غير فعال"; e.Cancel = true; } }
protected void btnAdd_Click(object sender, EventArgs e) { var idd = int.Parse(Request.QueryString["id"]); var period = int.Parse(ddlClassNumber.SelectedValue); OnlineSchoolEntities km = new OnlineSchoolEntities(); var wait = new EmployeeWaiting(); var Exist = (from k in km.EmployeeWaitings where k.AbsenceId == idd && k.Period == period select k).FirstOrDefault(); if (Exist != null) { wait = Exist; } wait.Period = int.Parse(ddlClassNumber.SelectedValue); wait.ClassRoom = txtClass.Text; wait.Do = txtDo.Text; wait.EmployeeId = ddlEmployee.SelectedValue; wait.Comment = txtComments.Text; wait.AbsenceId = idd; wait.Subject = txtSubject.Text; if (Exist == null) { km.EmployeeWaitings.Add(wait); } km.SaveChanges(); LstClass.DataBind(); }
protected void LstOutcoming_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var schoolId = new SchoolInformation().getId(); int semesterId = MyDate.getCurrentSemesterId(); var Outcoming = (from O in km.Outcomings where O.IsDeleted != true && O.ReceivedDate != null && O.SemesterId == semesterId && O.SchoolId == schoolId select new { O.Number, O.Date, O.Type, O.Attachment, O.Subject, O.SourceTo, O.ReceivedName, O.ReceivedDate, O.Id, }).ToList(); LstOutcoming.DataSource = Outcoming; LstOutcoming.DataBind(); }
protected void lstBorrow_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); SchoolInformation info = new SchoolInformation(); ltrYear.Text = " " + (from k in km.Semesters where k.IsCurrent == true select k.YearH).FirstOrDefault().ToString(); ltrSemester.Text = " " + MyDate.getCurrentSemester(); ltrSecretaryResourceCenter.Text = info.getLearningResources(); var schoolId = info.getId(); var semesterId = MyDate.getCurrentSemesterId(); // var LibrarianId = info.getSchoolLibrarian(); var preInfo = (from k in km.BorrowsofStudents join ss in km.Students on k.StudentId equals ss.IdentityNumber where k.SchoolId == schoolId && k.SemesterId == semesterId orderby k.DateBorrow select new { ss.Name, k.DateReturn, k.DateBorrow, k.BookId, ss.Class, auther = (from b in km.Books where b.Id == k.BookId select b.Auther).FirstOrDefault(), bookname = (from b in km.Books where b.Id == k.BookId select b.Title).FirstOrDefault(), k.isReturn }).ToList(); lstBorrow.DataSource = preInfo; }
protected void lstPatients_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var schoolId = new SchoolInformation().getId(); int semesterId = MyDate.getCurrentSemesterId(); var RepInfo = (from ep in km.StudentPatients join ee in km.Students on ep.StudentId equals ee.IdentityNumber where ep.SemesterId == semesterId && ep.SchoolId == schoolId orderby ep.Class descending select new { ee.Name, ep.Action, ep.Class, ep.Description, ep.HomeTel, ep.Id, ep.Mobile, ep.Recommendations, ep.WorkTel, }).ToList(); lstPatients.DataSource = RepInfo; lstPatients.DataBind(); }
protected void LstOutcoming_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var schoolId = new SchoolInformation().getId(); var semesterId = MyDate.getCurrentSemesterId(); var Outcoming = (from I in km.Outcomings join p in km.Schools on I.SchoolId equals p.Id where I.SchoolId == schoolId && I.IsDeleted != true && I.SemesterId == semesterId orderby I.Id descending select new { I.Date, I.Number, I.FileNumber, SourceTo = (from c in km.Constants where c.Id == I.SourceTo select c.value).FirstOrDefault(), I.Subject, Type = (from c in km.Constants where c.Id == I.Type select c.value).FirstOrDefault(), Attachment = (from c in km.Constants where c.Id == I.Type select c.value).FirstOrDefault(), I.Id, }).ToList(); LstOutcoming.DataSource = Outcoming; LstOutcoming.DataBind(); }
protected void LstEmployee_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var schoolId = new SchoolInformation().getId(); var semesterId = MyDate.getCurrentSemesterId(); var isSeen = (from m in km.UsersGeneralizations select m.isSeen).FirstOrDefault(); string IsSeenn; if (isSeen == false) { IsSeenn = "لا"; } else { IsSeenn = "نعم"; } var emp = (from k in km.UsersGeneralizations select new { IsSeenn, EmployeeName = (from m in km.Employees where m.IdentityNumber == k.UserId select m.Name).FirstOrDefault() }).ToList(); LstEmployee.DataSource = emp; LstEmployee.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); Week week = (from k in km.Weeks where k.Id == 1 select k).FirstOrDefault(); // week.startDate = Convert.ToDateTime(txtStartDate.Text); if (MyDate.getDateCulture() == "ar-EG") { week.startDate = DateTime.ParseExact(txtStartDate.Text, "yyyy/MM/dd", new CultureInfo("ar-EG")); } else { week.startDate = MyDate.convertHijriToGregorian(txtStartDate.Text); } for (int i = 2; i <= 21; ++i) { var lblname = "lblDateWeek" + (i); Label lbl = (Label)Panel2.FindControl(lblname); DropDownList ddl = (DropDownList)Panel2.FindControl("DropDownList" + i); week = (from k in km.Weeks where k.Id == i select k).FirstOrDefault(); if (MyDate.getDateCulture() == "ar-EG") { week.startDate = DateTime.ParseExact(lbl.Text, "yyyy/MM/dd", new CultureInfo("ar-EG")); } else { week.startDate = MyDate.convertHijriToGregorian(lbl.Text); } week.type = int.Parse(ddl.SelectedValue); } km.SaveChanges(); }
protected void btnSaveActivity_Click(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); SchoolInformation info = new SchoolInformation(); Schedual activity = new Schedual(); activity.type = int.Parse(ddlActivity.SelectedValue); activity.Name = txtActivityName.Text; activity.Time = Convert.ToDateTime(txtActivityTime.Text).TimeOfDay; activity.Period = new TimeSpan(0, int.Parse(txtPeriod.Text), 0); activity.SchoolId = info.getId(); km.Scheduals.Add(activity); km.SaveChanges(); lstActive.DataBind(); // lblmsg.Text = "تم اضافة النشاط"; lstActive.DataBind(); var nxt = activity.Time + activity.Period; txtActivityTime.Text = Convert.ToDateTime(nxt.ToString()).ToString("mm:ss tt"); txtActivityName.Text = ""; txtPeriod.Text = ""; ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "openModal", "<script> addSuccess(' تمت اضافة النشاط بنجاح'); </script>", false); }
protected void Page_Load(object sender, EventArgs e) { SchoolInformation info = new SchoolInformation(); var schoolid = info.getId(); var semesterid = MyDate.getCurrentSemesterId(); OnlineSchoolEntities km = new OnlineSchoolEntities(); var studentlist = (from k in km.StudentsSubjects join s in km.SubjectsInSemesters on k.SubjectId equals s.Id join x in km.Students on k.StudentId equals x.IdentityNumber where s.SchoolId == schoolid && s.SemesterId == semesterid orderby x.Name select new { stdId = x.Id, Name = x.Name, x.IdentityNumber, subject = (from m in km.Subjects where m.Id == s.SubjectId select m.Name).FirstOrDefault(), rate = k.Rate } ).ToList(); ListView1.DataSource = studentlist; ListView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["id"] != null) { var idd = int.Parse(Request.QueryString["id"]); SchoolInformation info = new SchoolInformation(); var schoolid = info.getId(); OnlineSchoolEntities km = new OnlineSchoolEntities(); var absent = (from k in km.Absences where k.Id == idd select k).FirstOrDefault(); lblDate.Text = MyDate.getDate(absent.Date + ""); lblEmpName.Text = (from k in km.Employees where k.IdentityNumber == absent.EmployeeId select k.Name).FirstOrDefault(); var lstEmployee = (from k in km.Teachers where k.IdentityNumber != absent.EmployeeId && k.SchoolId == schoolid select k).ToList(); ddlEmployee.DataSource = lstEmployee; ddlEmployee.DataBind(); LstClass.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { var idd = int.Parse(Request.QueryString["id"]); OnlineSchoolEntities km = new OnlineSchoolEntities(); SchoolInformation info = new SchoolInformation(); var absentalert = (from k in km.AbsenceAlerts where k.Id == idd select k).FirstOrDefault(); ltrSchoolName.Text = info.getName(); var emp = (from k in km.Employees where k.IdentityNumber == absentalert.EmployeeId select k).FirstOrDefault(); ltrName.Text = emp.Name; ltrTeacherName.Text = emp.Name; ltrTeacherName2.Text = emp.Name; ltrCivilRegistry10.Text = emp.IdentityNumber.ElementAt(0).ToString(); ltrCivilRegistry9.Text = emp.IdentityNumber.ElementAt(1).ToString(); ltrCivilRegistry8.Text = emp.IdentityNumber.ElementAt(2).ToString(); ltrCivilRegistry7.Text = emp.IdentityNumber.ElementAt(3).ToString(); ltrCivilRegistry6.Text = emp.IdentityNumber.ElementAt(4).ToString(); ltrCivilRegistry5.Text = emp.IdentityNumber.ElementAt(5).ToString(); ltrCivilRegistry4.Text = emp.IdentityNumber.ElementAt(6).ToString(); ltrCivilRegistry3.Text = emp.IdentityNumber.ElementAt(7).ToString(); ltrCivilRegistry2.Text = emp.IdentityNumber.ElementAt(8).ToString(); ltrCivilRegistry1.Text = emp.IdentityNumber.ElementAt(9).ToString(); ltrSpecialization.Text = emp.Specification; ltrJobNo.Text = emp.JobNumber; ltrGrade.Text = emp.Level; ltrCommander.Text = EmployeeManager.getDirectManager(emp.IdentityNumber); ltrCommanderName.Text = info.getSchoolManager(); ltrCommanderDate.Text = MyDate.getDate(); ltrCurrentWork.Text = (from k in km.Jobs where k.Id == emp.JobId select k.Name).FirstOrDefault(); ltrClass.Text = emp.Degree; var DateFrom = (DateTime)absentalert.DateFrom; var DateTo = (DateTime)absentalert.DateTo; ltrDayFrom.Text = " " + MyDate.getDay(DateFrom) + " "; ltrDayTo.Text = " " + MyDate.getDay(DateTo) + " "; ltrDateTo.Text = " " + DateTo.Date.ToString("yyyy/MM/dd") + " "; ltrDateFrom.Text = " " + DateFrom.Date.ToString("yyyy/MM/dd") + " "; bool count = Convert.ToBoolean(Request.QueryString["count"]); if (count) { ltrNoAbsenceDay.Text = absentalert.count + absentalert.countHoliday + ""; } else { ltrNoAbsenceDay.Text = absentalert.count + ""; } } }
protected void ListView1_DataBinding(object sender, EventArgs e) { SchoolInformation info = new SchoolInformation(); var schoolid = info.getId(); OnlineSchoolEntities km = new OnlineSchoolEntities(); var Studentlist = (from k in km.Students where k.SchoolId == schoolid select k).ToList(); ListView1.DataSource = Studentlist; }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { SchoolInformation info = new SchoolInformation(); OnlineSchoolEntities km = new OnlineSchoolEntities(); if (Request.QueryString["id"] != null) { int idd = int.Parse(Request.QueryString["id"]); var schoolId = info.getId(); ltrSchoolName.Text = info.getName(); Employee emp = new Employee(); var late = (from k in km.LatenessDecisions where k.Id == idd select k).FirstOrDefault(); emp = (from k in km.Employees where k.IdentityNumber == late.EmployeeId select k).FirstOrDefault(); ltrCivilRegistry10.Text = emp.IdentityNumber.ElementAt(0).ToString(); ltrCivilRegistry9.Text = emp.IdentityNumber.ElementAt(1).ToString(); ltrCivilRegistry8.Text = emp.IdentityNumber.ElementAt(2).ToString(); ltrCivilRegistry7.Text = emp.IdentityNumber.ElementAt(3).ToString(); ltrCivilRegistry6.Text = emp.IdentityNumber.ElementAt(4).ToString(); ltrCivilRegistry5.Text = emp.IdentityNumber.ElementAt(5).ToString(); ltrCivilRegistry4.Text = emp.IdentityNumber.ElementAt(6).ToString(); ltrCivilRegistry3.Text = emp.IdentityNumber.ElementAt(7).ToString(); ltrCivilRegistry2.Text = emp.IdentityNumber.ElementAt(8).ToString(); ltrCivilRegistry1.Text = emp.IdentityNumber.ElementAt(9).ToString(); ltrName.Text = emp.Name; ltrSpecialization.Text = emp.Specification; ltrGrade.Text = emp.Level; ltrJobNo.Text = emp.JobNumber; ltrCurrentWork.Text = (from k in km.Jobs where k.Id == emp.JobId select k.Name).FirstOrDefault(); ltrCommanderName.Text = info.getSchoolManager(); ltrNumberHours.Text = late.Hours + ""; ltrNumberDays.Text = late.Days + ""; ltrManagerr.Text = info.getSchoolManager(); ltrDate.Text = MyDate.getDate(); //#endregion //ltrIdentityNumber.Text = emp.IdentityNumber; //ltrTeacherName.Text = emp.Name; //ltrTeacherName2.Text = emp.Name; //ltrSchoolCommander.Text = info.getSchoolManager(); //ltrSchoolCommander2.Text = info.getSchoolManager(); //ltrCommanderDate.Text = MyDate.getDate(); } } }
protected void lnkDownload_Click(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); int idd = int.Parse(Request.QueryString["id"].ToString()); var file = (from k in km.Incomings where k.Id == idd select k.FileLocation).FirstOrDefault(); if (file != null) { var extention = file.Split('.').Last(); Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; filename=" + Guid.NewGuid() + "." + extention); Response.TransmitFile("~/" + file); Response.End(); } }
protected void lstConstants_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); SchoolInformation info = new SchoolInformation(); var schoolId = info.getId(); var type = int.Parse(ddlConstansType.SelectedValue); var lst = (from k in km.Constants where k.type == type && k.isDeleted == false && k.SchoolId == schoolId select k).ToList(); if (type == 3) { var lst2 = (from k in km.Constants where k.type == type && k.isDeleted == false && k.SchoolId == null select k).ToList(); lst = lst.Concat(lst2).ToList(); } lstConstants.DataSource = lst; }
protected void LstIncoming_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "btnDelete") { int id = int.Parse(e.CommandArgument.ToString()); var c = (from k in km.Incomings where k.Id == id select k).FirstOrDefault(); c.IsDeleted = true; km.SaveChanges(); LstIncoming.DataBind(); } else if (e.CommandName == "btnEdit") { Response.Redirect("IncomingAdd.aspx?id=" + e.CommandArgument); } else if (e.CommandName == "btnDetails") { Response.Redirect("IncomingDetails.aspx?id=" + e.CommandArgument); } else if (e.CommandName == "DisplayEMployee") { //HiddenField IncomingId = (HiddenField)dataItem.FindControl("HiddenField1"); Response.Redirect("UsersGeneralizaionDisplay.aspx?IncomingId=" + e.CommandArgument); } else if (e.CommandName == "download") { OnlineSchoolEntities km = new OnlineSchoolEntities(); int idd = int.Parse(e.CommandArgument.ToString()); var file = (from k in km.Incomings where k.Id == idd select k.FileLocation).FirstOrDefault(); if (file != null) { var extention = file.Split('.').Last(); Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; filename=" + Guid.NewGuid() + "." + extention); Response.TransmitFile("~/" + file); Response.End(); } else { PlaceHolderSuccess.Visible = true; } } }
protected void GridView1_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var schoolId = new SchoolInformation().getId(); var users = (from k in km.Employees join u in km.aspnet_Users on k.IdentityNumber equals u.UserName where k.SchoolId == schoolId && u.aspnet_Roles.Count != 0 orderby k.Name select new { k.Name, u.UserId, u.UserName }).ToList(); GridView1.DataSource = users; }
protected void lstRecord_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var schoolId = new SchoolInformation().getId(); int semesterId = MyDate.getCurrentSemesterId(); var RepInfo = (from ep in km.Materials where ep.SchoolId == schoolId && ep.SemesterId == semesterId select new { ep.Id, ep.KindId, ep.KindName, ep.Quantity, ep.Comments }).ToList(); lstRecord.DataSource = RepInfo; }
protected void lstEmployee_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); SchoolInformation info = new SchoolInformation(); var schoolid = info.getId(); var lst = (from k in km.Employees where k.SchoolId == schoolid select new { k.IdentityNumber, k.Name, job = k.Job.Name, k.PhoneHome, k.Mobile, k.Degree, k.Specification, k.Email }).ToList(); lstEmployee.DataSource = lst; }
protected void lstlaboratoriesInventory_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var schoolId = new SchoolInformation().getId(); int semesterId = MyDate.getCurrentSemesterId(); var RepInfo = (from k in km.LaboratoriesInventories where k.SchoolId == schoolId && k.SemesterId == semesterId select new { k.Id, k.Increase, k.ValidCount, k.KindId, k.KindName, k.ObligatedCount, k.Unit, k.NotValidCount }).ToList(); lstlaboratoriesInventory.DataSource = RepInfo; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FillDropEmp(); if (Request.QueryString["id"] != null) { var idd = int.Parse(Request.QueryString["id"]); SchoolInformation info = new SchoolInformation(); var schoolid = info.getId(); OnlineSchoolEntities km = new OnlineSchoolEntities(); var permission = (from k in km.Permissions where k.Id == idd select k).FirstOrDefault(); lblDate.Text = MyDate.getDate(permission.Date + ""); lblEmpName.Text = (from k in km.Employees where k.IdentityNumber == permission.EmployeeId select k.Name).FirstOrDefault(); lblFrom.Text = permission.TimeFrom.ToString(); lblTo.Text = permission.TimeTo.ToString(); ltrReason.Text = permission.Reason; //ddlEmpName.SelectedValue= permission.EmployeeId; var lstEmployee = (from k in km.Employees where k.IdentityNumber != permission.EmployeeId && k.SchoolId == schoolid select k).ToList(); ddlEmployee.DataSource = lstEmployee; ddlEmployee.DataBind(); LstClass.DataBind(); } else { txtReson.Visible = true; Label6.Visible = false; Label10.Visible = false; Label1.Visible = false; ddlEmpName.Visible = true; } } }
protected void lstObligation_DataBinding(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var schoolId = new SchoolInformation().getId(); int semesterId = MyDate.getCurrentSemesterId(); var oblg = (from d in km.Obligations where d.SemesterId == semesterId && d.SchoolId == schoolId select new { d.Id, d.KindName, d.Count, d.DateReceive, d.DateReturn, d.Comments, d.IsReturn, d.IsReceived, EmployeeName = (from a in km.Employees where a.IdentityNumber == d.EmployeeId select a.Name).FirstOrDefault(), Job = (from j in km.Jobs join v in km.Employees on j.Id equals v.JobId where v.IdentityNumber == d.EmployeeId select j.Name).FirstOrDefault() }).ToList(); lstObligation.DataSource = oblg; }
protected void Page_Load(object sender, EventArgs e) { SchoolInformation info = new SchoolInformation(); OnlineSchoolEntities km = new OnlineSchoolEntities(); if (Request.QueryString["id"] != null) { int idd = int.Parse(Request.QueryString["id"]); var schoolId = info.getId(); ltrSchoolName.Text = info.getName(); Employee emp = new Employee(); #region var late = (from k in km.Latenesses where k.Id == idd select k).FirstOrDefault(); emp = (from k in km.Employees where k.IdentityNumber == late.EmployeeId select k).FirstOrDefault(); if (late.Type == (ConstantManager.getConstantId("تأخر صباحي"))) { PlaceHolderLateBegin.Visible = true; TimeSpan amount = (TimeSpan)late.Amount; TimeSpan timestartwork = (TimeSpan)(from k in km.Schools where k.Id == schoolId select k.TimeStartWork).FirstOrDefault(); TimeSpan timearrive = amount + timestartwork; ltrTimeArrive.Text = timearrive.ToString(); } if (late.Type == (ConstantManager.getConstantId("انصراف مبكر"))) { PlaceHolderLateEnd.Visible = true; TimeSpan amount = (TimeSpan)late.Amount; TimeSpan timeEnd = (TimeSpan)(from k in km.Schools where k.Id == schoolId select k.TimeEndWork).FirstOrDefault(); TimeSpan timeleave = timeEnd - amount; ltrTimeLeave.Text = timeleave.ToString(); } if (late.Type == (ConstantManager.getConstantId("خروج دون استئذان"))) { PlaceHolderPermission.Visible = true; ltrTimeFrom.Text = late.TimeFrom.ToString(); ltrTimeTo.Text = late.Timeto.ToString(); } ltrDay.Text = MyDate.getDay((DateTime)late.Date); ltrDate.Text = MyDate.getDate(late.Date.ToString()); #endregion ltrIdentityNumber.Text = emp.IdentityNumber; ltrName.Text = emp.Name; ltrTeacherName.Text = emp.Name; ltrTeacherName2.Text = emp.Name; ltrSpecialization.Text = emp.Specification; ltrGrade.Text = emp.Level; ltrJobNo.Text = emp.JobNumber; ltrCurrentWork.Text = (from k in km.Jobs where k.Id == emp.JobId select k.Name).FirstOrDefault(); ltrCommanderName.Text = info.getSchoolManager(); ltrSchoolCommander.Text = info.getSchoolManager(); ltrSchoolCommander2.Text = info.getSchoolManager(); ltrCommanderDate.Text = MyDate.getDate(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var yearH = (from k in km.Semesters orderby k.Id descending select k.YearH).FirstOrDefault(); txtYear.Text = yearH + "-" + (yearH + 1) + " هـ "; var yearM = (from k in km.Semesters orderby k.Id descending select k.YearM).FirstOrDefault(); txtYearM.Text = yearM + "-" + (yearM + 1) + " م "; DDLSemester.SelectedValue = MyDate.getCurrentSemesterNumber().ToString(); ddlSemesters.SelectedValue = MyDate.getCurrentSemesterNumber().ToString(); ddlYear.SelectedValue = txtYear.Text; Calendar1.DataBind(); Calendar2.DataBind(); Calendar3.DataBind(); var start = MyDate.getCurrentSemesteStartDate().Split(' ').FirstOrDefault(); if (start != null) { txtStart.Text = start; } var culture = MyDate.getDateCulture(); if (culture == "ar-EG") { radioDate.SelectedValue = "False"; } else { radioDate.SelectedValue = "True"; } lstSemesters.DataBind(); ddlYear.DataBind(); var end = MyDate.getCurrentSemesteEndDate(); if (end != null) { txtEnd.Text = end; } Week week = (from k in km.Weeks where k.Id == 1 select k).FirstOrDefault(); txtStartDate.Text = MyDate.getDate(week.startDate.ToString()); for (int i = 2; i <= 21; ++i) { var lblname = "lblDateWeek" + (i); Label lbl = (Label)Panel2.FindControl(lblname); DropDownList ddl = (DropDownList)Panel2.FindControl("DropDownList" + i); ddl.DataBind(); week = (from k in km.Weeks where k.Id == i select k).FirstOrDefault(); lbl.Text = MyDate.getDate(week.startDate.ToString()); ddl.SelectedValue = week.type.ToString(); } } if (Request.QueryString["Date"] == "Ok") { ClientScript.RegisterStartupScript(this.GetType(), "openModal", "<script> addSuccess(' تم تعديل التاريخ بنجاح'); </script>", false); } }
protected void btnAdd_Click(object sender, EventArgs e) { int SchoolID = info.getId(); if (btnAdd.Text == "تسجيل الوارد") { Incoming inc = new Incoming(); inc.Number = txtIncomingID.Text; // inc.Date = Convert.ToDateTime(txtDate.Text); if (Calendar1.CultureName == "ar-SA") { inc.Date = MyDate.convertHijriToGregorian(txtDate.Text); } else { inc.Date = Convert.ToDateTime(txtDate.Text); } inc.Source = int.Parse(ddlFrom.SelectedValue); inc.Subject = txtSubject.Text; inc.SemesterId = MyDate.getCurrentSemesterId(); inc.FileNumber = txtFileNumber.Text; inc.SchoolId = SchoolID; inc.Type = int.Parse(ddlType.SelectedValue); inc.Attachment = int.Parse(ddlFileAttach.SelectedValue); inc.IsDeleted = false; var fileLocation = pdfFrame.Attributes["src"]; ose.Incomings.Add(inc); ose.SaveChanges(); if (!String.IsNullOrEmpty(fileLocation)) { inc.FileLocation = fileLocation.Substring(2, fileLocation.Length - 2); var path = MapPath("~/"); Document pdfDocument = new Document(path + "testImage.pdf"); Resolution resolution = new Resolution(300); JpegDevice jpegDevice = new JpegDevice(resolution, 100); var x = pdfDocument.Pages.Count; for (int i = 1; i <= x; ++i) { string filename = "images/Incomings/" + Guid.NewGuid() + ".jpg"; jpegDevice.Process(pdfDocument.Pages[i], path + filename); IncomingsImage img = new IncomingsImage(); img.IncomingId = inc.Id; img.Image = filename; ose.IncomingsImages.Add(img); } } ose.SaveChanges(); /******************************************************************************************************************/ List <Employee> empLst = new List <Employee>(); OnlineSchoolEntities km = new OnlineSchoolEntities(); if (RadioType.SelectedValue == "1") { empLst = (from k in km.Employees where k.SchoolId == SchoolID select k).ToList(); } else if (RadioType.SelectedValue == "2") { foreach (ListViewItem item in LstJopEmployees.Items) { CheckBox che = (CheckBox)item.FindControl("chkRow"); if (che.Checked) { var jobid = int.Parse(((HiddenField)item.FindControl("HiddenField2")).Value); foreach (var emp in km.Employees) { if (emp.JobId == jobid && emp.SchoolId == SchoolID) { empLst.Add(emp); } } } } foreach (ListViewItem item in LstEmp.Items) { CheckBox che = (CheckBox)item.FindControl("chkRow"); if (che.Checked) { var userId = ((HiddenField)item.FindControl("HiddenField1")).Value; empLst.Add((from k in km.Employees where k.IdentityNumber == userId select k).FirstOrDefault()); } } foreach (ListViewItem item in LstSpecification.Items) { CheckBox che = (CheckBox)item.FindControl("chkRow"); if (che.Checked) { UsersTask ut = new UsersTask(); string specification = ((Label)item.FindControl("NameLabel")).Text; foreach (Employee emp in km.Employees) { if (emp.Specification == specification && emp.SchoolId == SchoolID) { empLst.Add(emp); } } } } } foreach (Employee emp in empLst.Distinct()) { if (emp.SchoolId == SchoolID) { UsersGeneralization userGeneralization = new UsersGeneralization(); userGeneralization.UserId = emp.IdentityNumber; userGeneralization.IncomingId = inc.Id; userGeneralization.isSeen = false; km.UsersGeneralizations.Add(userGeneralization); km.SaveChanges(); // lblerror.Text = "تم الاضافة بنجاح"; } } /*******************************************************************************************************************/ //lblerror.Text = "تمت اضافة الوارد بنجاح"; //IncId.Value = (inc.Id).ToString(); // lnkTask.NavigateUrl = "~/Communication/TaskAdd.aspx?type=Incoming&typeId=" + inc.Id; ClientScript.RegisterStartupScript(this.GetType(), "openModal", "<script> openModal(); </script>", false); clear(); } else { int id = int.Parse(Request.QueryString["id"].ToString()); var c = (from k in ose.Incomings where k.Id == id select k).FirstOrDefault(); c.Number = txtIncomingID.Text; c.FileNumber = txtFileNumber.Text; // c.Date = Convert.ToDateTime(txtDate.Text); try { if (Calendar1.CultureName == "ar-SA") { c.Date = MyDate.convertHijriToGregorian(txtDate.Text); } else { c.Date = Convert.ToDateTime(txtDate.Text); } }catch (Exception ex) { txtDate.Text = ""; lblDateError.Text = "الرجاء ادخال تاريخ صحيح"; return; } c.Source = int.Parse(ddlFrom.SelectedValue); c.Subject = txtSubject.Text; c.Type = int.Parse(ddlType.SelectedValue); c.Attachment = int.Parse(ddlFileAttach.SelectedValue); var fileLocation = pdfFrame.Attributes["src"]; if (!String.IsNullOrEmpty(fileLocation)) { c.FileLocation = fileLocation.Substring(2, fileLocation.Length - 2); } ose.SaveChanges(); //PlaceHolderSuccess.Visible = true; //lblerror.Text = "تم تعديل الوارد بنجاح"; //IncId.Value = (c.Id).ToString(); // lnkTask.NavigateUrl = "~/Communication/TaskAdd.aspx?type=Incoming&typeId=" + c.Id; ClientScript.RegisterStartupScript(this.GetType(), "openModal", "<script> openModal(); </script>", false); } }
protected void btnAdd_Click(object sender, EventArgs e) { OnlineSchoolEntities km = new OnlineSchoolEntities(); var identity = txtIdentity.Text; var isExist = Membership.GetUser(txtIdentity.Text) != null; if (!isExist) { var schoolId = int.Parse(txtSchoolId.Text); var school = (from k in km.Schools where k.Id == schoolId select k).FirstOrDefault(); if (school == null) { string password = "******" + txtIdentity.Text; var newUser = Membership.CreateUser(txtIdentity.Text, password, ""); Roles.AddUserToRole(newUser.UserName, "Employee"); Roles.AddUserToRole(newUser.UserName, "Manager"); school = new School(); school.Id = schoolId; school.Name = txtSchoolName.Text; school.Area = txtArea.Text; school.IsActive = true; school.IsDeleted = false; school.Address = txtaddress.Text; school.EducationalLevel = txtEducationalLevel.Text; school.Email = txtemail.Text; if (!String.IsNullOrEmpty(txtGovernmentBuildingsNo.Text)) { school.GovernmentBuildingsNo = int.Parse(txtGovernmentBuildingsNo.Text); } school.Office = txtOffice.Text; if (!String.IsNullOrEmpty(txtRentedBuildingsNo.Text)) { school.RentedBuildingsNo = int.Parse(txtRentedBuildingsNo.Text); } school.ThePhone = txtphone.Text; if (!String.IsNullOrEmpty(txttotalclass.Text)) { school.TotalClass = int.Parse(txttotalclass.Text); } if (!String.IsNullOrEmpty(txttotalStaff.Text)) { school.TotalStaff = int.Parse(txttotalStaff.Text); } if (!String.IsNullOrEmpty(txttotalStudent.Text)) { school.TotalStudents = int.Parse(txttotalStudent.Text); } school.YearFounded = txtYearFounded.Text; school.Type = int.Parse(ddlStudyType.SelectedValue); school.Gender = int.Parse(ddlSchooltype.SelectedValue); school.NumberOfSecretary = int.Parse(ddlSecretaryNumber.SelectedValue); school.OutcomingCode = "-/-"; Employee emp = new Employee(); emp.Name = txtAdminName.Text; // emp.IdentityNumber = txtIdentity.Text; emp.IdentityNumber = txtIdentity.Text; emp.Mobile = txtMobileNumber.Text; emp.JobId = 1; emp.SchoolId = schoolId; if (fuImage.HasFiles) { var file = fuImage.PostedFile; if (fuImage.PostedFile.ContentType.Contains("image")) { String[] sp = file.FileName.Split('.'); string fname = Guid.NewGuid() + "." + sp[sp.Length - 1]; file.SaveAs(MapPath("~/images/SchoolsLogoes/" + fname)); school.logo = "images/SchoolsLogoes/" + fname; } } km.Employees.Add(emp); km.Schools.Add(school); km.SaveChanges(); var msg = (from k in km.Settings where k.KKey == "newUser" select k).FirstOrDefault(); var messagetext = String.IsNullOrEmpty(msg.KVal) ? msg.KVal : msg.DefaultValue; messagetext = string.Format(messagetext, txtIdentity.Text, password); Mobile.MobileSend(messagetext, txtMobileNumber.Text); ClientScript.RegisterStartupScript(this.GetType(), "openModal", "<script> addSuccess(' تمت اضافة المدرسة بنجاح'); </script>", false); } else { ClientScript.RegisterStartupScript(this.GetType(), "openModal", "<script> addfalied(' عذرا! الرقم الوزاري المدخل موجود مسبقا.'); </script>", false); } } else { ClientScript.RegisterStartupScript(this.GetType(), "openModal", "<script> addfalied(' عذرا! اسم المستخدم المدخل موجود مسبقا.'); </script>", false); } }