Esempio n. 1
0
        private void InitData()
        {
            DataTable dt = DataFactory.SqlDataBase().GetDataTable("Base_Vendor");

            ControlBindHelper.BindHtmlSelect(dt, this.BV_ID, "BV_Name", "BV_ID", "开发商");
            Hashtable ht = DataFactory.SqlDataBase().GetHashtableById("Contract_Mortgage", "UID", this.UID);

            if (ht.Count > 0 && ht != null)
            {
                DateTime NewDate;
                if (!string.IsNullOrEmpty(ht["M_REPLY_BEGIN"].ToString()))
                {
                    NewDate             = DateTime.Parse(ht["M_REPLY_BEGIN"].ToString());
                    ht["M_REPLY_BEGIN"] = NewDate.ToString("yyyy-MM-dd");
                }

                if (!string.IsNullOrEmpty(ht["M_REPLY_END"].ToString()))
                {
                    NewDate           = DateTime.Parse(ht["M_REPLY_END"].ToString());
                    ht["M_REPLY_END"] = NewDate.ToString("yyyy-MM-dd");
                }

                if (!string.IsNullOrEmpty(ht["M_SIGNDATE"].ToString()))
                {
                    NewDate          = DateTime.Parse(ht["M_SIGNDATE"].ToString());
                    ht["M_SIGNDATE"] = NewDate.ToString("yyyy-MM-dd");
                }
                ControlBindHelper.SetWebControls(this.Page, ht);
            }
        }
Esempio n. 2
0
        private void InitData()
        {
            Hashtable ht = DataFactory.SqlDataBase().GetHashtableById("Contract_OneCard", "UID", this.UID);

            if (ht.Count > 0 && ht != null)
            {
                DateTime NewDate;
                if (!string.IsNullOrEmpty(ht["M_REPLY_BEGIN"].ToString()))
                {
                    NewDate             = DateTime.Parse(ht["M_REPLY_BEGIN"].ToString());
                    ht["M_REPLY_BEGIN"] = NewDate.ToString("yyyy-MM-dd");
                }

                if (!string.IsNullOrEmpty(ht["M_REPLY_END"].ToString()))
                {
                    NewDate           = DateTime.Parse(ht["M_REPLY_END"].ToString());
                    ht["M_REPLY_END"] = NewDate.ToString("yyyy-MM-dd");
                }

                if (!string.IsNullOrEmpty(ht["M_ISSUINGDATE"].ToString()))
                {
                    NewDate             = DateTime.Parse(ht["M_ISSUINGDATE"].ToString());
                    ht["M_ISSUINGDATE"] = NewDate.ToString("yyyy-MM-dd");
                }

                ControlBindHelper.SetWebControls(this.Page, ht);
            }
        }
 public Student(string name, string family, int std_id, NewDate birthDate, Date successDate) {
     this.name = name;
     this.family = family;
     this.std_id = std_id;
     this.birthDate = birthDate;
     this.successDate = successDate;
     this.counter = counter++;
 }
Esempio n. 4
0
 /// <summary>
 /// Sets the arguments in the GUI
 /// </summary>
 private void SetValues()
 {
     ExistingNameLabel.Content  = ExisitingName;
     ExisitingSizeLabel.Content = Utils.ConvertFileSize(ExistingSize);
     ExistingDateLabel.Content  = ExistingDate.ToString("G");
     ExisitingCrcLabel.Content  = ExistingCrc.ToString("X");
     ArchiveNameLabel.Content   = NewName;
     ArchiveSizeLabel.Content   = Utils.ConvertFileSize(NewSize);
     ArchiveDateLabel.Content   = NewDate.ToString("G");
     ArchiveCrcLabel.Content    = NewCrc.ToString("X");
 }
Esempio n. 5
0
        public IActionResult AddAppointment(NewDate aptDate)
        {
            //the date from the ViewTimes view is passed through from the paramter into the viewbag to this view.
            ViewBag.StringDate = aptDate.newAptDate;
            //String is parsed into a datetime class and sent to the view
            DateTime myDate = DateTime.ParseExact(ViewBag.StringDate, "MM/dd/yyyy hh:mm tt", null);

            ViewBag.GetFormatDate = myDate;

            return(View());
        }
Esempio n. 6
0
        public DomainEvent GetDomainEvent()
        {
            switch (DomainEventType)
            {
            case EventType.Added:
            {
                return(new AppointmentAdded(AggregateId.GetAggregateIdentifier(),
                                            AggregateVersion,
                                            UserId,
                                            new Tuple <Date, Time>(TimeStampDate.GetDate(), TimeStampTime.GetTime()),
                                            ActionTag,
                                            PatientId,
                                            Description,
                                            StartTime.GetTime(),
                                            EndTime.GetTime(),
                                            TherapyPlaceId.Value,
                                            LabelId.Value,
                                            AppointmentId.Value));
            }

            case EventType.Replaced:
            {
                return(new AppointmentReplaced(AggregateId.GetAggregateIdentifier(),
                                               AggregateVersion,
                                               UserId,
                                               PatientId,
                                               new Tuple <Date, Time>(TimeStampDate.GetDate(), TimeStampTime.GetTime()),
                                               ActionTag,
                                               NewDescription,
                                               NewDate.GetDate(),
                                               NewStartTime.GetTime(),
                                               NewEndTime.GetTime(),
                                               NewTherapyPlaceId.Value,
                                               NewLabelId.Value,
                                               OriginalAppointmendId.Value));
            }

            case EventType.Removed:
            {
                return(new AppointmentDeleted(AggregateId.GetAggregateIdentifier(),
                                              AggregateVersion,
                                              UserId,
                                              PatientId,
                                              new Tuple <Date, Time>(TimeStampDate.GetDate(), TimeStampTime.GetTime()),
                                              ActionTag,
                                              RemovedAppointmentId.Value));
            }
            }
            throw new Exception("inner error");
        }
Esempio n. 7
0
        private void BindData()
        {
            Hashtable ht = DataFactory.SqlDataBase().GetHashtableById("User_Interview", "UID", UID);

            if (ht.Count > 0)
            {
                if (!string.IsNullOrEmpty(ht["UV_DATE"].ToString()))
                {
                    DateTime NewDate;
                    NewDate       = DateTime.Parse(ht["UV_DATE"].ToString());
                    ht["UV_DATE"] = NewDate.ToString("yyyy-MM-dd");
                }

                ControlBindHelper.SetWebControls(this.Page, ht);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// הפונקציה מחפשת תאריך אחר לטסט בכל שעה שהיא, ומחזירה תאריך זה
        /// </summary>
        /// <param name="mytester">הבוחן</param>
        /// <param name="lastTest">המבחן</param>
        /// <returns>תאריך</returns>
        public DateTime AnotherDateForTheTest(Tester mytester, Test currentTest, Test lastTest)
        {
            DateTime temp = DateTime.Now;
            DateTime NewDate;

            if (lastTest != null)
            {
                //הבדיקה מתחילה החל מ7 ימים מהטסט האחרון - תוך בדיקה שהתאריך הנל לא חלף כבר ואם כן מתחילה מהתאריך האפשרי
                NewDate = lastTest.DateTimeOfTest.AddDays(7);
                TimeSpan cheakDate = NewDate - temp;
                if (cheakDate.TotalDays <= 0)
                {
                    cheakDate = temp - NewDate;
                    if (cheakDate.Days == 0)
                    {
                        NewDate = NewDate.AddDays(cheakDate.Days + 1);
                    }
                    else
                    {
                        NewDate = NewDate.AddDays(cheakDate.Days);
                    }
                }
            }
            else
            {
                NewDate = currentTest.DateTimeOfTest;
            }
            //שליחת התאריך לחיפוש האם ביום זה בכל שעה שהיא ישנו טסט פנוי
            temp = new DateTime();
            DateTime diffrent = ArrangeTestAtDiffrentTime(mytester, NewDate);

            while ((diffrent == temp) || (numOfTestForTester(mytester, diffrent) >= mytester.TesterMaxNumOfTestsPerWeek))
            {
                NewDate = NewDate.AddDays(1);
                if ((int)NewDate.DayOfWeek == 5)
                {
                    NewDate = NewDate.AddDays(2);
                }
                if ((int)NewDate.DayOfWeek == 6)
                {
                    NewDate = NewDate.AddDays(1);
                }
                diffrent = ArrangeTestAtDiffrentTime(mytester, NewDate);
            }
            return(diffrent);
        }
Esempio n. 9
0
        protected void ModifyDateTime_Click(object sender, EventArgs e)
        {
            //EKKI NOTAÐ LENGUR - Var notað í GridViw3
            bool RefreshPage = false;
            AthleticCompetitionCRUD AthlCRUD  = new AthleticCompetitionCRUD();
            Athl_CompetitionEvents  AthlEvent = new Athl_CompetitionEvents();
            AthleticsEntities1      AthlEnt   = new AthleticsEntities1();
            Global gl = new Global();

            string   CompCode           = gl.GetCompetitionCode();
            string   NewDateText        = "";
            string   NewTimeText        = "";
            Int32    CurrentRowNo       = 0;
            Int32    CurrentEventLineNo = 0;
            Int32    NoOfEvents         = GridView3.Rows.Count;
            DateTime NewDate;
            DateTime NewTime;
            DateTime EmptyDateTime = DateTime.ParseExact("17530101 00:00:00", "yyyyMMdd HH:mm:ss", DateTimeFormatInfo.InvariantInfo);

            for (CurrentRowNo = 0; CurrentRowNo < NoOfEvents; CurrentRowNo++)
            {
                CurrentEventLineNo = (Int32)this.GridView3.DataKeys[CurrentRowNo]["greinnumer"];
                TextBox EventDateTextBox = (TextBox)GridView3.Rows[CurrentRowNo].FindControl("DagsGreinar");
                NewDateText = EventDateTextBox.Text;
                TextBox EventTimeTextBox = (TextBox)GridView3.Rows[CurrentRowNo].FindControl("TimiGreinar");
                NewTimeText = EventTimeTextBox.Text;
                NewDate     = gl.TryConvertStringToDate(NewDateText);
                NewTime     = gl.TryConvertStringToTime(NewTimeText);
                if ((NewDate > EmptyDateTime) && (NewTime > EmptyDateTime))
                {
                    AthlEvent = AthlCRUD.GetCompetitionEvent(CompCode, CurrentEventLineNo);
                    if ((NewDate.ToString("d") != AthlEvent.dagsetning.ToString("d")) || (NewTime.ToShortTimeString() != AthlEvent.timi.ToShortTimeString()))
                    {
                        AthlEvent.dagsetning = NewDate;
                        AthlEvent.timi       = NewTime;
                        AthlEnt.UpdateEventDateTimeAndStatus(CompCode, CurrentEventLineNo, NewDate, NewTime, AthlEvent.stadakeppni,
                                                             AthlEvent.tilkynnaverdlaunaafhendingu);
                        RefreshPage = true;
                    }
                }
            }
            if (RefreshPage == true)
            {
                Response.Redirect("NyttMot.aspx" + "?Comp=" + CompCode);
            }
        }
Esempio n. 10
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (Command != KeyDatesCommand.ArchiveReference && !NewDate.IsCompleted)
            {
                yield return(new ValidationResult(KeyDatesViewModelResources.DateRequiredError, new[] { "NewDate" }));
            }

            if (Command == KeyDatesCommand.BeginAssessment)
            {
                if (string.IsNullOrWhiteSpace(NameOfOfficer))
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.NameOfOfficerRequiredError, new[] { "NameOfOfficer" }));
                }
                else if (NameOfOfficer.Length > 256)
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.NameOfOfficerLengthError, new[] { "NameOfOfficer" }));
                }

                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.CommencementNotInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null)
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.CommencementOthersRequired, new[] { "NewDate" }));
                }

                if ((NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime()))
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.CommencementNotBeforeOthers, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesCommand.NotificationComplete)
            {
                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.CompletedNotInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null || PaymentReceivedDate == null)
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.CompletedOthersRequired, new[] { "NewDate" }));
                }

                if ((NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime()) ||
                    (PaymentReceivedDate != null && NewDate.AsDateTime() < PaymentReceivedDate))
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.CompletedNotBeforeOthers, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesCommand.NotificationAcknowledged)
            {
                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.AcknowledgedNotInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null)
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.AcknowledgedOthersRequired, new[] { "NewDate" }));
                }

                if ((NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime()))
                {
                    yield return(new ValidationResult(KeyDatesViewModelResources.AcknowledgedNotBeforeOthers, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesCommand.FileClosed)
            {
                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return
                        (new ValidationResult(KeyDatesViewModelResources.FileClosedInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null)
                {
                    yield return
                        (new ValidationResult(KeyDatesViewModelResources.FileClosedOtherDatesRequired, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime())
                {
                    yield return
                        (new ValidationResult(KeyDatesViewModelResources.FileClosedNotBefore, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesCommand.ArchiveReference)
            {
                if (string.IsNullOrWhiteSpace(ArchiveReference))
                {
                    yield return
                        (new ValidationResult(KeyDatesViewModelResources.ArchiveReferenceRequired,
                                              new[] { "ArchiveReference" }));
                }
                else if (ArchiveReference.Length > 100)
                {
                    yield return
                        (new ValidationResult(KeyDatesViewModelResources.ArchiveReferenceLength,
                                              new[] { "ArchiveReference" }));
                }
            }
        }
Esempio n. 11
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (Command != KeyDatesStatusEnum.ArchiveReference && !NewDate.IsCompleted)
            {
                yield return(new ValidationResult("Please enter a valid date", new[] { "NewDate" }));
            }

            if (Command == KeyDatesStatusEnum.NotificationReceived)
            {
                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.ReceivedInFuture, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesStatusEnum.AssessmentCommenced)
            {
                if (string.IsNullOrWhiteSpace(NameOfOfficer))
                {
                    yield return(new ValidationResult(DateInputViewModelResources.NameOfOfficer, new[] { "NameOfOfficer" }));
                }
                else if (NameOfOfficer.Count() > 256)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.NameOfOfficerLength, new[] { "NameOfOfficer" }));
                }

                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.CommencedInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null || PaymentReceivedDate == null)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.CommencedOtherDatesRequired, new[] { "NewDate" }));
                }

                if ((NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime()) ||
                    (PaymentReceivedDate != null && NewDate.AsDateTime() < PaymentReceivedDate))
                {
                    yield return(new ValidationResult(DateInputViewModelResources.CommencedNotBefore, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesStatusEnum.NotificationComplete)
            {
                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.CompleteInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null || PaymentReceivedDate == null || CommencementDate == null)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.CompleteOtherDatesRequired, new[] { "NewDate" }));
                }

                if ((NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime()) ||
                    (PaymentReceivedDate != null && NewDate.AsDateTime() < PaymentReceivedDate))
                {
                    yield return(new ValidationResult(DateInputViewModelResources.CompleteNotBefore, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesStatusEnum.NotificationTransmitted)
            {
                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.TransmittedInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null || PaymentReceivedDate == null || CommencementDate == null ||
                    NotificationCompleteDate == null)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.TransmittedOtherDatesRequired, new[] { "NewDate" }));
                }

                if ((NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime()) ||
                    (PaymentReceivedDate != null && NewDate.AsDateTime() < PaymentReceivedDate) ||
                    (CommencementDate != null && NewDate.AsDateTime() < CommencementDate.AsDateTime()) ||
                    (NotificationCompleteDate != null && NewDate.AsDateTime() < NotificationCompleteDate.AsDateTime()))
                {
                    yield return(new ValidationResult(DateInputViewModelResources.TransmittedNotBefore, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesStatusEnum.NotificationAcknowledged)
            {
                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.AcknowledgedInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null || PaymentReceivedDate == null || CommencementDate == null ||
                    NotificationCompleteDate == null || NotificationTransmittedDate == null)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.AcknowledgedOtherDatesRequired, new[] { "NewDate" }));
                }

                if ((NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime()) ||
                    (PaymentReceivedDate != null && NewDate.AsDateTime() < PaymentReceivedDate) ||
                    (CommencementDate != null && NewDate.AsDateTime() < CommencementDate.AsDateTime()) ||
                    (NotificationCompleteDate != null && NewDate.AsDateTime() < NotificationCompleteDate.AsDateTime()) ||
                    (NotificationTransmittedDate != null && NewDate.AsDateTime() < NotificationTransmittedDate.AsDateTime()))
                {
                    yield return(new ValidationResult(DateInputViewModelResources.AcknowledgedNotBefore, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesStatusEnum.FileClosed)
            {
                if (NewDate.AsDateTime() > SystemTime.UtcNow)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.FileClosedInFuture, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate == null)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.CompleteOtherDatesRequired, new[] { "NewDate" }));
                }

                if (NotificationReceivedDate != null && NewDate.AsDateTime() < NotificationReceivedDate.AsDateTime())
                {
                    yield return(new ValidationResult(DateInputViewModelResources.FileClosedNotBefore, new[] { "NewDate" }));
                }
            }

            if (Command == KeyDatesStatusEnum.ArchiveReference)
            {
                if (string.IsNullOrWhiteSpace(ArchiveReference))
                {
                    yield return(new ValidationResult(DateInputViewModelResources.ArchiveReferenceRequired, new[] { "ArchiveReference" }));
                }
                else if (ArchiveReference.Length > 100)
                {
                    yield return(new ValidationResult(DateInputViewModelResources.ArchiveReferenceLength, new[] { "ArchiveReference" }));
                }
            }
        }
        //VER DIA Y CALENDARIZAR TODO
        public ActionResult Date(IFormCollection collection)
        {
            if (Singleton.Instance.ListInformation.isEmpty() == false)
            {
                return(View(Singleton.Instance.ListInformation));
            }
            else
            {
                //DÍA INICIAL
                DateTime StartLine    = Convert.ToDateTime(collection["Inicio"]);
                int      day          = Convert.ToInt32(StartLine.Day);
                int      month        = Convert.ToInt32(StartLine.Month);
                int      year         = Convert.ToInt32(StartLine.Year);
                int      Hour         = Convert.ToInt32(StartLine.Hour);
                int      minutes      = Convert.ToInt32(StartLine.Minute);
                int      StartMinutes = Convert.ToInt32(collection["Minutos"]);
                bool     Repeat       = false;

                //TIEMPO FINAL
                DateTime EndLine    = Convert.ToDateTime(collection["Fin"]);
                int      EndHour    = EndLine.Hour;
                int      EndMinutes = EndLine.Minute;
                int      StartHour  = Convert.ToInt32(StartLine.Hour);

                //DATOS PARA REALIZAR LA VACUNACIÓN - TIEMPO DE VACUNACIÓN
                int time = Convert.ToInt32(collection["Minutos"]);
                Singleton.Instance.Number_of_people = Convert.ToInt32(collection["Capacidad"]);

                //ORGANIZANDO FECHAS
                int  counting = Singleton.Instance.PriorityUsers.CountObj();
                int  id       = 0;
                bool TimeTV   = true;

                if (StartHour == EndHour)
                {
                    if (EndMinutes < minutes + time)
                    {
                        TimeTV = false;
                    }
                    else
                    {
                        Repeat = true;
                    }
                }

                //VERIFICANDO QUE SEA POSIBLE
                if (EndHour == StartHour + 1)
                {
                    int Part44 = minutes + time;
                    if (Part44 > 60)
                    {
                        int Part1    = 60 - (Part44 - time);
                        int minutes1 = StartMinutes - Part1;

                        if (EndMinutes < minutes1)
                        {
                            TimeTV = false;
                        }
                        else
                        {
                            Repeat = true;
                        }
                    }
                }

                if (TimeTV == true)
                {
                    //EMPEZANDO A ORGANIZAR FECHAS
                    for (int i = 0; i < counting; i++)
                    {
                        //VERIFICANDO LOS MINUTOS
                        if (minutes < 60 && (Hour == EndHour && Repeat == true) || minutes < 60 && (Hour < EndHour))
                        {
                            //RECOPILAR INFORMACIÓN DE LAS PERSONAS
                            for (int j = 0; j < Singleton.Instance.Number_of_people; j++)
                            {
                                id++;
                                //HAY ELEMENTOS EN LA COLA DE PRIORIDAD
                                if (Singleton.Instance.PriorityUsers.isEmpty() == false)
                                {
                                    //BUSCAR DPI PARA LA TABLA HASH
                                    HeapNode <PriorityInformation> DPI_Information = Singleton.Instance.PriorityUsers.HeapDelete();
                                    var SearchingInformation = new Models.UserInformation
                                    {
                                        DPI = DPI_Information.value.DPI
                                    };

                                    string minutes_string;
                                    if (minutes == 60)
                                    {
                                        minutes_string = "00";
                                    }
                                    else if (minutes < 10)
                                    {
                                        minutes_string = "0" + minutes;
                                    }
                                    else
                                    {
                                        minutes_string = Convert.ToString(minutes);
                                    }

                                    //ENCONTRANDO EL ELEMENTO EN LA TABLA HASH
                                    var UserDate = new Models.UserInformation
                                    {
                                        Nombre       = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Nombre,
                                        Apellido     = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Apellido,
                                        DPI          = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.DPI,
                                        Departamento = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Departamento,
                                        Municipio    = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Municipio,
                                        Edad         = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Edad,
                                        Teléfono     = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Teléfono,
                                        Grupo        = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Grupo,
                                        N_Registro   = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.N_Registro,
                                        Fecha        = Convert.ToDateTime(day + "/" + month + "/" + year),
                                        ID           = id
                                    };
                                    UserDate.Fecha = UserDate.Fecha.AddHours(Convert.ToDouble(Hour));
                                    UserDate.Fecha = UserDate.Fecha.AddMinutes(Convert.ToDouble(minutes_string));
                                    DPI_Information.priority.date = UserDate.Fecha;

                                    Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Fecha = UserDate.Fecha;


                                    Singleton.Instance.DateList.InsertAtEnd(UserDate.Fecha);

                                    //AGREGAR A LA LISTA
                                    if (Singleton.Instance.ListInformation.Count() == 0)
                                    {
                                        Singleton.Instance.ListInformation.InsertAtStart(UserDate);
                                    }
                                    else
                                    {
                                        Singleton.Instance.ListInformation.InsertAtEnd(UserDate);
                                    }
                                }
                            }

                            //SUMAR MINUTOS
                            minutes += time;
                            Repeat   = false;
                            i        = i + (Singleton.Instance.Number_of_people - 1);
                        }
                        else
                        {
                            //VER NUEVA FECHA
                            //COMPARAR HORAS
                            if ((Hour < EndHour) || Hour == EndHour)
                            {
                                Hour++;
                                int Part1 = 60 - (minutes - time);
                                minutes = StartMinutes - Part1;
                                bool NextDay = false;

                                if (Hour == EndHour)
                                {
                                    if (minutes < EndMinutes)
                                    {
                                        int minutes2 = minutes + time;
                                        if (minutes2 < EndMinutes)
                                        {
                                            NextDay = false;
                                            Repeat  = true;
                                        }
                                        else
                                        {
                                            NextDay = true;
                                        }
                                    }
                                    else
                                    {
                                        NextDay = true;
                                    }
                                }

                                if (Hour > EndHour)
                                {
                                    NextDay = true;
                                }

                                if (NextDay == true)
                                {
                                    //SIGUIENTE DÍA
                                    day     = NewDate.NextDateDay(month, day, year);
                                    month   = NewDate.NextDateMonth(month, day, year);
                                    year    = NewDate.NewYear(month, day, year);
                                    Hour    = StartHour;
                                    minutes = StartLine.Minute;
                                    Repeat  = true;
                                }

                                i--;
                            }
                        }
                    }

                    for (int i = 0; i < Singleton.Instance.ListInformation.Count(); i++)
                    {
                        var ReturnHeap = new Models.PriorityInformation
                        {
                            Priority = Singleton.Instance.ListInformation.ElementAt(i).Grupo,
                            DPI      = Singleton.Instance.ListInformation.ElementAt(i).DPI,
                            N_order  = Singleton.Instance.ListInformation.ElementAt(i).N_Registro
                        };

                        Singleton.Instance.PriorityUsers.HeapInsert(ReturnHeap, ReturnHeap);
                    }

                    return(View(Singleton.Instance.ListInformation));
                }
                else
                {
                    return(RedirectToAction(nameof(SameTimeError)));
                }
            }
        }
Esempio n. 13
0
 public IActionResult ViewTimes(NewDate aptDate)
 {
     return(RedirectToAction("AddAppointment", aptDate));
 }
    public Student(NewDate birthDate, NewDate successDate) {
	this.birthDate = birthDate ;
	this.successDate = successDate ;
    }
Esempio n. 15
0
   //protected void btngriddata_Click(object sender, EventArgs e)
   //{
   //    try
   //    {
   //        DateTime startDate, endDate;
   //        startDate = Convert.ToDateTime(txtSrtDate.Text);
   //        endDate = Convert.ToDateTime(txtEdDate.Text);
   //        string itemcode;
   //        itemcode = "";

   //        DataSet ds = new DataSet();
   //        ds = objBL.getstockstatement(sDataSource, startDate, endDate, itemcode);

   //        gvLedger.DataSource = ds;
   //        gvLedger.DataBind();
   //    }
   //    catch (Exception ex)
   //    {
   //        var error = ex.Message.Replace("'", "");
   //        ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Error Occured : " + @error + "');", true);
   //        return;
   //    }
   //}

     public void bindData(string sDataSource)
     {
         DateTime startDate, endDate, NewDate;
         startDate = Convert.ToDateTime(txtSrtDate.Text);
         endDate = Convert.ToDateTime(txtEdDate.Text);
         double purqtytot = 0;
         double purvaltot = 0;
         double salqtytot = 0;
         double salvaltot = 0;
         double salretqtytot = 0;
         double salretvaltot = 0;
         double purretqtytot = 0;
         double purretvaltot = 0;

         DataSet ds = new DataSet();
         string types = string.Empty;

         DataTable dt = new DataTable();
         
         dt.Columns.Add(new DataColumn("Date"));
         dt.Columns.Add(new DataColumn("Product Name"));
         dt.Columns.Add(new DataColumn("Op Qty"));
         dt.Columns.Add(new DataColumn("Op Value"));
         dt.Columns.Add(new DataColumn("Pur Qty"));
         dt.Columns.Add(new DataColumn("Pur Value"));
         dt.Columns.Add(new DataColumn("Sal Qty"));
         dt.Columns.Add(new DataColumn("Sal Value"));
         dt.Columns.Add(new DataColumn("Pur.Ret Qty"));
         dt.Columns.Add(new DataColumn("Pur.Ret Value"));
         dt.Columns.Add(new DataColumn("Sal.Ret Qty"));
         dt.Columns.Add(new DataColumn("Sal.Ret Value"));
         dt.Columns.Add(new DataColumn("Clo Qty"));
         dt.Columns.Add(new DataColumn("Clo Value"));

         TimeSpan ts = Convert.ToDateTime(endDate) - Convert.ToDateTime(startDate);
         int days = Convert.ToInt32(ts.TotalDays);

         NewDate = startDate;

         for (int i = 0; i < days+1; i++)
         {
             string aa = NewDate.ToString().ToUpper().Trim();
             string dtaa = Convert.ToDateTime(aa).ToString("dd/MM/yyyy");
             
             types = "Purchase";

             DataRow dr_export1 = dt.NewRow();
             dt.Rows.Add(dr_export1);

             ds = objBL.getdetails(sDataSource, NewDate, types);
             if (ds != null)
             {
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     foreach (DataRow dr in ds.Tables[0].Rows)
                     {
                         DataRow dr_export = dt.NewRow();
                         dr_export["Date"] = dtaa;
                         dr_export["Product Name"] = dr["productname"];
                         dr_export["Op Qty"] = "";
                         dr_export["Op Value"] = "";
                         dr_export["Pur Qty"] = dr["qty"];
                         purqtytot = purqtytot + Convert.ToDouble(dr["qty"]);
                         dr_export["Pur Value"] = dr["amount"];
                         purvaltot = purvaltot + Convert.ToDouble(dr["amount"]);
                         dr_export["Sal Qty"] = "";
                         dr_export["Sal Value"] = "";
                         dr_export["Pur.Ret Qty"] = "";
                         dr_export["Pur.Ret Value"] = "";
                         dr_export["Sal.Ret Qty"] = "";
                         dr_export["Sal.Ret Value"] = "";
                         dr_export["Clo Qty"] = "";
                         dr_export["Clo Value"] = "";
                         dt.Rows.Add(dr_export);
                     }
                 }
             }


             types = "Sales";
            
             ds = objBL.getdetails(sDataSource, NewDate, types);
             if (ds != null)
             {
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     foreach (DataRow dr in ds.Tables[0].Rows)
                     {
                         DataRow dr_export = dt.NewRow();
                         dr_export["Date"] = dtaa;
                         dr_export["Product Name"] = dr["productname"];
                         dr_export["Op Qty"] = "";
                         dr_export["Op Value"] = "";
                         dr_export["Pur Qty"] = "";
                         dr_export["Pur Value"] = "";
                         dr_export["Sal Qty"] = dr["qty"];
                         salqtytot = salqtytot + Convert.ToDouble(dr["qty"]);
                         dr_export["Sal Value"] = dr["amount"];
                         salvaltot = salvaltot + Convert.ToDouble(dr["amount"]);
                         dr_export["Pur.Ret Qty"] = "";
                         dr_export["Pur.Ret Value"] = "";
                         dr_export["Sal.Ret Qty"] = "";
                         dr_export["Sal.Ret Value"] = "";
                         dr_export["Clo Qty"] = "";
                         dr_export["Clo Value"] = "";
                         dt.Rows.Add(dr_export);
                     }
                 }
             }

             types = "PurRet";

             ds = objBL.getdetails(sDataSource, NewDate, types);
             if (ds != null)
             {
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     foreach (DataRow dr in ds.Tables[0].Rows)
                     {
                         DataRow dr_export = dt.NewRow();
                         dr_export["Date"] = dtaa;
                         dr_export["Product Name"] = dr["productname"];
                         dr_export["Op Qty"] = "";
                         dr_export["Op Value"] = "";
                         dr_export["Pur Qty"] = "";
                         dr_export["Pur Value"] = "";
                         dr_export["Sal Qty"] = "";                        
                         dr_export["Sal Value"] = "";                         
                         dr_export["Pur.Ret Qty"] = dr["qty"];
                         purretqtytot = purretqtytot + Convert.ToDouble(dr["qty"]);
                         dr_export["Pur.Ret Value"] = dr["amount"];
                         purretvaltot = purretvaltot + Convert.ToDouble(dr["amount"]);
                         dr_export["Sal.Ret Qty"] = "";
                         dr_export["Sal.Ret Value"] = "";
                         dr_export["Clo Qty"] = "";
                         dr_export["Clo Value"] = "";
                         dt.Rows.Add(dr_export);
                     }
                 }
             }

             types = "SalRet";

             ds = objBL.getdetails(sDataSource, NewDate, types);
             if (ds != null)
             {
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     foreach (DataRow dr in ds.Tables[0].Rows)
                     {
                         DataRow dr_export = dt.NewRow();
                         dr_export["Date"] = dtaa;
                         dr_export["Product Name"] = dr["productname"];
                         dr_export["Op Qty"] = "";
                         dr_export["Op Value"] = "";
                         dr_export["Pur Qty"] = "";
                         dr_export["Pur Value"] = "";
                         dr_export["Sal Qty"] = "";
                         dr_export["Sal Value"] = "";
                         dr_export["Pur.Ret Qty"] = "";                         
                         dr_export["Pur.Ret Value"] = "";                         
                         dr_export["Sal.Ret Qty"] = dr["qty"];
                         salretqtytot = salretqtytot + Convert.ToDouble(dr["qty"]);
                         dr_export["Sal.Ret Value"] =dr["amount"];
                         salretvaltot = salretvaltot + Convert.ToDouble(dr["amount"]);
                         dr_export["Clo Qty"] = "";
                         dr_export["Clo Value"] = "";
                         dt.Rows.Add(dr_export);
                     }
                 }
             }

             //DataRow dr_export2 = dt.NewRow();
             //dt.Rows.Add(dr_export2);

             DataRow dr_export3 = dt.NewRow();
             dr_export3["Date"] = dtaa + " Total";
             dr_export3["Product Name"] = "";
             dr_export3["Op Qty"] = "";
             dr_export3["Op Value"] = "";
             dr_export3["Pur Qty"] = purqtytot;
             dr_export3["Pur Value"] = purvaltot;
             dr_export3["Sal Qty"] = salqtytot;
             dr_export3["Sal Value"] = salvaltot;
             dr_export3["Pur.Ret Qty"] = purretqtytot;
             dr_export3["Pur.Ret Value"] = purretvaltot;
             dr_export3["Sal.Ret Qty"] = salretqtytot;
             dr_export3["Sal.Ret Value"] = salretvaltot;
             dr_export3["Clo Qty"] = "";
             dr_export3["Clo Value"] = "";
             dt.Rows.Add(dr_export3);

             NewDate = NewDate.AddDays(1);
             purqtytot = 0;
             purvaltot = 0;
             salqtytot = 0;
             salvaltot = 0;
             purretqtytot = 0;
             purretvaltot = 0;
             salretqtytot = 0;
             salretvaltot = 0;
         }

         ExportToExcel(dt);
     }