protected void LstTask_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "details") { int idd = int.Parse(e.CommandArgument.ToString()); var task = (from k in km.Tasks where k.Id == idd select k).FirstOrDefault(); lblTitle.Text = task.Title; lblDate.Text = MyDate.getDate(task.Date.ToString()); lblDescription.Text = task.Description; if (task.IncommingId != null) { lblIncoming.Text = (from k in km.Incomings where k.Id == task.IncommingId select k.Number).FirstOrDefault(); } lblLocation.Text = task.Location; lblTime.Text = ((DateTime)task.Date).ToString("mm:ss tt"); lblTitle2.Text = task.Title; lblType.Text = ConstantManager.getConstant((int)task.Id); lstEmployee.DataSource = (from k in km.Employees join ss in km.UsersTasks on k.IdentityNumber equals ss.UserId where ss.IsEmployee == true orderby k.Name select k.Name).ToList(); lstEmployee.DataBind(); lstStd.DataSource = (from k in km.Students join ss in km.UsersTasks on k.IdentityNumber equals ss.UserId where ss.IsEmployee == false orderby k.Name select k.Name).ToList(); lstStd.DataBind(); ClientScript.RegisterStartupScript(this.GetType(), "openModal", "<script> openModal(); </script>", false); } }
public void CanAddConstantFromCppConstant() { var constantManager = new ConstantManager(new NamingRulesManager(), A.Fake <IDocumentationLinker>()); var value = "1"; var macro = new CppConstant("Macro", value); var csTypeName = "MyClass"; var constantName = "Constant"; constantManager.AddConstantFromMacroToCSharpType(new CppElementFinder(macro), "Macro", csTypeName, "int", constantName, "$1", null, "namespace"); var csStructure = new CsStruct { Name = csTypeName }; constantManager.AttachConstants(csStructure); Assert.Single(csStructure.Items); var variable = (CsVariable)csStructure.Items[0]; Assert.Equal(value, variable.Value); Assert.Equal(constantName, variable.Name); }
//[BlockEmployee(Block = "ActiveUser",Except = "Administrator")] public ActionResult Get([FromQuery(Name = "id")] int?EmployeeId) { try { #region check model //if (!ModelState.IsValid) //{ // var modelState = ModelState.FirstOrDefault(); // var error = modelState.Value.Errors.FirstOrDefault().ErrorMessage; // throw ApiException.Get(false, error, ResultEnum.ModelError, HttpStatusCode.BadRequest); //} #endregion if (EmployeeId.HasValue) { var data = employeeService.Get(EmployeeId.Value); response = BaseResponse <dynamic> .Get(true, ConstantManager.SUCCESS, data, ResultEnum.Success); } else { var data = employeeService.Get().ToList(); response = BaseResponse <dynamic> .Get(true, ConstantManager.SUCCESS, data, ResultEnum.Success); } } catch (ApiException e) { result.StatusCode = e.StatusCode; response = BaseResponse <dynamic> .Get(e.Success, e.ErrorMessage, null, e.ErrorStatus); result = new JsonResult(response); } catch (Exception e) { result.StatusCode = (int)HttpStatusCode.InternalServerError; response = BaseResponse <dynamic> .Get(false, ConstantManager.Fail("Employee : ") + e.ToString(), null, ResultEnum.InternalError); } result = new JsonResult(response); return(result); }
IEnumerator LoadingUpdate() { IncreaseUpdate(5); yield return(new WaitForSeconds(0.1f)); ConstantManager.GetInstance().Initialize(); IncreaseUpdate(20); yield return(new WaitForSeconds(0.1f)); int count = ConstantManager.CONST_KEY_TO_LOAD.Length; int per = Mathf.RoundToInt(10 / count); if (per <= 0) { per = 1; } for (int i = 0; i < count; i++) { ConstantManager.GetInstance().LoadConstantByKey(ConstantManager.CONST_KEY_TO_LOAD[i]); if (i % per == 0) { IncreaseUpdate(5); } yield return(new WaitForSeconds(0.2f)); } yield return(new WaitForSeconds(0.2f)); hint.gameObject.SetActive(true); AutoHint(); yield return(new WaitForSeconds(0.1f)); IncreaseUpdate(20); yield return(new WaitForSeconds(0.2f)); IncreaseUpdate(30); yield return(new WaitForSeconds(0.2f)); IncreaseUpdate(20); }
public void FillEmployee() { // var idd = int.Parse( Request.QueryString["IncomingId"]); var isSeen = (from m in km.UsersGeneralizations select m.isSeen).FirstOrDefault(); string IsSeenn; if (isSeen == false) { IsSeenn = "لا"; } else { IsSeenn = "نعم"; } int IncomingId = int.Parse(Request.QueryString["IncomingId"].ToString()); var emp = (from k in km.UsersGeneralizations where k.IncomingId == IncomingId select new { IsSeenn, EmployeeName = (from m in km.Employees where m.IdentityNumber == k.UserId select m.Name).FirstOrDefault() }).ToList(); LstEmployee.DataSource = emp; LstEmployee.DataBind(); var IncomingInfo = (from m in km.Incomings where m.Id == IncomingId select m).FirstOrDefault(); lbldate.Text = MyDate.getDate(IncomingInfo.Date.ToString()); lblSource.Text = ConstantManager.getConstant((int)IncomingInfo.Source); lblsubject.Text = IncomingInfo.Subject; lbltype.Text = ConstantManager.getConstant((int)IncomingInfo.Type); }
public Syncronizer(NetworkPeer p, IEnumerable <object> ts) { peer = p; message_processor = new MessageProcessor(this, b => ReadBuffer(b)); entity_manager = new EntityManager(this); system_manager = new SystemManager(this, ts); constant_manager = new ConstantManager(this); if (GetNetworkActor().IsServer()) { peer.OnConnect += delegate(NetIncomingMessage message) { constant_manager.SendFullUpdate(new NetworkRecipient_Single(message.SenderConnection)); entity_manager.InitializeRecipient(new NetworkRecipient_Single(message.SenderConnection)); OnNewClient.InvokeAll(message.SenderConnection); return(true); }; } peer.OnData += delegate(NetIncomingMessage message) { return(message_processor.ProcessMessage(message)); }; }
public void OnActionExecuting(ActionExecutingContext context) { try { employeeService = context.HttpContext.RequestServices.GetService <IEmployeeService>(); var blockList = new List <string>(); var exceptList = new List <string>(); if (!string.IsNullOrEmpty(Block)) { blockList = Block.Trim().Split(',').ToList(); } if (!string.IsNullOrEmpty(Except)) { exceptList = Except.Trim().Split(',').ToList(); } _request = context.HttpContext.Request; var query = _request.Query; _authorization = _request.Headers.FirstOrDefault(p => p.Key.Equals("Authorization")).Value.ToString(); if (_authorization == null || string.IsNullOrEmpty(_authorization)) { throw ApiException.Get(false, ConstantManager.MES_AUTHORIZATION_NOT_FOUND, ResultEnum.AuthorizationNotFound, HttpStatusCode.BadRequest); } else { var tokenJWT = Utils.DecodeJwtToken(_authorization); // get List role var role = tokenJWT.Claims.Where(c => c.Type == "role").Select(c => c.Value).ToList(); var unique = tokenJWT.Claims.Where(c => c.Type == "unique_name").FirstOrDefault().Value.ToString(); var email = unique.Split('-')[0]; var emp = employeeService.Get(email).FirstOrDefault(); if (!role.Contains(RoleTypeEnum.ActiveUser.ToString())) { throw ApiException.Get(false, ConstantManager.MES_NOT_ACTIVE, ResultEnum.NotActive, HttpStatusCode.NotAcceptable); } if (!role.Contains(RoleTypeEnum.Administrator.ToString())) { if (query.Count() == 0) { throw ApiException.Get(false, ConstantManager.MES_REQUEST_DENY, ResultEnum.NotAcceptable, HttpStatusCode.NotAcceptable); } else { var id = query.FirstOrDefault(p => p.Key.Equals("id")).Value; if (id != emp.Id) { throw ApiException.Get(false, ConstantManager.MES_REQUEST_DENY, ResultEnum.NotAcceptable, HttpStatusCode.NotAcceptable); } } } //foreach (var e in exceptList) //{ // if (role.Contains(e.ToString())) // { // return; // } //} //foreach (var item in blockList) //{ // var a = (RoleTypeEnum[])Enum.GetValues(typeof(RoleTypeEnum)); // var check = a.FirstOrDefault(e => e.ToString().Contains(item)).ToString(); // if (check == null) // { // throw ApiException.Get(false, ConstantManager.MES_ROLE_WRONG, ResultEnum.AttributeWrong, HttpStatusCode.BadRequest); // } // if (role.Contains(item)) // { // throw ApiException.Get(false, ConstantManager.MES_REQUEST_DENY, ResultEnum.RoleNotSupport, HttpStatusCode.NotAcceptable); // } //} return; } } catch (ApiException e) { result.StatusCode = e.StatusCode; result.Value = BaseResponse <dynamic> .Get(e.Success, e.ErrorMessage, null, e.ErrorStatus); } catch (Exception e) { result.StatusCode = (int)HttpStatusCode.InternalServerError; result.Value = BaseResponse <dynamic> .Get(false, ConstantManager.Fail(" Authentication : ") + e.ToString(), null, ResultEnum.InternalError); } context.Result = result; }
public ConstantSubManager_Type(ConstantManager m) : base(m) { }
public PushNotifResp PushNotification(PushNotifReq pushNotifReq) { PushNotifResp resp = new PushNotifResp(); try { if (string.IsNullOrEmpty(pushNotifReq.PrevToken)) { //Insert SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@CustomerId", pushNotifReq.CustomerId), new SqlParameter("@Browser", pushNotifReq.Browser), new SqlParameter("@Channel", pushNotifReq.Channel), new SqlParameter("@Device", pushNotifReq.Device), new SqlParameter("@NotificationType", pushNotifReq.NotificationType), new SqlParameter("@Topic", pushNotifReq.Topic), new SqlParameter("@CustomerType", pushNotifReq.CustomerType), new SqlParameter("@Token", pushNotifReq.Token), }; SqlResModel insertToken = SqlDbHelper.InsertWithParam(ConstantManager.EOneConnString(), "proc_InsertToken", CommandType.StoredProcedure, sqlParams); if (insertToken.ResponseCode == "00" && insertToken.ResultInt > 0) { resp.ResponseCode = "00"; resp.TokenCount = insertToken.ResultInt; resp.ResponseDescription = "successful"; } else { resp.ResponseCode = "01"; resp.TokenCount = insertToken.ResultInt; resp.ResponseDescription = "failed"; } } else { //select SqlParameter[] sqlParam = new SqlParameter[] { new SqlParameter("@PrevToken", pushNotifReq.PrevToken), }; SqlResModel selectToken = SqlDbHelper.SelectWithParam(ConstantManager.EOneConnString(), "proc_GetPrevToken", CommandType.StoredProcedure, sqlParam); //if record exist - update if (selectToken.ResponseCode == "00" && selectToken.ResultDataTable.Rows.Count > 0) { SqlParameter[] sqlParam1 = new SqlParameter[] { new SqlParameter("@Token", pushNotifReq.Token), new SqlParameter("@PrevToken", pushNotifReq.PrevToken), }; SqlResModel updateToken = SqlDbHelper.SelectWithParam(ConstantManager.EOneConnString(), "proc_UpdateToken", CommandType.StoredProcedure, sqlParam1); if (updateToken.ResultInt > 0 && updateToken.ResponseCode == "00") { resp.ResponseCode = "00"; resp.TokenCount = updateToken.ResultInt; resp.ResponseDescription = "successful"; } else { resp.ResponseCode = "01"; resp.TokenCount = updateToken.ResultInt; resp.ResponseDescription = "failed"; } } else { SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@CustomerId", pushNotifReq.CustomerId), new SqlParameter("@Browser", pushNotifReq.Browser), new SqlParameter("@Channel", pushNotifReq.Browser), new SqlParameter("@Device", pushNotifReq.Device), new SqlParameter("@NotificationType", pushNotifReq.NotificationType), new SqlParameter("@Topic", pushNotifReq.Topic), new SqlParameter("@CustomerType", pushNotifReq.CustomerType), new SqlParameter("@Token", pushNotifReq.Token), }; SqlResModel insertToken = SqlDbHelper.InsertWithParam(ConstantManager.EOneConnString(), "proc_InsertToken", CommandType.StoredProcedure, sqlParams); if (insertToken.ResponseCode == "00" && insertToken.ResultInt > 0) { resp.ResponseCode = "00"; resp.TokenCount = insertToken.ResultInt; resp.ResponseDescription = "successful"; } else { resp.ResponseCode = "01"; resp.TokenCount = insertToken.ResultInt; resp.ResponseDescription = "failed"; } } } } catch (Exception ex) { ErrHandler.Log(pushNotifReq.CustomerId + " Error encounterd: " + ex.Message + " " + ex.StackTrace); resp.ResponseCode = "99"; resp.ResponseDescription = "Exception thrown"; } resp.CustomerId = pushNotifReq.CustomerId; return(resp); }
public PushNotifResp SendPushNotification(SendPushNotifReq req) { PushNotifResp res = new PushNotifResp(); //Send Notif here var tokens = req.Tokens; var pushSent = PushNotificationLogic.SendPushNotification(tokens, req.MesssageTitle, req.MesssageBody, req.Image).Result; if (pushSent) { SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@Title", req.MesssageTitle), new SqlParameter("@Body", req.MesssageBody), new SqlParameter("@Image", req.Image), new SqlParameter("@SentStatus", 1), }; SqlResModel insertToken = SqlDbHelper.InsertWithParam(ConstantManager.EOneConnString(), "proc_InsertPushMessage", CommandType.StoredProcedure, sqlParams); if (insertToken.ResponseCode == "00" && insertToken.ResultInt > 0) { ErrHandler.Log("Push Notification Sent and logged successfully on PUshMessages DB for target token Ids"); } else { ErrHandler.Log("Push Notification successfully Sent to target token Ids but an error occured while trying to log the Message on PushMessages DB"); } res.ResponseCode = "00"; res.ResponseDescription = "successful"; res.TokenCount = tokens.Length; res.CustomerId = req.CustomerId; res.SentStatus = 1; } else { SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@Title", req.MesssageTitle), new SqlParameter("@Body", req.MesssageBody), new SqlParameter("@Image", req.Image), new SqlParameter("@SentStatus", 0), }; SqlResModel insertToken = SqlDbHelper.InsertWithParam(ConstantManager.EOneConnString(), "proc_InsertPushMessage", CommandType.StoredProcedure, sqlParams); if (insertToken.ResponseCode == "00" && insertToken.ResultInt > 0) { ErrHandler.Log("Failed to send Push Notification for target token Ids. Messages details has been logged to the PushMessages DB"); } else { ErrHandler.Log("Failed in logging Message details for the failed Push Notification"); } res.ResponseCode = "01"; res.ResponseDescription = "failed"; res.TokenCount = 0; res.CustomerId = req.CustomerId; res.SentStatus = 0; } return(res); }
protected void btnsave_Click(object sender, EventArgs e) { if (IsValid) { SchoolInformation info = new SchoolInformation(); MyDate mydate = new MyDate(); foreach (ListViewItem item in ListView1.Items) { Button btnActive = (Button)item.FindControl("btnActive"); if (btnActive.Text == "غياب") { Absence abs = new Absence(); abs.SemesterId = MyDate.getCurrentSemesterId(); abs.SchoolId = info.getId(); var empId = ((HiddenField)item.FindControl("HiddenField1")).Value.ToString(); abs.EmployeeId = empId; if (Calendar1.CultureName == "ar-SA") { abs.Date = MyDate.convertHijriToGregorian(datepicker.Text); } else { abs.Date = DateTime.ParseExact(datepicker.Text, "yyyy/MM/dd", CultureInfo.CreateSpecificCulture("ar-EG")); } abs.Type = int.Parse(((DropDownList)item.FindControl("lstResonLate")).SelectedValue); var today = DateTime.Now.DayOfWeek; var schoolid = info.getId(); DateTime yesterday = DateTime.Now.AddDays(-1).Date; if (today == DayOfWeek.Sunday) { yesterday = DateTime.Now.AddDays(-3).Date; } var absentYesterday = ((from k in km.Absences where k.EmployeeId == empId && k.Date == yesterday select k).FirstOrDefault()); if (absentYesterday != null) { AbsenceAlert alert = (from k in km.AbsenceAlerts where k.Id == absentYesterday.AlertId select k).FirstOrDefault(); alert.DateTo = DateTime.Now; abs.AlertId = alert.Id; alert.count++; if (today == DayOfWeek.Sunday) { alert.countHoliday = alert.countHoliday + 2; } } else { AbsenceAlert alert = new AbsenceAlert(); alert.SemesterId = MyDate.getCurrentSemesterId(); alert.SchoolId = info.getId(); alert.EmployeeId = empId; alert.DateFrom = DateTime.Now; alert.DateTo = DateTime.Now; alert.count = 1; alert.countHoliday = 0; km.AbsenceAlerts.Add(alert); km.SaveChanges(); abs.AlertId = alert.Id; } lstAbs.Add(abs); km.Absences.Add(abs); km.SaveChanges(); } else if (btnActive.Text == "حضور") { Attendence att = new Attendence(); att.Date = DateTime.Now; var schoolId = info.getId(); att.SchoolId = schoolId; att.SemesterId = MyDate.getCurrentSemesterId(); att.EmployeeId = ((HiddenField)item.FindControl("HiddenField1")).Value; TextBox txtArrive = (TextBox)item.FindControl("txtarrivingTime"); if (!String.IsNullOrEmpty(txtArrive.Text)) { att.ArrivingTime = Convert.ToDateTime(txtArrive.Text).TimeOfDay; } TextBox txtDeparture = (TextBox)item.FindControl("txtdeptime"); if (!String.IsNullOrEmpty(txtDeparture.Text)) { TimeSpan departure = Convert.ToDateTime(txtDeparture.Text).TimeOfDay; var timeWorkEnd = (from k in km.Schools where k.Id == schoolId select k.TimeEndWork).FirstOrDefault(); var amount = timeWorkEnd - departure; if (amount.TotalSeconds > 0) { Lateness late = new Lateness(); late.Amount = amount; late.TotalSeconds = amount.TotalSeconds; late.IsPrinted = false; late.Type = ConstantManager.getConstantId("انصراف مبكر"); late.SchoolId = schoolId; late.SemesterId = MyDate.getCurrentSemesterId(); late.Date = DateTime.Now.Date; late.EmployeeId = ((HiddenField)item.FindControl("HiddenField1")).Value; km.Latenesses.Add(late); } att.DepartureTime = departure; } km.Attendences.Add(att); km.SaveChanges(); } else if (btnActive.Text == "تأخر") { Lateness late = new Lateness(); if (!String.IsNullOrEmpty(((TextBox)item.FindControl("TimeLate")).Text)) { var schoolId = info.getId(); TimeSpan timearrive = Convert.ToDateTime(((TextBox)item.FindControl("TimeLate")).Text).TimeOfDay; TimeSpan timestartwork = (TimeSpan)(from k in km.Schools where k.Id == schoolId select k.TimeStartWork).FirstOrDefault(); TimeSpan amount = timearrive - timestartwork; if (amount.TotalSeconds > 0) { late.TotalSeconds = amount.TotalSeconds; late.Type = ConstantManager.getConstantId("تأخر صباحي"); late.Amount = amount; late.Date = DateTime.Now; late.SchoolId = info.getId(); late.SemesterId = MyDate.getCurrentSemesterId(); var empId = ((HiddenField)item.FindControl("HiddenField1")).Value; late.EmployeeId = empId; km.Latenesses.Add(late); var year = DateTime.Now.Year; var lateSum = (from k in km.Latenesses where k.EmployeeId == empId && k.Date.Value.Year == year select k.TotalSeconds).Sum(); if (lateSum != null) { var total = lateSum + late.TotalSeconds; var currentLate = (int)lateSum / 3600; var totalLate = (int)total / 3600; if (totalLate >= 7 && totalLate > currentLate) { //اضافة حسم LatenessDecision alertdecition = new LatenessDecision(); alertdecition.SchoolId = info.getId(); alertdecition.SemesterId = MyDate.getCurrentSemesterId(); alertdecition.Date = DateTime.Now.Date; alertdecition.Days = 1; alertdecition.EmployeeId = empId; alertdecition.Hours = totalLate; km.LatenessDecisions.Add(alertdecition); } else if (totalLate >= 3 && totalLate > currentLate) { //اضافة تنبيه LatenessDecision alertdecition = new LatenessDecision(); alertdecition.SchoolId = info.getId(); alertdecition.SemesterId = MyDate.getCurrentSemesterId(); alertdecition.Date = DateTime.Now.Date; alertdecition.Days = 0; alertdecition.EmployeeId = empId; alertdecition.Hours = totalLate; km.LatenessDecisions.Add(alertdecition); } } } else { Attendence att = new Attendence(); att.Date = DateTime.Now; att.SchoolId = info.getId(); att.SemesterId = MyDate.getCurrentSemesterId(); att.EmployeeId = ((HiddenField)item.FindControl("HiddenField1")).Value; att.ArrivingTime = timearrive; km.Attendences.Add(att); } } km.SaveChanges(); } } Response.Redirect("~/EmployeeAttendence/AttendenceReport.aspx"); } }
public ConstantManagerTests(ITestOutputHelper outputHelper) : base(outputHelper) { constantManager = new ConstantManager(new NamingRulesManager(), Ioc); }
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 (!Page.IsPostBack) { if (Request.QueryString["id"] != null) { Calendar1.DataBind(); int id = int.Parse(Request.QueryString["id"].ToString()); var c = (from k in km.Outcomings where k.Id == id select k).FirstOrDefault(); txtOutcomingNumber.Text = c.Number; if (c.Date != null) { txtDate.Text = MyDate.getDate(c.Date.ToString()); } if (c.Type != null) { txtType.Text = ConstantManager.getConstant((int)c.Type); } if (c.SourceFrom != null) { txtSourceFrom.Text = ConstantManager.getConstant((int)c.SourceFrom); } if (!String.IsNullOrEmpty(c.ReceivedName)) { txtRecivedName.Text = c.ReceivedName; } else { txtRecivedName.Text = "لم يتم تسجيل الاستلام بعد"; } if (c.SourceTo != null) { txtSourceTo.Text = ConstantManager.getConstant((int)c.SourceTo); } if (c.FileNumber != null) { txtFileNumber.Text = c.FileNumber.ToString(); } if (c.Attachment != null) { txtFileAttach.Text = ConstantManager.getConstant((int)c.Attachment); } if (!String.IsNullOrEmpty(c.Subject)) { txtTitle.Text = c.Subject; } if (c.FileLocation != null) { pdfFrame.Attributes.Add("src", "~/" + c.FileLocation); } lnkTask.NavigateUrl = "~/Communication/TaskAdd.aspx?type=Outcoming&typeId=" + id; if (c.ReceivedName != null) { lblDone.Text = "تم تسليم المعاملة"; txtReceiver.Text = c.ReceivedName; txtDateReceive.Text = MyDate.getDate(c.ReceivedDate.ToString()); } } } }
protected void lstLate_DataBinding(object sender, EventArgs e) { counter = 0; var type = ConstantManager.getConstantId("تأخر صباحي"); var schoolid = new SchoolInformation().getId(); DateTime date = new DateTime(); if (Calendar1.CultureName == "ar-SA") { date = (MyDate.convertHijriToGregorian(txtDate.Text)).Date; } else { date = DateTime.ParseExact(txtDate.Text, "yyyy/MM/dd", CultureInfo.CreateSpecificCulture("ar-EG")).Date; } if (radioType.SelectedValue == "all") { var lst = (from k in km.StudentsLatenesses join s in km.Students on k.StudentId equals s.IdentityNumber where k.SchoolId == schoolid && k.Date == date && k.Type == type select new { s.Id, s.Name, k.Amount, }).ToList(); lstLate.DataSource = lst; } else if (radioType.SelectedValue == "class") { var subjectId = int.Parse(ddlSubject.SelectedValue); var classId = ddlClass.SelectedValue; var lst = (from k in km.StudentsLatenesses join s in km.Students on k.StudentId equals s.IdentityNumber join ss in km.StudentsSubjects on k.StudentId equals ss.StudentId join sub in km.SubjectsInSemesters on ss.SubjectId equals sub.Id where k.SchoolId == schoolid && k.Date == date && sub.ClassId == classId && sub.SubjectId == subjectId && k.Type == type select new { s.Id, s.Name, k.Amount, }).ToList(); lstLate.DataSource = lst; } else if (radioType.SelectedValue == "one") { var stdId = ddlStudents.SelectedValue; var lst = (from k in km.StudentsLatenesses join s in km.Students on k.StudentId equals s.IdentityNumber where k.SchoolId == schoolid && k.Date == date && s.IdentityNumber == stdId && k.Type == type select new { s.Id, s.Name, k.Amount, }).ToList(); lstLate.DataSource = lst; } }
public ConstantSubManager_String(ConstantManager m) : base(m) { }
protected void btnAdd_Click(object sender, EventArgs e) { SchoolInformation Info = new SchoolInformation(); var SID = Info.getId(); var SemId = MyDate.getCurrentSemesterId(); Lateness Late = new Lateness(); var empId = ddlNameEMp.SelectedValue; Late.EmployeeId = empId; if (Calendar1.CultureName == "ar-SA") { Late.Date = MyDate.convertHijriToGregorian(datepicker.Text); } else { Late.Date = DateTime.ParseExact(datepicker.Text, "yyyy/MM/dd", CultureInfo.CreateSpecificCulture("ar-EG")); } Late.SchoolId = SID; Late.SemesterId = SemId; var type = int.Parse(ddlType.SelectedValue); Late.Type = type; if (type == ConstantManager.getConstantId("خروج دون استئذان")) { Late.TimeFrom = Convert.ToDateTime(TextTimeFrom.Text).TimeOfDay; Late.Timeto = Convert.ToDateTime(TextTimeTo.Text).TimeOfDay; Late.Amount = Late.Timeto - Late.TimeFrom; Late.TotalSeconds = ((TimeSpan)Late.Amount).TotalSeconds; } else { Late.Amount = new TimeSpan(0, int.Parse(txtamount.Text), 0); Late.TotalSeconds = (TimeSpan.Parse(Late.Amount.ToString())).TotalSeconds; } var year = DateTime.Now.Year; var lateSum = (from k in km.Latenesses where k.EmployeeId == empId && k.Date.Value.Year == year select k.TotalSeconds).Sum(); if (lateSum != null) { var total = lateSum + Late.TotalSeconds; var currentLate = (int)lateSum / 3600; var totalLate = (int)total / 3600; if (totalLate > 7 && totalLate > currentLate) { //اضافة حسم LatenessDecision alertdecition = new LatenessDecision(); alertdecition.SchoolId = Info.getId(); alertdecition.SemesterId = MyDate.getCurrentSemesterId(); alertdecition.Date = DateTime.Now.Date; // alertdecition.Days= alertdecition.EmployeeId = empId; alertdecition.Hours = totalLate; km.LatenessDecisions.Add(alertdecition); } else if (totalLate > 3 && totalLate > currentLate) { //اضافة تنبيه // LatenessAlert alert = new LatenessAlert(); LatenessDecision alertdecition = new LatenessDecision(); alertdecition.SchoolId = Info.getId(); alertdecition.SemesterId = MyDate.getCurrentSemesterId(); alertdecition.Date = DateTime.Now.Date; alertdecition.Days = 0; alertdecition.EmployeeId = empId; alertdecition.Hours = totalLate; km.LatenessDecisions.Add(alertdecition); } } clearText(); km.Latenesses.Add(Late); km.SaveChanges(); ClientScript.RegisterStartupScript(this.GetType(), "openModal", "<script> openModal(); </script>", false); }
public ConstantSubManager_EntityMethod(ConstantManager m) : base(m) { }
public ConstantSubManager_SystemMethod(ConstantManager m) : base(m) { }