Example #1
0
        static void Main(string[] args)
        {
            TIME_ZONE_INFORMATION tz = new TIME_ZONE_INFORMATION();
            GetTimeZoneInformation(ref tz);

            string s = args[0];
            System.Globalization.DateTimeFormatInfo dtfi =
                new System.Globalization.DateTimeFormatInfo();
            dtfi.FullDateTimePattern = "dd/MM/yyyy HH:mm:ss zz";
            dtfi.DateSeparator = "/";
            dtfi.TimeSeparator = ":";
            DateTime dt =
                DateTime.Parse(s, dtfi);

            
            SYSTEMTIME time = new SYSTEMTIME(dt);
            //time.wDay = (ushort)dt.Day;
            //time.wHour = (ushort)dt.Hour;
            //time.wDayOfWeek = (ushort)dt.DayOfWeek;
            //time.wMilliseconds = (ushort)dt.Millisecond;
            //time.wMinute = (ushort)dt.Minute;
            //time.wMonth = (ushort)dt.Month;
            //time.wSecond = (ushort)dt.Second;
            //time.wYear = (ushort)dt.Year;

            SetSystemTime(ref time);
        }
 /// <summary>
 /// Weeks the of year.
 /// </summary>
 /// <param name="datetime">The datetime.</param>
 /// <returns></returns>
 public static int WeekOfYear(this DateTime datetime)
 {
     var dateinf = new System.Globalization.DateTimeFormatInfo();
     System.Globalization.CalendarWeekRule weekrule = dateinf.CalendarWeekRule;
     DayOfWeek firstDayOfWeek = dateinf.FirstDayOfWeek;
     return WeekOfYear(datetime, weekrule, firstDayOfWeek);
 }
Example #3
0
        public string CheckDateBeforeAdd(string date)
        {
            System.Globalization.DateTimeFormatInfo dtfi = new System.Globalization.DateTimeFormatInfo();
            System.Globalization.CultureInfo gro = System.Globalization.CultureInfo.GetCultureInfo("en-US");
            dtfi.ShortDatePattern = "yyy/MM/dd";
            dtfi.DateSeparator = "/";
            //convert string to date
            //DateTime oldDate = Convert.ToDateTime(date, dtfi);

                DateTime oldDate;
                try{
             oldDate = Convert.ToDateTime(date, dtfi);
            newDate = oldDate.ToString("yyyy/MM/dd",dtfi);

            }catch{
                    try{
                    day=Regex.Split(date,"/");
                    day[2]=getLastDayOfMonth(day[1]);

            oldDate = Convert.ToDateTime(day[0]+@"/"+day[1]+@"/"+day[2], dtfi);

            newDate = oldDate.ToString("yyyy/MM/dd",dtfi);

                //	System.Windows.Forms.MessageBox.Show(day[1]);

                    }catch(Exception daa){
                        System.Windows.Forms.MessageBox.Show(daa.Message);

                    }
                    }

            return  newDate;
        }
Example #4
0
 /// @author = KhoaHT
 /// @description : Return first or the last day of the current year of the application depend on the param
 /// @Create Date   = 10/09/2007
 public static void GetFirstAndLastDayOfYear(ref DateTime pdteFirstDay, ref DateTime pdteLastDay, int pintYear)
 {
     System.Globalization.DateTimeFormatInfo info = new System.Globalization.DateTimeFormatInfo();
     info.DateSeparator = "/";
     info.ShortDatePattern = "ddMMyyyy";
     pdteFirstDay = System.Convert.ToDateTime("01/01/" + pintYear, info);
     pdteLastDay = System.Convert.ToDateTime("31/12/" + pintYear, info);
 }
 protected void DaytimeCalendar_SelectionChanged(object sender, EventArgs e)
 {
     System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
     string monthName = mfi.GetMonthName(DaytimeCalendar.SelectedDate.Month).ToString();
     DaySelectedLabel.Text = "You Have Selected: " + DaytimeCalendar.SelectedDate.DayOfWeek.ToString() + ", " + monthName + " " + DaytimeCalendar.SelectedDate.Day.ToString() + ", for a daytime photography appointment.";
     Session["PhotoType"] = "7";
     ContinueButton.Enabled = true;
     //TwilightCalendar.SelectedDates.Clear();
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="format"></param>
        public DateViewer(string format)
        {
            if (!formatDates.ContainsKey(format))
            {
                System.Globalization.DateTimeFormatInfo formatDate = new System.Globalization.DateTimeFormatInfo();
                formatDate.ShortDatePattern = format;
                // "yy-MM-dd"; "HH:mm"; "yy-MM-dd HH:mm"; "MM-dd HH:mm";

                formatDates.Add(format, formatDate);
            }
            m_format = formatDates[format];
        }
Example #7
0
 /// <summary>
 /// This method initates a recursive Depth-First-Search
 /// </summary>
 /// <param name="person">Person node</param>
 /// <param name="descendantName">Requested person</param>
 /// <returns>Person's Birthday property as string. If null, returns Null string object.</returns>
 public string GetBirthMonth(Person person, string descendantName)
 {
     try
     {
         System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
         // Find person using recursive function
         return mfi.GetMonthName(GetDescendant(person, descendantName).Birthday.Month).ToString();
     }
     // If person is not in list of descendants, GetDescendant will return the empty string
     catch (NullReferenceException e)
     {
         Trace.Write("\n\n" + e.Message + "\n" + e.StackTrace + "\n\n");
         return "";
     }
 }
Example #8
0
        static void Main(string[] args)
        {
           
            string s = args[0];
            System.Globalization.DateTimeFormatInfo dtfi =
                new System.Globalization.DateTimeFormatInfo();
            dtfi.FullDateTimePattern = "dd/MM/yyyy HH:mm:ss";
            dtfi.ShortDatePattern = "dd/MM/yyyy";
            dtfi.ShortTimePattern = "HH:mm:ss";
            dtfi.DateSeparator = "/";
            dtfi.TimeSeparator = ":";
            

            string s1 = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss",dtfi);
            string s2 = s.Remove(s.Length - 4,4);
            string s3 = s.Substring(s.Length - 4, 4);

            DateTime dt =
                DateTime.Parse(s2, dtfi);


            SYSTEMTIME time = new SYSTEMTIME(dt);
            //time.wDay = (ushort)dt.Day;
            //time.wHour = (ushort)dt.Hour;
            //time.wDayOfWeek = (ushort)dt.DayOfWeek;
            //time.wMilliseconds = (ushort)dt.Millisecond;
            //time.wMinute = (ushort)dt.Minute;
            //time.wMonth = (ushort)dt.Month;
            //time.wSecond = (ushort)dt.Second;
            //time.wYear = (ushort)dt.Year;

            SetLocalTime(ref time);

            TIME_ZONE_INFORMATION tzI = new TIME_ZONE_INFORMATION();
            GetTimeZoneInformation(ref tzI);
            tzI.Bias = int.Parse(s3)*60;
            tzI.StandardBias = 0;
            //tzI.DaylightBias = 0;
            //tzI.StandardName = "Moscow";
            //tzI.DaylightName = "Moscow";
            //tzI.DaylightDate = time;
            //tzI.StandardDate = time;


            SetTimeZoneInformation(ref tzI);
            
            Microsoft.Win32.Registry.LocalMachine.Flush();
        }
Example #9
0
            public static Age CalculateAge(string StartDate, string EndDate)
            {
                System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo();
                dateInfo.ShortDatePattern = "yyyy-MM-dd";
                IFormatProvider culture = new System.Globalization.CultureInfo("en-GB", true);
                DateTime startDate = DateTime.Parse(StartDate, culture, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                DateTime endDate = DateTime.Parse(EndDate, culture, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                                
                //if (startDate.Date > endDate.Date)
                //{
                //    throw new ArgumentException("startDate cannot be higher then endDate", "startDate");
                //}

                int years = endDate.Year - startDate.Year;
                int months = 0;
                int days = 0;

                // Check if the last year, was a full year.
                if (endDate < startDate.AddYears(years) && years != 0)
                {
                    years--;
                }

                // Calculate the number of months.
                startDate = startDate.AddYears(years);

                if (startDate.Year == endDate.Year)
                {
                    months = endDate.Month - startDate.Month;
                }
                else
                {
                    months = (12 - startDate.Month) + endDate.Month;
                }

                // Check if last month was a complete month.
                if (endDate < startDate.AddMonths(months) && months != 0)
                {
                    months--;
                }

                // Calculate the number of days.
                startDate = startDate.AddMonths(months);

                days = (endDate - startDate).Days;

                return new Age(years, months, days);
            }
Example #10
0
        public static DateTime UTCToLocalDateTime(string str)
        {
            string xx = str;
            string[] cx = xx.Split(' ');
            System.Globalization.DateTimeFormatInfo g = new System.Globalization.DateTimeFormatInfo();
            g.LongDatePattern = "dd MMMM yyyy";

            DateTime DT = new DateTime();

            if (cx.Length == 6)
                DT = DateTime.Parse(string.Format("{0} {1} {2} {3}", cx[2], cx[1], cx[5], cx[3]), g);
            else if (cx.Length == 5)
                DT = DateTime.Parse(string.Format("{0} {1} {2} {3}", cx[2], cx[1], cx[4], cx[3]), g);
            else if (cx.Length == 7)
                DT = DateTime.Parse(string.Format("{0} {1} {2} {3}", cx[2], cx[1], cx[3], cx[4]), g);

            return DT;
        }
        /// <summary>
        /// Adds a new theme to PhotoHunt.
        /// </summary>
        /// <param name="displayName">The name shown on the theme.</param>
        /// <param name="startDate">The starting date for the theme.</param>
        /// <returns></returns>
        public static Theme AddTheme(string displayName, DateTime startDate)
        {
            PhotoHunt.model.PhotohuntContext db = new PhotoHunt.model.PhotohuntContext();

            Theme newTheme = new Theme();
            newTheme.createdTime = DateTime.Now;

            System.Globalization.DateTimeFormatInfo mfi = new
                System.Globalization.DateTimeFormatInfo();

            newTheme.created = mfi.GetMonthName(newTheme.createdTime.Month) + " " +
                newTheme.createdTime.Day + ", " + newTheme.createdTime.Year;
            newTheme.displayName = displayName;
            newTheme.start = startDate;
            newTheme.previewPhotoId = 0;
            db.Themes.Add(newTheme);
            db.SaveChanges();

            return newTheme;
        }
Example #12
0
        public JsonResult InsectosDataHora(int idRelevamiento)
        {
            var objRelevamiento = (from obj in db.Relevamientos where obj.IdRelevamiento == idRelevamiento select obj).First();
            System.Globalization.CultureInfo objCultura = new System.Globalization.CultureInfo("es-AR");
            System.Globalization.DateTimeFormatInfo objDateTimeFormat = new System.Globalization.DateTimeFormatInfo();
            System.Globalization.TextInfo objTextInfo = new System.Globalization.CultureInfo("es-AR").TextInfo;
            DataLayer objDL = new DataLayer();
            System.Data.DataTable objTabla = new System.Data.DataTable();
            objTabla = objDL.SP_GETLecturasInsectosByRelevamiento(idRelevamiento);

            var sData = new object[objTabla.Rows.Count + 1];
            string[] sCabeceras = new string[objTabla.Columns.Count];
            for (int iColumnas = 0; iColumnas < objTabla.Columns.Count; iColumnas++)
            {
                sCabeceras[iColumnas] = objTabla.Columns[iColumnas].ToString();
            }
            sData[0] = sCabeceras;

            for (int iFilas = 0; iFilas < objTabla.Rows.Count; iFilas++)
            {
                var sCeldas = new object[objTabla.Columns.Count];
                for (int iColumnas = 0; iColumnas < objTabla.Columns.Count; iColumnas++)
                {
                    if (iColumnas == 0)
                    {
                        string strHora = new DateTime(objRelevamiento.FechaInicio.Year, objRelevamiento.FechaInicio.Month, objRelevamiento.FechaInicio.Day, int.Parse(objTabla.Rows[iFilas][iColumnas].ToString()), 0, 0).ToString("hh", objCultura);
                        sCeldas[iColumnas] = strHora; //objTabla.Rows[iFilas][iColumnas].ToString();
                    }
                    else
                    {
                        sCeldas[iColumnas] = int.Parse(objTabla.Rows[iFilas][iColumnas].ToString());
                    }
                }
                sData[iFilas + 1] = sCeldas;
            }

            return new JsonResult { Data = sData, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }
Example #13
0
        protected override void Render(HtmlTextWriter writer)
        {
            try
            {
                DateTime tmpDate;
                try
                {
                    tmpDate = this.SelectedDate == "" ? DateTime.Now : Convert.ToDateTime(SelectedDate);
                }
                catch (Exception ex)
                {
                    tmpDate = DateTime.Now;
                }


                string temp = CssClass;
                CssClass = "";
                if (temp == "")
                {
                    temp = "ampicker";
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString());
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                if (Text != "")
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "white-space:nowrap");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(Text);
                    writer.RenderEndTag();
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString());
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute("class", temp);
                writer.AddAttribute("id", ClientID);
                writer.AddAttribute("name", ClientID);
                writer.AddAttribute("onblur", "return window." + ClientID + ".onblur(this);");
                writer.AddAttribute("onkeypress", "return window." + ClientID + ".onlyDateChars(event);");
                //writer.AddAttribute("onkeydown", "return window." & Me.ClientID & ".KeyPress(event);")
                //writer.AddAttribute("onclick", "return window." & Me.ClientID & ".Click(event);showalert();")
                if (Enabled == false)
                {
                    writer.AddAttribute("disabled", "disabled");
                }
                if (ShowDateBox)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Input);
                    writer.RenderEndTag();
                }
                dtFI = Thread.CurrentThread.CurrentCulture.DateTimeFormat;
                if (!(string.IsNullOrEmpty(SelectedDate)))
                {
                    DateTime dte = DateTime.Parse(SelectedDate);
                    SelectedDate = dte.ToString(dtFI.ShortDatePattern + " " + dtFI.ShortTimePattern);
                }
                writer.AddAttribute("type", "hidden");
                writer.AddAttribute("id", "hid_" + ClientID);
                writer.AddAttribute("name", "hid_" + ClientID);
                writer.AddAttribute("value", SelectedDate);
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();
                writer.AddAttribute("id", "cal_" + ClientID);
                writer.AddAttribute("style", "display:none;position:absolute;");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if (ImageUrl == string.Empty)
                {
                    ImageUrl = Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.calendar.gif");
                }
                if (Enabled)
                {
                    writer.AddAttribute("src", ImageUrl);
                    writer.AddAttribute("onclick", "window." + ClientID + ".Toggle(event);");
                    writer.AddAttribute("id", "img_" + ClientID);
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag();
                }
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderEndTag();
                var str = new StringBuilder();
                str.Append("<script type=\"text/javascript\">");

                cal = new System.Globalization.GregorianCalendar();
                if (Thread.CurrentThread.CurrentCulture != null)
                {
                    cal = Thread.CurrentThread.CurrentCulture.Calendar;
                }
                DateFormat = dtFI.ShortDatePattern;
                TimeFormat = dtFI.ShortTimePattern;
                str.Append("window." + ClientID + "=new asDatePicker('" + ClientID + "');");
                str.Append("window." + ClientID + ".Locale='" + Context.Request.UserLanguages[0].Substring(0, 2).ToUpper() + "';");
                str.Append("window." + ClientID + ".SelectedDate='" + SelectedDate + "';");
                str.Append("window." + ClientID + ".Width='" + CalendarWidth + "';");
                str.Append("window." + ClientID + ".Height='" + CalendarHeight + "';");
                str.Append("window." + ClientID + ".DateFormat='" + dtFI.ShortDatePattern + "';");
                str.Append("window." + ClientID + ".TimeFormat='" + dtFI.ShortTimePattern + "';");
                str.Append("window." + ClientID + ".Year=" + tmpDate.Year + ";");
                str.Append("window." + ClientID + ".Month=" + (tmpDate.Month - 1) + ";");
                str.Append("window." + ClientID + ".Day=" + tmpDate.Day + ";");
                str.Append("window." + ClientID + ".SelectedYear=" + tmpDate.Year + ";");
                str.Append("window." + ClientID + ".SelectedMonth=" + (tmpDate.Month - 1) + ";");
                str.Append("window." + ClientID + ".SelectedDay=" + tmpDate.Day + ";");
                str.Append("window." + ClientID + ".ShowTime=" + ShowTime.ToString().ToLower() + ";");
                str.Append("window." + ClientID + ".DefaultTime='" + DefaultTime + "';");
                str.Append("window." + ClientID + ".CallbackFlag='" + CallbackFlag + "';");
                if (!(string.IsNullOrEmpty(RelatedControl)))
                {
                    Control ctl = Parent.FindControl(RelatedControl);
                    if (ctl == null)
                    {
                        ctl = Page.FindControl(RelatedControl);
                    }
                    if (ctl == null)
                    {
                        RelatedControl = string.Empty;
                    }
                    else
                    {
                        RelatedControl = ctl.ClientID;
                    }
                }
                str.Append("window." + ClientID + ".linkedControl='" + RelatedControl + "';");
                if (IsEndDate)
                {
                    str.Append("window." + ClientID + ".isEndDate=true;");
                }
                else
                {
                    str.Append("window." + ClientID + ".isEndDate=false;");
                }

                string sTime = string.Empty;
                SelectedTime = tmpDate.ToString(TimeFormat);
                if (ShowTime)
                {
                    if (SelectedTime != "12:00 AM")
                    {
                        sTime = SelectedTime;
                    }
                    if (TimeRequired)
                    {
                        str.Append("window." + ClientID + ".RequireTime=true;");
                    }
                    else
                    {
                        str.Append("window." + ClientID + ".RequireTime=false;");
                    }
                }
                else
                {
                    str.Append("window." + ClientID + ".RequireTime=false;");
                }

                str.Append("window." + ClientID + ".SelectedTime='" + sTime + "';");
                if (string.IsNullOrEmpty(ImgNext))
                {
                    str.Append("window." + ClientID + ".ImgNext='" + Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cal_nextMonth.gif") + "';");
                }
                else
                {
                    str.Append("window." + ClientID + ".ImgNext='" + Page.ResolveUrl(ImgNext) + "';");
                }
                if (string.IsNullOrEmpty(ImgPrev))
                {
                    str.Append("window." + ClientID + ".ImgPrev='" + Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cal_prevMonth.gif") + "';");
                }
                else
                {
                    str.Append("window." + ClientID + ".ImgPrev='" + Page.ResolveUrl(ImgPrev) + "';");
                }
                if (SelectedDate != "")
                {
                    try
                    {
                        if (ShowTime == false && sTime == string.Empty)
                        {
                            str.Append("window." + ClientID + ".textbox.value=new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + ").formatDP('" + DateFormat + "','" + ClientID + "');");
                            str.Append("window." + ClientID + ".dateSel = new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + ",0,0,0,0);");
                        }
                        else
                        {
                            str.Append("window." + ClientID + ".textbox.value=new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + "," + tmpDate.Hour + "," + tmpDate.Minute + ",0).formatDP('" + DateFormat + " " + TimeFormat + "','" + ClientID + "');");
                            str.Append("window." + ClientID + ".dateSel = new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + "," + tmpDate.Hour + "," + tmpDate.Minute + ",0);");
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                int xMonths   = cal.GetMonthsInYear(cal.GetYear(tmpDate), cal.GetEra(tmpDate));
                int currMonth = cal.GetMonth(tmpDate);
                int currYear  = cal.GetYear(tmpDate);
                int currDay   = cal.GetDayOfMonth(tmpDate);

                str.Append("window." + ClientID + ".MonthDays = new Array(");
                for (int i = 0; i < xMonths; i++)
                {
                    str.Append(cal.GetDaysInMonth(currYear, i + 1));
                    if (i < (xMonths - 1))
                    {
                        str.Append(",");
                    }
                }
                str.Append(");");
                str.AppendLine();

                string[] mNames = dtFI.MonthNames;
                str.Append("window." + ClientID + ".MonthNames = new Array(");
                for (int i = 0; i < xMonths; i++)
                {
                    str.Append("'" + mNames[i] + "'");
                    if (i < (xMonths - 1))
                    {
                        str.Append(",");
                    }
                }
                str.Append(");");
                str.AppendLine();
                str.Append("window." + ClientID + ".ShortMonthNames = new Array(");
                string[] mAbbr = dtFI.AbbreviatedMonthNames;
                for (int i = 0; i < xMonths; i++)
                {
                    str.Append("'" + mAbbr[i] + "'");
                    if (i < (xMonths - 1))
                    {
                        str.Append(",");
                    }
                }
                str.Append(");");
                str.AppendLine();
                str.Append("window." + ClientID + ".ShortDayNames = new Array(");
                string[] dAbbr = dtFI.AbbreviatedDayNames;
                for (int i = 0; i <= 6; i++)
                {
                    str.Append("'" + dAbbr[i] + "'");
                    if (i < 6)
                    {
                        str.Append(",");
                    }
                }
                str.Append(");");
                str.AppendLine();

                str.Append("window." + ClientID + ".Class={");
                str.Append("CssCalendarStyle:'" + CssCalendarStyle + "',");
                str.Append("CssMonthStyle:'" + CssMonthStyle + "',");
                str.Append("CssWeekendStyle:'" + CssWeekendStyle + "',");
                str.Append("CssWeekdayStyle:'" + CssWeekdayStyle + "',");
                str.Append("CssSelectedDayStyle:'" + CssSelectedDayStyle + "',");
                str.Append("CssCurrentMonthDayStyle:'" + CssCurrentMonthDayStyle + "',");
                str.Append("CssOtherMonthDayStyle:'" + CssOtherMonthDayStyle + "',");
                str.Append("CssDayHeaderStyle:'" + CssDayHeaderStyle + "',");
                str.Append("CssCurrentDayStyle:'" + CssCurrentDayStyle + "'};");
                str.Append("window." + ClientID + ".selectedDate=window." + ClientID + ".textbox.value;");
                str.Append("window." + ClientID + ".timeLabel='[RESX:Time]';");



                str.Append("</script>");
                writer.Write(str);
            }
            catch (Exception ex)
            {
            }
        }
Example #14
0
 public DateString(string format)
 {
     formatter = new System.Globalization.DateTimeFormatInfo();
 }
Example #15
0
        public SetFilterForm(Type dataType, Boolean DateWithTime = true, Boolean TimeFilter = false)
            : this()
        {
            if (dataType == typeof(DateTime))
            {
                this.filterType = FilterType.DateTime;
            }
            else if (dataType == typeof(Int32) || dataType == typeof(Int64) || dataType == typeof(Int16) ||
                     dataType == typeof(UInt32) || dataType == typeof(UInt64) || dataType == typeof(UInt16) ||
                     dataType == typeof(Byte) || dataType == typeof(SByte))
            {
                this.filterType = FilterType.Integer;
            }
            else if (dataType == typeof(Single) || dataType == typeof(Double) || dataType == typeof(Decimal))
            {
                this.filterType = FilterType.Float;
            }
            else if (dataType == typeof(String))
            {
                this.filterType = FilterType.String;
            }
            else
            {
                this.filterType = FilterType.Unknown;
            }

            this.dateWithTime = DateWithTime;
            this.timeFilter   = TimeFilter;
            switch (this.filterType)
            {
            case FilterType.DateTime:
                this.val1contol = new DateTimePicker();
                this.val2contol = new DateTimePicker();
                if (this.timeFilter)
                {
                    System.Globalization.DateTimeFormatInfo dt = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat;

                    (this.val1contol as DateTimePicker).CustomFormat = dt.ShortDatePattern + " " + dt.LongTimePattern;
                    (this.val2contol as DateTimePicker).CustomFormat = dt.ShortDatePattern + " " + dt.LongTimePattern;
                    (this.val1contol as DateTimePicker).Format       = DateTimePickerFormat.Custom;
                    (this.val2contol as DateTimePicker).Format       = DateTimePickerFormat.Custom;
                }
                else
                {
                    (this.val1contol as DateTimePicker).Format = DateTimePickerFormat.Short;
                    (this.val2contol as DateTimePicker).Format = DateTimePickerFormat.Short;
                }

                this.FilterTypeComboBox.Items.AddRange(new String[] {
                    this.RM.GetString("setfilterform_filtertypecombobox_equal"),
                    this.RM.GetString("setfilterform_filtertypecombobox_notequal"),
                    this.RM.GetString("setfilterform_filtertypecombobox_before"),
                    this.RM.GetString("setfilterform_filtertypecombobox_after"),
                    this.RM.GetString("setfilterform_filtertypecombobox_between")
                });
                break;

            case FilterType.Integer:
            case FilterType.Float:
                this.val1contol              = new TextBox();
                this.val2contol              = new TextBox();
                this.val1contol.TextChanged += eControlTextChanged;
                this.val2contol.TextChanged += eControlTextChanged;
                this.FilterTypeComboBox.Items.AddRange(new String[] {
                    this.RM.GetString("setfilterform_filtertypecombobox_equal"),
                    this.RM.GetString("setfilterform_filtertypecombobox_notequal"),
                    this.RM.GetString("setfilterform_filtertypecombobox_larger"),
                    this.RM.GetString("setfilterform_filtertypecombobox_lagerequals"),
                    this.RM.GetString("setfilterform_filtertypecombobox_less"),
                    this.RM.GetString("setfilterform_filtertypecombobox_lessequals"),
                    this.RM.GetString("setfilterform_filtertypecombobox_between")
                });
                this.val1contol.Tag   = true;
                this.val2contol.Tag   = true;
                this.okButton.Enabled = false;
                break;

            default:
                this.val1contol = new TextBox();
                this.val2contol = new TextBox();
                this.FilterTypeComboBox.Items.AddRange(new String[] {
                    this.RM.GetString("setfilterform_filtertypecombobox_equal"),
                    this.RM.GetString("setfilterform_filtertypecombobox_notequal"),
                    this.RM.GetString("setfilterform_filtertypecombobox_begins"),
                    this.RM.GetString("setfilterform_filtertypecombobox_nobegins"),
                    this.RM.GetString("setfilterform_filtertypecombobox_ends"),
                    this.RM.GetString("setfilterform_filtertypecombobox_noends"),
                    this.RM.GetString("setfilterform_filtertypecombobox_contain"),
                    this.RM.GetString("setfilterform_filtertypecombobox_nocontain")
                });
                break;
            }
            this.FilterTypeComboBox.SelectedIndex = 0;

            this.val1contol.Name     = "val1contol";
            this.val1contol.Location = new System.Drawing.Point(30, 66);
            this.val1contol.Size     = new System.Drawing.Size(166, 20);
            this.val1contol.TabIndex = 4;
            this.val1contol.Visible  = true;
            this.val1contol.KeyDown += eControlKeyDown;

            this.val2contol.Name            = "val2contol";
            this.val2contol.Location        = new System.Drawing.Point(30, 108);
            this.val2contol.Size            = new System.Drawing.Size(166, 20);
            this.val2contol.TabIndex        = 5;
            this.val2contol.Visible         = false;
            this.val2contol.VisibleChanged += new EventHandler(val2contol_VisibleChanged);
            this.val2contol.KeyDown        += eControlKeyDown;

            this.Controls.Add(this.val1contol);
            this.Controls.Add(this.val2contol);

            this.errorProvider.SetIconAlignment(this.val1contol, ErrorIconAlignment.MiddleRight);
            this.errorProvider.SetIconPadding(this.val1contol, -18);
            this.errorProvider.SetIconAlignment(this.val2contol, ErrorIconAlignment.MiddleRight);
            this.errorProvider.SetIconPadding(this.val2contol, -18);
            this.val1contol.Select();
        }
Example #16
0
        /// <summary>
        /// 下载文件
        /// </summary>
        /// <param name="FileName"></param>
        /// <param name="strUrl"></param>
        private void DownloadFile(string FileName, string strUrl)
        {
            HttpWebRequest  webRequest;
            HttpWebResponse webResponse = null;
            FileWebRequest  fileRequest;
            FileWebResponse fileResponse = null;
            bool            isFile       = false;

            try
            {
                System.Globalization.DateTimeFormatInfo dfi = null;
                System.Globalization.CultureInfo        ci  = null;
                ci  = new System.Globalization.CultureInfo("zh-CN");
                dfi = new System.Globalization.DateTimeFormatInfo();

                //WebRequest wr = WebRequest.Create("");

                //System.Net.WebResponse w=wr.
                DateTime      fileDate;
                long          totalBytes;
                DirectoryInfo theFolder = new DirectoryInfo(strTemp);
                string        fileName  = theFolder + FileName;
                if (strUrl.EndsWith(".exe"))
                {
                    strUrl = strUrl.Replace(".exe", ".dll");
                }
                isFile = (HttpWebRequest.Create(strUrl) is FileWebRequest);

                if (isFile)
                {
                    fileRequest  = (FileWebRequest)FileWebRequest.Create(strUrl);
                    fileResponse = (FileWebResponse)fileRequest.GetResponse();
                    if (fileResponse == null)
                    {
                        return;
                    }
                    fileDate   = DateTime.Now;
                    totalBytes = fileResponse.ContentLength;
                }
                else
                {
                    webRequest  = (HttpWebRequest)HttpWebRequest.Create(strUrl);
                    webResponse = (HttpWebResponse)webRequest.GetResponse();
                    if (webResponse == null)
                    {
                        return;
                    }
                    fileDate   = webResponse.LastModified;
                    totalBytes = webResponse.ContentLength;
                }

                pbUpdate.Maximum = Convert.ToInt32(totalBytes);

                Stream stream;
                if (isFile)
                {
                    stream = fileResponse.GetResponseStream();
                }
                else
                {
                    stream = webResponse.GetResponseStream();
                }
                FileStream sw = new FileStream(fileName, FileMode.Create);
                int        totalDownloadedByte = 0;
                Byte[]     @by   = new byte[1024];
                int        osize = stream.Read(@by, 0, @by.Length);
                while (osize > 0)
                {
                    totalDownloadedByte = osize + totalDownloadedByte;
                    Application.DoEvents();
                    sw.Write(@by, 0, osize);
                    pbUpdate.Value = totalDownloadedByte;
                    osize          = stream.Read(@by, 0, @by.Length);
                }
                sw.Close();
                stream.Close();

                //System.Diagnostics.Process[] proc = System.Diagnostics.Process.GetProcessesByName(AppName);

                ////关闭原有应用程序的所有进程
                //foreach (System.Diagnostics.Process pro in proc)
                //{
                //    pro.Kill();
                //}


                //DirectoryInfo theFolder = new DirectoryInfo(Path.GetTempPath() + "ysy");
                if (theFolder.Exists)
                {
                    foreach (FileInfo theFile in theFolder.GetFiles())
                    {
                        if (theFile.Name != UpdExeName + ".exe" && theFile.Name != UpdExeName + ".pdb" && theFile.Name != "Config.xml")
                        {
                            //如果临时文件夹下存在与应用程序所在目录下的文件同名的文件,则删除应用程序目录下的文件
                            if (File.Exists(this.m_workPath + "\\" + Path.GetFileName(theFile.FullName)))
                            {
                                File.Delete(this.m_workPath + "\\" + Path.GetFileName(theFile.FullName));
                                //将临时文件夹的文件移到应用程序所在的目录下
                                File.Move(theFile.FullName, this.m_workPath + "\\" + Path.GetFileName(theFile.FullName));
                            }
                        }
                    }
                }
                File.SetLastWriteTime(FileName, fileDate);
            }
            catch (Exception ex)
            {
                if (fileResponse != null)
                {
                    fileResponse.Close();
                }

                if (webResponse != null)
                {
                    webResponse.Close();
                }

                // MessageBox.Show(ex.Message);
                lblStatus.Text = "更新出错!" + ex.Message;
                lblStatus.Refresh();
            }
        }
Example #17
0
        static void Main(string[] args)
        {
            // Create Reference to Azure Storage Account
            String strorageconn            = System.Configuration.ConfigurationSettings.AppSettings.Get("StorageConnectionString");
            CloudStorageAccount storageacc = CloudStorageAccount.Parse(strorageconn);

            //Create Reference to Azure Blob
            CloudBlobClient blobClient = storageacc.CreateCloudBlobClient();

            //The next 2 lines create if not exists a container named "democontainer"
            CloudBlobContainer container = blobClient.GetContainerReference("democontainer");

            container.CreateIfNotExists();


            //The next lines extract metadata from the file and upload it with the name DemoBlob on the container "democontainer"
            CloudBlockBlob blockBlob = container.GetBlockBlobReference("DemoUpload");

            using (var filestream = System.IO.File.OpenRead(@"/Users/DemoUser/Desktop/sample_srt.srt"))
            {
                //Extracts the 4th line of the SRT file and extracts the date and time
                string   datetime      = System.IO.File.ReadLines("/Users/DemoUser/Desktop/sample_srt.srt").Skip(3).Take(1).First();
                string[] datetimewords = datetime.Split(' ');
                string[] timewords     = datetimewords[1].Split(',');

                //Changes the date from numeric form to readable form (2019-02-28 to February 28, 2019)
                string[] wordmonth = datetimewords[0].Split('-');
                string   month     = wordmonth[1];
                int      monthnum  = int.Parse(month);
                System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
                string monthname = mfi.GetMonthName(monthnum).ToString();

                string datewords = monthname + " " + wordmonth[2] + ", " + wordmonth[0];

                //Extracts the 5th line of the SRT file
                string latlong = System.IO.File.ReadLines("/Users/DemoUser/Desktop/sample_srt.srt").Skip(4).Take(1).First();

                //Extracts the latitude and longitude from the 5th line
                string[] latlongspec = latlong.Split(']');
                string[] lat         = latlongspec[7].Split(' ');
                string[] log         = latlongspec[8].Split(' ');

                //Sets up coordinate string
                string coord      = "(" + lat[2] + "," + log[2] + ")";
                string coordnopar = lat[2] + "," + log[2];

                //Creates a link that uses Azure Maps API to get cross street information from the given coordinates
                string crossurl = "https://atlas.microsoft.com/search/address/reverse/crossStreet/json?subscription-key=<ADD-AZURE-MAPS-CONNECTION-STRING-HERE>&api-version=1.0&query=" + coordnopar;

                //Reads the JSON file from the link and converts to it to string
                var    jsoncross    = new WebClient().DownloadString(crossurl);
                string jsoncrossstr = jsoncross.ToString();

                //Extracts text from the JSON file
                string[] crosss = jsoncross.Split('"');

                string crossstreet = "";

                //If cross street data was found, it extracts it. If not, the variable is assigned "N/A"
                if (jsoncrossstr.Contains("streetName"))
                {
                    string[] streetnamesplit  = jsoncrossstr.Split(new string[] { "streetName" }, StringSplitOptions.None);
                    string[] streetnamesplit2 = streetnamesplit[1].Split('"');
                    crossstreet = streetnamesplit2[2];
                }

                else
                {
                    crossstreet = "N/A";
                }

                //Metadata being added to the uploaded blobs
                blockBlob.Metadata.Add("Date", datetimewords[0]);
                blockBlob.Metadata.Add("Time", timewords[0]);
                blockBlob.Metadata.Add("Coordinates", coord);
                blockBlob.Metadata.Add("CrossStreet", crossstreet);
                blockBlob.Metadata.Add("FullDate", datewords);

                //Blob uploaded to Blob Storage
                blockBlob.UploadFromStream(filestream);
            }
        }
 public static DateTime GetDateTimeForDayOfWeek(this DateTime datetime, DayOfWeek day)
 {
     System.Globalization.DateTimeFormatInfo dateinf = new System.Globalization.DateTimeFormatInfo();
     DayOfWeek firstDayOfWeek = dateinf.FirstDayOfWeek;
     return GetDateTimeForDayOfWeek(datetime, day, firstDayOfWeek);
 }
Example #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string selectedServer     = "";
            string selectedServerList = "";
            string date;

            exactmatch = false;
            if (this.ServerFilterTextBox.Text != "")
            {
                selectedServer = this.ServerFilterTextBox.Text;
            }
            if (this.ServerListFilterListBox.SelectedItems.Count > 0)
            {
                selectedServer = "";
                for (int i = 0; i < this.ServerListFilterListBox.SelectedItems.Count; i++)
                {
                    selectedServer     += this.ServerListFilterListBox.SelectedItems[i].Text + ",";
                    selectedServerList += "'" + this.ServerListFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                exactmatch = true;
                try
                {
                    selectedServer     = selectedServer.Substring(0, selectedServer.Length - 1);
                    selectedServerList = selectedServerList.Substring(0, selectedServerList.Length - 1);
                }
                catch
                {
                    selectedServer     = ""; // throw ex;
                    selectedServerList = "";
                    exactmatch         = false;
                }
                finally { }
            }
            if (this.DateParamEdit.Text == "")
            {
                date = DateTime.Now.ToString();
                this.DateParamEdit.Date = Convert.ToDateTime(date);
            }
            else
            {
                date = this.DateParamEdit.Value.ToString();
            }
            DateTime dt = Convert.ToDateTime(date);

            DashboardReports.OverallStatisticsXtraRpt report = new DashboardReports.OverallStatisticsXtraRpt();
            report.Parameters["DateM"].Value = dt.Month;
            report.Parameters["DateY"].Value = dt.Year;
            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
            string strMonthName = mfi.GetMonthName(dt.Month).ToString() + ", " + dt.Year.ToString();

            report.Parameters["MonthYear"].Value     = strMonthName;
            report.Parameters["ServerName"].Value    = selectedServer;
            report.Parameters["ServerNameSQL"].Value = selectedServerList;
            report.Parameters["ExactMatch"].Value    = exactmatch;
            report.PageColor          = Color.Transparent;
            this.ReportViewer1.Report = report;
            this.ReportViewer1.DataBind();
            if (!IsPostBack)
            {
                fillcombo();
            }
        }
 public static System.Globalization.DateTimeFormatInfo ReadOnly(System.Globalization.DateTimeFormatInfo dtfi)
 {
     throw null;
 }
Example #21
0
        public override void Run()
        {
            //base.Run();
            OleExec SFCDB = DBPools["SFCDB"].Borrow();

            try
            {
                System.Globalization.DateTimeFormatInfo format = new System.Globalization.DateTimeFormatInfo();
                format.ShortDatePattern = "yyyy/MM/dd";
                DateTime runDate         = Convert.ToDateTime(date.Value.ToString(), format);
                string   runLine         = line.Value.ToString();
                string   runSkuno        = skuno.Value.ToString();
                string   runShift        = shift.Value.ToString();
                string   runSqlUPH       = $@"select uph.production_line,uph.class_name,uph.work_time,uph.station_name,(sum(uph.total_fresh_build_qty)+sum(uph.total_rework_build_qty)) as qty 
                                        from r_uph_detail uph where 1=1 ";
                string   runSqlStation   = $@"select detail.station_name from r_sku_route route,c_sku sku,c_route_detail detail where sku.skuno='{runSkuno}'
                                            and sku.id=route.sku_id and route.route_id=detail.route_id  order by detail.seq_no";
                string   runSqlWorkClass = $@"select * from c_work_class";

                string runSqlShift1  = $@"select * from  c_work_class where name='SHIFT 1'  order by start_time";
                string runSqlShift21 = $@"select  * from c_work_class where name='SHIFT 2' and start_time>='20:00' order by start_time";
                string runSqlShift22 = $@"select  * from c_work_class where name='SHIFT 2' and start_time<'20:00' order by start_time";

                if (string.IsNullOrEmpty(runSkuno) || runSkuno == "")
                {
                    throw new Exception("Please input skuno!");
                }
                runSqlUPH = runSqlUPH + $@" and uph.skuno='{runSkuno}'  ";
                if (runLine.ToUpper() != "ALL")
                {
                    runSqlUPH = runSqlUPH + $@"  and uph.production_line='{runLine}' ";
                    lineList  = new List <string>();
                    lineList.Add(runLine);
                }
                else
                {
                    runSqlUPH = runSqlUPH + $@" and exists(select * from c_line cl where cl.line_name=uph.production_line) ";
                }
                if (runShift.ToUpper() != "ALL")
                {
                    runSqlUPH = runSqlUPH + $@" and uph.class_name ='{runShift}' ";
                }
                else
                {
                    runSqlUPH = runSqlUPH + $@" and exists(select * from c_work_class wc where uph.class_name=wc.name) ";
                }
                runSqlUPH = runSqlUPH + $@" and uph.work_date=to_date('{runDate.ToString("yyyy/MM/dd")}','yyyy/mm/dd')
                                            group by uph.work_time,uph.station_name,uph.production_line,uph.class_name
                                            order by uph.work_time,uph.station_name,uph.production_line";
                DataTable tableUPH       = SFCDB.RunSelect(runSqlUPH).Tables[0];
                DataTable stationTable   = SFCDB.RunSelect(runSqlStation).Tables[0];
                DataTable workClassTable = SFCDB.RunSelect(runSqlWorkClass).Tables[0];
                DataTable tableShift1    = SFCDB.RunSelect(runSqlShift1).Tables[0];
                DataTable tableShift21   = SFCDB.RunSelect(runSqlShift21).Tables[0];
                DataTable tableShift22   = SFCDB.RunSelect(runSqlShift22).Tables[0];
                if (SFCDB != null)
                {
                    DBPools["SFCDB"].Return(SFCDB);
                }

                if (tableUPH.Rows.Count == 0)
                {
                    throw new Exception("No Data!");
                }
                if (stationTable.Rows.Count == 0)
                {
                    throw new Exception("This shuno no station!");
                }
                if (stationTable.Rows.Count == 0)
                {
                    throw new Exception("Cant't setting the work class!");
                }
                DataRow[]     stationRow;
                UPHObject     skuUPH = new UPHObject();
                LineUPHObject lineUPH;
                SationUPH     stationUPH;
                TimeUPH       workTimeUPH;
                skuUPH.Skuno   = runSkuno;
                skuUPH.LineUPH = new List <LineUPHObject>();
                List <WorkClassObject> WorkClass = new List <WorkClassObject>();

                if (runShift.ToUpper() != "ALL")
                {
                    WorkClassObject wcObject = new WorkClassObject();
                    wcObject.WorkClassType = runShift.ToUpper();
                    wcObject.WorkTime      = new List <string>();
                    if (runShift.ToUpper() == "SHIFT 1")
                    {
                        for (int i = 0; i < tableShift1.Rows.Count; i++)
                        {
                            wcObject.WorkTime.Add(tableShift1.Rows[i]["START_TIME"].ToString() + "-" + tableShift1.Rows[i]["END_TIME"].ToString());
                        }
                    }
                    else
                    {
                        for (int i = 0; i < tableShift21.Rows.Count; i++)
                        {
                            wcObject.WorkTime.Add(tableShift21.Rows[i]["START_TIME"].ToString() + "-" + tableShift21.Rows[i]["END_TIME"].ToString());
                        }
                        for (int i = 0; i < tableShift22.Rows.Count; i++)
                        {
                            wcObject.WorkTime.Add(tableShift22.Rows[i]["START_TIME"].ToString() + "-" + tableShift22.Rows[i]["END_TIME"].ToString());
                        }
                    }
                    WorkClass.Add(wcObject);
                }
                else
                {
                    WorkClassObject shift1Object = new WorkClassObject();
                    shift1Object.WorkClassType = "SHIFT1";
                    shift1Object.WorkTime      = new List <string>();
                    for (int i = 0; i < tableShift1.Rows.Count; i++)
                    {
                        shift1Object.WorkTime.Add(tableShift1.Rows[i]["START_TIME"].ToString() + "-" + tableShift1.Rows[i]["END_TIME"].ToString());
                    }
                    WorkClass.Add(shift1Object);

                    WorkClassObject shift2Object = new WorkClassObject();
                    shift2Object.WorkClassType = "SHIFT2";
                    shift2Object.WorkTime      = new List <string>();
                    for (int i = 0; i < tableShift21.Rows.Count; i++)
                    {
                        shift2Object.WorkTime.Add(tableShift21.Rows[i]["START_TIME"].ToString() + "-" + tableShift21.Rows[i]["END_TIME"].ToString());
                    }
                    for (int i = 0; i < tableShift22.Rows.Count; i++)
                    {
                        shift2Object.WorkTime.Add(tableShift22.Rows[i]["START_TIME"].ToString() + "-" + tableShift22.Rows[i]["END_TIME"].ToString());
                    }
                    WorkClass.Add(shift2Object);
                }
                Outputs.Add(WorkClass);

                foreach (string line in lineList)
                {
                    lineUPH               = new LineUPHObject();
                    lineUPH.LineName      = line;
                    lineUPH.StationUPHQTY = new List <SationUPH>();
                    foreach (DataRow row in stationTable.Rows)
                    {
                        stationUPH             = new SationUPH();
                        stationUPH.StationName = row["STATION_NAME"].ToString();
                        stationUPH.Shift1Total = 0;
                        stationUPH.Shift2Total = 0;
                        stationUPH.Total       = 0;
                        stationUPH.UPH         = new List <TimeUPH>();
                        stationRow             = tableUPH.Select(" PRODUCTION_LINE= '" + line + "' and STATION_NAME='" + row["STATION_NAME"].ToString() + "'");
                        if (stationRow.Length > 0)
                        {
                            for (int j = 0; j < workClassTable.Rows.Count; j++)
                            {
                                workTimeUPH       = new TimeUPH();
                                workTimeUPH.Shift = workClassTable.Rows[j]["NAME"].ToString();
                                workTimeUPH.Time  = workClassTable.Rows[j]["START_TIME"].ToString() + "-" + workClassTable.Rows[j]["END_TIME"].ToString();
                                workTimeUPH.Qty   = "0";
                                for (int i = 0; i < stationRow.Length; i++)
                                {
                                    if (workClassTable.Rows[j]["START_TIME"].ToString().Split(':')[0].Equals(stationRow[i]["WORK_TIME"].ToString()))
                                    {
                                        workTimeUPH.Qty = stationRow[i]["QTY"].ToString();
                                        break;
                                    }
                                }
                                if (workTimeUPH.Shift == "SHIFT 1")
                                {
                                    stationUPH.Shift1Total = Convert.ToInt32(stationUPH.Shift1Total) + Convert.ToInt32(workTimeUPH.Qty);
                                }
                                if (workTimeUPH.Shift == "SHIFT 2")
                                {
                                    stationUPH.Shift2Total = Convert.ToInt32(stationUPH.Shift2Total) + Convert.ToInt32(workTimeUPH.Qty);
                                }

                                stationUPH.UPH.Add(workTimeUPH);
                            }
                        }
                        else
                        {
                            for (int j = 0; j < workClassTable.Rows.Count; j++)
                            {
                                workTimeUPH       = new TimeUPH();
                                workTimeUPH.Shift = workClassTable.Rows[j]["NAME"].ToString();
                                workTimeUPH.Time  = workClassTable.Rows[j]["START_TIME"].ToString() + "-" + workClassTable.Rows[j]["END_TIME"].ToString();
                                workTimeUPH.Qty   = "0";
                                stationUPH.UPH.Add(workTimeUPH);
                            }
                        }
                        stationUPH.Total = stationUPH.Shift2Total + stationUPH.Shift1Total;
                        lineUPH.StationUPHQTY.Add(stationUPH);
                    }
                    skuUPH.LineUPH.Add(lineUPH);
                }
                if (skuUPH.LineUPH.Count > 0)
                {
                }
                Outputs.Add(skuUPH);
            }
            catch (Exception exception)
            {
                if (SFCDB != null)
                {
                    DBPools["SFCDB"].Return(SFCDB);
                }
                Outputs.Add(new ReportAlart(exception.Message));
            }
        }
Example #22
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
#line 2 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
            System.Globalization.DateTimeFormatInfo date = new System.Globalization.DateTimeFormatInfo();

#line default
#line hidden
            BeginContext(121, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 4 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"

            ViewData["Title"] = "ShowMessages";

#line default
#line hidden
            BeginContext(171, 744, true);
            WriteLiteral(@"
<div class=""col-lg-12 mt-5"">
    <div class=""card"">
        <div class=""card-body"">
            <h4 class=""header-title"">Thead Primary</h4>
            <div class=""single-table"">
                <div class=""table-responsive"">
                    <table class=""table"">
                        <thead class=""text-uppercase bg-primary"">
                            <tr class=""text-white"">
                                <th scope=""col"">Sender</th>
                                <th scope=""col"">Receiver</th>
                                <th scope=""col"">Content</th>
                                <th scope=""col"">Time</th>
                            </tr>
                        </thead>
                        <tbody>
");
            EndContext();
#line 24 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
            foreach (Message message in Model.Messages.Where(m => m.Sender == Model.MainUser || m.Receiver == Model.MainUser))
            {
#line default
#line hidden
#line 26 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                foreach (AppUser user in Model.Sender.Where(u => u == message.Sender))
                {
#line default
#line hidden
                    BeginContext(1231, 86, true);
                    WriteLiteral("                                    <tr>\r\n                                        <td>");
                    EndContext();
                    BeginContext(1318, 9, false);
#line 29 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                    Write(user.Name);

#line default
#line hidden
                    EndContext();
                    BeginContext(1327, 51, true);
                    WriteLiteral("</td>\r\n                                        <td>");
                    EndContext();
                    BeginContext(1379, 16, false);
#line 30 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                    Write(message.Receiver);

#line default
#line hidden
                    EndContext();
                    BeginContext(1395, 51, true);
                    WriteLiteral("</td>\r\n                                        <td>");
                    EndContext();
                    BeginContext(1447, 15, false);
#line 31 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                    Write(message.Content);

#line default
#line hidden
                    EndContext();
                    BeginContext(1462, 53, true);
                    WriteLiteral("</td>\r\n                                        <td>\r\n");
                    EndContext();
#line 33 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                    if (message.Time.Minute < 10)
                    {
                        string minute = string.Concat("0", message.Time.Minute);

#line default
#line hidden
                        BeginContext(1744, 54, true);
                        WriteLiteral("                                                <span>");
                        EndContext();
                        BeginContext(1799, 16, false);
#line 36 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Day);

#line default
#line hidden
                        EndContext();
                        BeginContext(1815, 64, true);
                        WriteLiteral(" </span>\r\n                                                <span>");
                        EndContext();
                        BeginContext(1880, 48, false);
#line 37 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.GetMonthName(message.Time.Month).ToString());

#line default
#line hidden
                        EndContext();
                        BeginContext(1928, 77, true);
                        WriteLiteral(" </span>\r\n                                                <span class=\"mr-3\">");
                        EndContext();
                        BeginContext(2006, 17, false);
#line 38 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Year);

#line default
#line hidden
                        EndContext();
                        BeginContext(2023, 63, true);
                        WriteLiteral("</span>\r\n                                                <span>");
                        EndContext();
                        BeginContext(2087, 17, false);
#line 39 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Hour);

#line default
#line hidden
                        EndContext();
                        BeginContext(2104, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(2106, 18, false);
#line 39 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.TimeSeparator);

#line default
#line hidden
                        EndContext();
                        BeginContext(2124, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(2126, 6, false);
#line 39 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(minute);

#line default
#line hidden
                        EndContext();
                        BeginContext(2132, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(2134, 18, false);
#line 39 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.TimeSeparator);

#line default
#line hidden
                        EndContext();
                        BeginContext(2152, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(2154, 19, false);
#line 39 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Second);

#line default
#line hidden
                        EndContext();
                        BeginContext(2173, 9, true);
                        WriteLiteral("</span>\r\n");
                        EndContext();
#line 40 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                    }
                    else if (message.Time.Second < 10)
                    {
                        string second = string.Concat("0", message.Time.Second);

#line default
#line hidden
                        BeginContext(2462, 54, true);
                        WriteLiteral("                                                <span>");
                        EndContext();
                        BeginContext(2517, 16, false);
#line 44 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Day);

#line default
#line hidden
                        EndContext();
                        BeginContext(2533, 64, true);
                        WriteLiteral(" </span>\r\n                                                <span>");
                        EndContext();
                        BeginContext(2598, 48, false);
#line 45 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.GetMonthName(message.Time.Month).ToString());

#line default
#line hidden
                        EndContext();
                        BeginContext(2646, 77, true);
                        WriteLiteral(" </span>\r\n                                                <span class=\"mr-3\">");
                        EndContext();
                        BeginContext(2724, 17, false);
#line 46 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Year);

#line default
#line hidden
                        EndContext();
                        BeginContext(2741, 63, true);
                        WriteLiteral("</span>\r\n                                                <span>");
                        EndContext();
                        BeginContext(2805, 17, false);
#line 47 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Hour);

#line default
#line hidden
                        EndContext();
                        BeginContext(2822, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(2824, 18, false);
#line 47 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.TimeSeparator);

#line default
#line hidden
                        EndContext();
                        BeginContext(2842, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(2844, 19, false);
#line 47 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Minute);

#line default
#line hidden
                        EndContext();
                        BeginContext(2863, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(2865, 18, false);
#line 47 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.TimeSeparator);

#line default
#line hidden
                        EndContext();
                        BeginContext(2883, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(2885, 6, false);
#line 47 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(second);

#line default
#line hidden
                        EndContext();
                        BeginContext(2891, 9, true);
                        WriteLiteral("</span>\r\n");
                        EndContext();
#line 48 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                    }
                    else if (message.Time.Minute < 10 && message.Time.Second < 10)
                    {
                        string minute = string.Concat("0", message.Time.Minute);
                        string second = string.Concat("0", message.Time.Second);

#line default
#line hidden
                        BeginContext(3314, 54, true);
                        WriteLiteral("                                                <span>");
                        EndContext();
                        BeginContext(3369, 16, false);
#line 53 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Day);

#line default
#line hidden
                        EndContext();
                        BeginContext(3385, 64, true);
                        WriteLiteral(" </span>\r\n                                                <span>");
                        EndContext();
                        BeginContext(3450, 48, false);
#line 54 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.GetMonthName(message.Time.Month).ToString());

#line default
#line hidden
                        EndContext();
                        BeginContext(3498, 77, true);
                        WriteLiteral(" </span>\r\n                                                <span class=\"mr-3\">");
                        EndContext();
                        BeginContext(3576, 17, false);
#line 55 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Year);

#line default
#line hidden
                        EndContext();
                        BeginContext(3593, 63, true);
                        WriteLiteral("</span>\r\n                                                <span>");
                        EndContext();
                        BeginContext(3657, 17, false);
#line 56 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Hour);

#line default
#line hidden
                        EndContext();
                        BeginContext(3674, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(3676, 18, false);
#line 56 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.TimeSeparator);

#line default
#line hidden
                        EndContext();
                        BeginContext(3694, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(3696, 6, false);
#line 56 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(minute);

#line default
#line hidden
                        EndContext();
                        BeginContext(3702, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(3704, 18, false);
#line 56 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.TimeSeparator);

#line default
#line hidden
                        EndContext();
                        BeginContext(3722, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(3724, 6, false);
#line 56 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(second);

#line default
#line hidden
                        EndContext();
                        BeginContext(3730, 9, true);
                        WriteLiteral("</span>\r\n");
                        EndContext();
#line 57 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                    }
                    else
                    {
#line default
#line hidden
                        BeginContext(3883, 54, true);
                        WriteLiteral("                                                <span>");
                        EndContext();
                        BeginContext(3938, 16, false);
#line 60 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Day);

#line default
#line hidden
                        EndContext();
                        BeginContext(3954, 64, true);
                        WriteLiteral(" </span>\r\n                                                <span>");
                        EndContext();
                        BeginContext(4019, 48, false);
#line 61 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.GetMonthName(message.Time.Month).ToString());

#line default
#line hidden
                        EndContext();
                        BeginContext(4067, 77, true);
                        WriteLiteral(" </span>\r\n                                                <span class=\"mr-3\">");
                        EndContext();
                        BeginContext(4145, 17, false);
#line 62 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Year);

#line default
#line hidden
                        EndContext();
                        BeginContext(4162, 63, true);
                        WriteLiteral("</span>\r\n                                                <span>");
                        EndContext();
                        BeginContext(4226, 17, false);
#line 63 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Hour);

#line default
#line hidden
                        EndContext();
                        BeginContext(4243, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(4245, 18, false);
#line 63 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.TimeSeparator);

#line default
#line hidden
                        EndContext();
                        BeginContext(4263, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(4265, 19, false);
#line 63 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Minute);

#line default
#line hidden
                        EndContext();
                        BeginContext(4284, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(4286, 18, false);
#line 63 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(date.TimeSeparator);

#line default
#line hidden
                        EndContext();
                        BeginContext(4304, 1, true);
                        WriteLiteral(" ");
                        EndContext();
                        BeginContext(4306, 19, false);
#line 63 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                        Write(message.Time.Second);

#line default
#line hidden
                        EndContext();
                        BeginContext(4325, 9, true);
                        WriteLiteral("</span>\r\n");
                        EndContext();
#line 64 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                    }

#line default
#line hidden
                    BeginContext(4381, 90, true);
                    WriteLiteral("                                        </td>\r\n                                    </tr>\r\n");
                    EndContext();
#line 67 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
                }

#line default
#line hidden
#line 67 "C:\Users\farid\Desktop\SciCo\SciCo\SciCo\Areas\AdminPage\Views\UserManagement\ShowMessages.cshtml"
            }

#line default
#line hidden
            BeginContext(4537, 142, true);
            WriteLiteral("                        </tbody>\r\n                    </table>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</div>");
            EndContext();
        }
        private Array ModifiedRowsList()
        {
            List <string> modifiedRowsList = new List <string>();
            string        receivedDate;
            string        reportedDate;
            string        catNo;
            string        territory;
            string        salesType;
            string        price1;
            string        price2;
            string        price3;
            string        sales1;
            string        sales2;
            string        sales3;
            string        receipts;
            string        receipts2;
            string        receipts3;
            string        repDolExchRate;
            string        currencyCode;
            string        whtMultiplier;
            string        transactionId;
            string        hdnIsModified;
            string        currencyModified;
            string        hdnCurrencyCode;
            string        companyCode;
            string        destinationCountry;

            System.Globalization.DateTimeFormatInfo mfi = new
                                                          System.Globalization.DateTimeFormatInfo();
            foreach (GridViewRow gvr in gvTransactions.Rows)
            {
                hdnIsModified = (gvr.FindControl("hdnIsModified") as HiddenField).Value;
                if (hdnIsModified == "Y")
                {
                    transactionId      = (gvr.FindControl("hdntransactionId") as HiddenField).Value;
                    receivedDate       = (gvr.FindControl("txtReceivedDate") as TextBox).Text;
                    reportedDate       = (gvr.FindControl("txtReportedDate") as TextBox).Text;
                    catNo              = (gvr.FindControl("txtCatNo") as TextBox).Text;
                    territory          = (gvr.FindControl("lblSeller") as Label).Text;
                    salesType          = (gvr.FindControl("txtSalesType") as TextBox).Text;
                    price1             = (gvr.FindControl("txtPrice1") as TextBox).Text;
                    price2             = (gvr.FindControl("txtPrice2") as TextBox).Text;
                    price3             = (gvr.FindControl("txtPrice3") as TextBox).Text;
                    sales1             = (gvr.FindControl("txtSales1") as TextBox).Text;
                    sales2             = (gvr.FindControl("txtSales2") as TextBox).Text;
                    sales3             = (gvr.FindControl("txtSales3") as TextBox).Text;
                    receipts           = (gvr.FindControl("txtReceipts") as TextBox).Text;
                    receipts2          = (gvr.FindControl("txtReceipts2") as TextBox).Text;
                    receipts3          = (gvr.FindControl("txtReceipts3") as TextBox).Text;
                    repDolExchRate     = (gvr.FindControl("txtDolExchRate") as TextBox).Text;
                    currencyCode       = (gvr.FindControl("txtCurrencyCode") as TextBox).Text.ToUpper();
                    destinationCountry = (gvr.FindControl("txtDestinationCountry") as TextBox).Text;
                    whtMultiplier      = (gvr.FindControl("txtWhtTax") as TextBox).Text;
                    hdnCurrencyCode    = (gvr.FindControl("hdnCurrencyCode") as HiddenField).Value;

                    if ((gvr.FindControl("ddlCompanyCodeGrid") as DropDownList).SelectedIndex > 0)
                    {
                        companyCode = (gvr.FindControl("ddlCompanyCodeGrid") as DropDownList).SelectedValue;
                    }
                    else
                    {
                        companyCode = hdnCompanyCode.Value;
                    }

                    if (hdnCurrencyCode != currencyCode)
                    {
                        currencyModified = "Y";
                    }
                    else
                    {
                        currencyModified = "N";
                    }

                    //WHT tax % is displayed as (1- WHT_MULTIPLIER) * 100 eg multiplier = .85 displays as 15%
                    //Entered value is a % - converted to multiplier while saving (entered value / 100)
                    //screen field is non mandatory and when nothing is entered, it should save as 1 in database
                    //for any values other than empty it should be saved as (100-value)/100 in database
                    whtMultiplier = whtMultiplier.Trim() == string.Empty ? "0" : whtMultiplier.Trim();
                    receivedDate  = receivedDate.Substring(0, 2) + "/" + mfi.GetMonthName(Convert.ToInt32(receivedDate.Substring(3, 2))).Substring(0, 3) + "/" + receivedDate.Substring(6, 4);
                    reportedDate  = reportedDate.Substring(0, 2) + "/" + mfi.GetMonthName(Convert.ToInt32(reportedDate.Substring(3, 2))).Substring(0, 3) + "/" + reportedDate.Substring(6, 4);
                    modifiedRowsList.Add(transactionId + Global.DBDelimiter + receivedDate + Global.DBDelimiter + reportedDate + Global.DBDelimiter + catNo + Global.DBDelimiter + territory.Split('-')[0].Trim() + Global.DBDelimiter + salesType.Split('-')[0].Trim() + Global.DBDelimiter + price1 + Global.DBDelimiter + price2 + Global.DBDelimiter + price3 + Global.DBDelimiter + sales1 + Global.DBDelimiter + sales2 + Global.DBDelimiter + sales3 + Global.DBDelimiter + receipts + Global.DBDelimiter + receipts2 + Global.DBDelimiter + receipts3 + Global.DBDelimiter + repDolExchRate + Global.DBDelimiter + currencyCode + Global.DBDelimiter + whtMultiplier + Global.DBDelimiter + currencyModified + Global.DBDelimiter + companyCode + Global.DBDelimiter + destinationCountry);
                }
            }
            return(modifiedRowsList.ToArray());
        }
Example #24
0
        /// <summary>
        /// Form constructor
        /// </summary>
        /// <param name="dataType"></param>
        /// <param name="filterDateAndTimeEnabled"></param>
        public FormCustomFilter(Type dataType, bool filterDateAndTimeEnabled)
            : this()
        {
            //set localization strings
            _textStrings.Add("EQUALS", "equals");
            _textStrings.Add("DOES_NOT_EQUAL", "does not equal");
            _textStrings.Add("EARLIER_THAN", "earlier than");
            _textStrings.Add("LATER_THAN", "later than");
            _textStrings.Add("BETWEEN", "between");
            _textStrings.Add("GREATER_THAN", "greater than");
            _textStrings.Add("GREATER_THAN_OR_EQUAL_TO", "greater than or equal to");
            _textStrings.Add("LESS_THAN", "less than");
            _textStrings.Add("LESS_THAN_OR_EQUAL_TO", "less than or equal to");
            _textStrings.Add("BEGINS_WITH", "begins with");
            _textStrings.Add("DOES_NOT_BEGIN_WITH", "does not begin with");
            _textStrings.Add("ENDS_WITH", "ends with");
            _textStrings.Add("DOES_NOT_END_WITH", "does not end with");
            _textStrings.Add("CONTAINS", "contains");
            _textStrings.Add("DOES_NOT_CONTAIN", "does not contain");
            _textStrings.Add("INVALID_VALUE", "Invalid Value");
            _textStrings.Add("FILTER_STRING_DESCRIPTION", "Show rows where value {0} \"{1}\"");
            _textStrings.Add("FORM_TITLE", "Custom Filter");
            _textStrings.Add("LABEL_COLUMNNAMETEXT", "Show rows where value");
            _textStrings.Add("LABEL_AND", "And");
            _textStrings.Add("BUTTON_OK", "OK");
            _textStrings.Add("BUTTON_CANCEL", "Cancel");


            this.Text             = _textStrings["FORM_TITLE"].ToString();
            label_columnName.Text = _textStrings["LABEL_COLUMNNAMETEXT"].ToString();
            label_and.Text        = _textStrings["LABEL_AND"].ToString();
            button_ok.Text        = _textStrings["BUTTON_OK"].ToString();
            button_cancel.Text    = _textStrings["BUTTON_CANCEL"].ToString();

            if (dataType == typeof(DateTime))
            {
                _filterType = FilterType.DateTime;
            }
            else if (dataType == typeof(Int32) || dataType == typeof(Int64) || dataType == typeof(Int16) ||
                     dataType == typeof(UInt32) || dataType == typeof(UInt64) || dataType == typeof(UInt16) ||
                     dataType == typeof(Byte) || dataType == typeof(SByte))
            {
                _filterType = FilterType.Integer;
            }
            else if (dataType == typeof(Single) || dataType == typeof(Double) || dataType == typeof(Decimal))
            {
                _filterType = FilterType.Float;
            }
            else if (dataType == typeof(String))
            {
                _filterType = FilterType.String;
            }
            else
            {
                _filterType = FilterType.Unknown;
            }

            _filterDateAndTimeEnabled = filterDateAndTimeEnabled;

            switch (_filterType)
            {
            case FilterType.DateTime:
                _valControl1 = new DateTimePicker();
                _valControl2 = new DateTimePicker();
                if (_filterDateAndTimeEnabled)
                {
                    System.Globalization.DateTimeFormatInfo dt = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat;

                    (_valControl1 as DateTimePicker).CustomFormat = dt.ShortDatePattern + " " + dt.ShortTimePattern;
                    (_valControl2 as DateTimePicker).CustomFormat = dt.ShortDatePattern + " " + dt.ShortTimePattern;
                    (_valControl1 as DateTimePicker).Format       = DateTimePickerFormat.Custom;
                    (_valControl2 as DateTimePicker).Format       = DateTimePickerFormat.Custom;
                }
                else
                {
                    (_valControl1 as DateTimePicker).Format = DateTimePickerFormat.Short;
                    (_valControl2 as DateTimePicker).Format = DateTimePickerFormat.Short;
                }

                comboBox_filterType.Items.AddRange(new string[] {
                    _textStrings["EQUALS"].ToString(),
                    _textStrings["DOES_NOT_EQUAL"].ToString(),
                    _textStrings["EARLIER_THAN"].ToString(),
                    _textStrings["LATER_THAN"].ToString(),
                    _textStrings["BETWEEN"].ToString()
                });
                break;

            case FilterType.Integer:
            case FilterType.Float:
                _valControl1              = new TextBox();
                _valControl2              = new TextBox();
                _valControl1.TextChanged += valControl_TextChanged;
                _valControl2.TextChanged += valControl_TextChanged;
                comboBox_filterType.Items.AddRange(new string[] {
                    _textStrings["EQUALS"].ToString(),
                    _textStrings["DOES_NOT_EQUAL"].ToString(),
                    _textStrings["GREATER_THAN"].ToString(),
                    _textStrings["GREATER_THAN_OR_EQUAL_TO"].ToString(),
                    _textStrings["LESS_THAN"].ToString(),
                    _textStrings["LESS_THAN_OR_EQUAL_TO"].ToString(),
                    _textStrings["BETWEEN"].ToString()
                });
                _valControl1.Tag  = true;
                _valControl2.Tag  = true;
                button_ok.Enabled = false;
                break;

            default:
                _valControl1 = new TextBox();
                _valControl2 = new TextBox();
                comboBox_filterType.Items.AddRange(new string[] {
                    _textStrings["EQUALS"].ToString(),
                    _textStrings["DOES_NOT_EQUAL"].ToString(),
                    _textStrings["BEGINS_WITH"].ToString(),
                    _textStrings["DOES_NOT_BEGIN_WITH"].ToString(),
                    _textStrings["ENDS_WITH"].ToString(),
                    _textStrings["DOES_NOT_END_WITH"].ToString(),
                    _textStrings["CONTAINS"].ToString(),
                    _textStrings["DOES_NOT_CONTAIN"].ToString()
                });
                break;
            }
            comboBox_filterType.SelectedIndex = 0;

            _valControl1.Name     = "valControl1";
            _valControl1.Location = new System.Drawing.Point(30, 66);
            _valControl1.Size     = new System.Drawing.Size(166, 20);
            _valControl1.TabIndex = 4;
            _valControl1.Visible  = true;
            _valControl1.KeyDown += valControl_KeyDown;

            _valControl2.Name            = "valControl2";
            _valControl2.Location        = new System.Drawing.Point(30, 108);
            _valControl2.Size            = new System.Drawing.Size(166, 20);
            _valControl2.TabIndex        = 5;
            _valControl2.Visible         = false;
            _valControl2.VisibleChanged += new EventHandler(valControl2_VisibleChanged);
            _valControl2.KeyDown        += valControl_KeyDown;

            Controls.Add(_valControl1);
            Controls.Add(_valControl2);

            errorProvider.SetIconAlignment(_valControl1, ErrorIconAlignment.MiddleRight);
            errorProvider.SetIconPadding(_valControl1, -18);
            errorProvider.SetIconAlignment(_valControl2, ErrorIconAlignment.MiddleRight);
            errorProvider.SetIconPadding(_valControl2, -18);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            PageTitle = TextCode(79);
            Section = "schools";
            CSS = "print";
            LeftBar = "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='0'><TR VALIGN='TOP' BGCOLOR='#996699'><TD BACKGROUND='/media/schools/i_c_prpl_bar_bg.gif'><IMG SRC='/media/schools/i_s_schools_icon.gif' WIDTH='24' HEIGHT='23' BORDER='0' alt=''><IMG SRC='/media1/USSchools/h_schools" + SuffixCode() + ".gif' WIDTH='141' HEIGHT='23' ALIGN='TOP' alt=''>";
            #endregion Properties For The Base Class and Check Login
            i1=0;
            i2=0;
            i3=0;
            i4=0;
            iTemp=0;
            iIndex=0;iRowCount=0;
            bExpense=false;
            bTuition=false;
            bFee=false;
            bBook=false;
            bBoard=false;
            bBach=false;  bbBach=false;
            bAssoc=false; bbAssoc=false;
            bNon=false;	  bbNon=false;
            bVT=false;
            bInterSports=false; bIntraSports=false; bSportScholarships=false;
            bShow1=false; bShow2=false; bShow3=false;bShow4=false;bShow5=false;bShow6=false;bShow7=false;bShow8=false;
            INUN_ID=Request["INUN_ID"];
            dtf= new System.Globalization.DateTimeFormatInfo();
            dataTable1 = new DataTable();
            dataTable1 = CCLib.Cache.GetCachedDataTable("UGSchoolProfile_All_"+INUN_ID,	"UGSP_SelectAllByID "+INUN_ID);
            dtGRExpense=CCLib.Cache.GetCachedDataTable("GRSchoolExpense_"+INUN_ID,"select TUIT_AREA_FT_D,TUIT_NRES_FT_D,TUIT_INTL_FT_D,TUIT_STATE_FT_D,TUIT_OVERALL_FT_D,TUIT_VARY_PROG,TUIT_VARY_LOC,TUIT_VARY_TIME,TUIT_VARY_LOAD,TUIT_VARY_COURSE_LVL,TUIT_VARY_DEG,TUIT_VARY_RECIPROCITY,TUIT_VARY_STUD,TUIT_VARY_RELIGION,RM_BD_VARY_BD,RM_BD_VARY_LOC,RM_BD_VARY_HOUS,FEES_FT_D,RM_BD_D from GX_INST_View where INUN_ID = "+INUN_ID);

            dtStudentServices=CCLib.Cache.GetCachedDataTable("GRSchoolStudentServices_"+INUN_ID,"select * from GR_STUDENT_SERVICES_View where INUN_ID = "+INUN_ID);

            if ((dataTable1.Rows[0]["TUIT_AREA_FT_D"].ToString()!="") || (dataTable1.Rows[0]["TUIT_NRES_FT_D"].ToString()!="") || (dataTable1.Rows[0]["TUIT_INTL_FT_D"].ToString()!="") || (dataTable1.Rows[0]["TUIT_STATE_FT_D"].ToString()!="") || (dataTable1.Rows[0]["TUIT_OVERALL_FT_D"].ToString() !=""))
                bTuition=true;
            if (dataTable1.Rows[0]["FEES_FT_D"].ToString() !="")
                bFee=true;
            if (dataTable1.Rows[0]["BOOKS_RES_D"].ToString() !="")
                bBook=true;
            if (dataTable1.Rows[0]["RM_BD_D"].ToString() !="")
                bBoard=true;
            if (dataTable1.Rows[0]["FRSH_FT_AP_N"].ToString() != "" || dataTable1.Rows[0]["UG_FT_AP_N"].ToString() != "" || dataTable1.Rows[0]["FRSH_FT_ND_N"].ToString() != "" || dataTable1.Rows[0]["UG_FT_ND_N"].ToString() != "" ||
                dataTable1.Rows[0]["FRSH_FT_ND_MET_N"].ToString() != "" || dataTable1.Rows[0]["UG_FT_ND_MET_N"].ToString() != "" || dataTable1.Rows[0]["FRSH_FT_ND_MET_P"].ToString() != "" || dataTable1.Rows[0]["UG_FT_ND_MET_P"].ToString() != "" ||
                dataTable1.Rows[0]["FRSH_FT_AVG_PKG_D"].ToString() != "" || dataTable1.Rows[0]["UG_FT_AVG_PKG_D"].ToString() != "" || dataTable1.Rows[0]["FRESH_FT_AVG_NB_LOAN_D"].ToString() != "" || dataTable1.Rows[0]["UG_FT_AVG_NB_LOAN_D"].ToString() != "" ||
                dataTable1.Rows[0]["FRSH_FT_AVG_NB_GIFT_D"].ToString() != "" || dataTable1.Rows[0]["UG_FT_AVG_NB_GIFT_D"].ToString() != "" || dataTable1.Rows[0]["FRESH_FT_NN_NONEED_D"].ToString() != "" || dataTable1.Rows[0]["UG_FT_NN_NONEED_D"].ToString() != "")
                bFinancialAid = true;
            if ((dataTable1.Rows[0]["SCHOL_NB_PELL"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_PERKINS"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_DIRECT_STAFFORD_SUB"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_DIRECT_STAFFORD_UNSUB"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_DIRECT_PLUS"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_FFEL_STAFFORD_SUB"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_FFEL_STAFFORD_UNSUB"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_FFEL_PLUS"].ToString() != "")
                || (dataTable1.Rows[0]["SCHOL_NB_SEOG"].ToString() == "X")
                || (dataTable1.Rows[0]["LOAN_STATE"].ToString() == "X")
                || (dataTable1.Rows[0]["SCHOL_NB_STATE"].ToString() == "X")
                || (dataTable1.Rows[0]["LOAN_INST"].ToString() == "X")
                || (dataTable1.Rows[0]["SCHOL_NB_INST"].ToString() == "X")
                || (dataTable1.Rows[0]["SCHOL_NB_PRIVATE"].ToString() == "X")
                || (dataTable1.Rows[0]["SCHOL_NB_UNCF"].ToString() == "X"))
                bFinancialAidType = true;

            dtAppReq = new DataTable();
            dtAppReq=CCLib.Cache.GetCachedDataTable("UGSchoolProfile_AppReq_"+INUN_ID,"UGSP_SelectApplReq "+INUN_ID);
            dtEntrExam= new DataTable();
            dtEntrExam=CCLib.Cache.GetCachedDataTable("UGSchoolProfile_EntrExam_"+INUN_ID,"UGSP_SelectEntrExam "+INUN_ID);
            dtPlaceExam= new DataTable();
            dtPlaceExam=CCLib.Cache.GetCachedDataTable("UGSchoolProfile_PlaceExam_"+INUN_ID,"UGSP_SelectPlaceExam "+INUN_ID);
            dtSport= new DataTable();
            dtSport=CCLib.Cache.GetCachedDataTable("UGSchoolProfile_Sports_"+INUN_ID,"UGSP_SelectSports "+INUN_ID);
            strTemp="";
            dt1 = new DataTable();
            dt1=CCLib.Cache.GetCachedDataTable("GRSchoolProfile_MajorResults_"+INUN_ID,"GRSP_SelectAllMajor "+INUN_ID);
            //dvMajor=new DataView(dt1);
            dvArea=new DataView(dt1);
            dvArea.Sort="[1stLevel"+NonEngSuffixCode("US")+"]";
            string strArea=Request["area"];
            string strType=Request["type"];
            string strTempFilter="";
            if((strArea != null) && (strArea != ""))
            {
                strTempFilter=strTempFilter+"[1stCode]='"+strArea+"' and ";
                dvMajor = new DataView(dt1);
            }
            else//recreate new datatable to get rid of redundant rows
            {
                dt2 = dt1.Clone();
                for (int i = 0; i < dt1.Rows.Count; i++)
                {
                    if (i == 0 || (dt1.Rows[i]["DESCR"].ToString() != dt1.Rows[i - 1]["DESCR"].ToString()))//just insert for the first one or if no duplicate
                        dt2.ImportRow(dt1.Rows[i]);
                }
                dvMajor = new DataView(dt2);
            }
            if ((strType != null) && (strType != ""))
            {
                if(strType=="A")
                    strTempFilter=strTempFilter+"ASSOC='X' and ";
                if(strType=="B")
                    strTempFilter=strTempFilter+"BACH='X' and ";
                if(strType=="N")
                    strTempFilter=strTempFilter+"Non='X' and ";
                if(strType=="G")
                    strTempFilter=strTempFilter+"GRAD='X' and ";
            }
            if(strTempFilter.Length>0) dvMajor.RowFilter=strTempFilter.Substring(0,strTempFilter.Length-4);
            iRowCount=(int)CCLib.Cache.GetCachedValue("UGSchoolProfile_IsCTSchool_"+INUN_ID,"select count(INUN_ID) from VX_INST where INUN_ID="+INUN_ID);
            bVT=(iRowCount>0)?true:false;
            foreach(DataRowView myRow in dvMajor)
            {
                if ((myRow["ASSOC"].ToString() == "X") && (!bAssoc))
                    bAssoc=true;
                if ((myRow["BACH"].ToString() == "X") && (!bBach))
                    bBach=true;
                if ((myRow["Non"].ToString() == "X") && (!bNon))
                    bNon=true;
                if ((myRow["GRAD"].ToString() == "X") && (!bGRAD))
                    bGRAD=true;
            }
            foreach(DataRowView myRow in dvArea)
            {
                if ((myRow["ASSOC"].ToString() == "X") && (!bbAssoc))
                    bbAssoc=true;
                if ((myRow["BACH"].ToString() == "X") && (!bbBach))
                    bbBach=true;
                if ((myRow["Non"].ToString() == "X") && (!bbNon))
                    bbNon=true;
                if ((myRow["GRAD"].ToString() == "X") && (!bbGRAD))
                    bbGRAD=true;
            }
            foreach(DataRow myRow in dtSport.Rows)
            {
                if ((myRow["SCHOL_MEN"].ToString()!="") || (myRow["SCHOL_WMN"].ToString()!=""))
                {
                    bSportScholarships=true;
                    break;
                }
            }
            foreach(DataRow myRow in dtSport.Rows)
            {
                if ((myRow["INTC_MEN"].ToString()!="") || (myRow["INTC_WMN"].ToString()!=""))
                {
                    bInterSports=true;
                    break;
                }
            }
            foreach(DataRow myRow in dtSport.Rows)
            {
                if ((myRow["INTM_MEN"].ToString()!="") || (myRow["INTM_WMN"].ToString()!=""))
                {
                    bIntraSports=true;
                    break;
                }
            }
            if(CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_200_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_300_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_400_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_500_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_600_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_700_P"].ToString(),50))
                strSATVerbal="<td valign=bottom><img src='../media/shared/ugsp_sat_chart_left2.gif' alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%'width=72 height=340></td>";
            else
                strSATVerbal="<td><img src='../media/shared/ugsp_sat_chart_left.gif' alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%' width=72 height=220></td>";
            if(CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_200_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_300_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_400_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_500_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_600_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_700_P"].ToString(),50))
                strSATMath="<td valign=bottom><img src='../media/shared/ugsp_sat_chart_left2.gif' alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%'width=72 height=340></td>";
            else
                strSATMath="<td><img src='../media/shared/ugsp_sat_chart_left.gif' alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%' width=72 height=220></td>";

            if (CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_200_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_300_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_400_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_500_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_600_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_700_P"].ToString(), 50))
                strSATWriting = "<td valign=bottom><img src=../media/shared/ugsp_sat_chart_left2.gif width=72 height=340 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%'></td>";
            else
                strSATWriting = "<td><img src=../media/shared/ugsp_sat_chart_left.gif width=72 height=220 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%'></td>";

            if(CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_1_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_2_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_3_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_4_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_5_P"].ToString(),50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_6_P"].ToString(),50))
                strACT="<td valign=bottom><img src='../media/shared/ugsp_sat_chart_left2.gif' alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%'width=72 height=340></td>";
            else
                strACT="<td><img src='../media/shared/ugsp_sat_chart_left.gif' alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%' width=72 height=220></td>";
            if((dataTable1.Rows[0]["instate_area_code"].ToString() !="") || (dataTable1.Rows[0]["outstate_area_code"].ToString() !="")
                || (dataTable1.Rows[0]["fax_area_code"].ToString() !="")
                || (dataTable1.Rows[0]["ap_recd_1st_n"].ToString() !="") || (dataTable1.Rows[0]["ap_admt_1st_n"].ToString() !="")
                || (dataTable1.Rows[0]["ad_open"].ToString() !="") || (dataTable1.Rows[0]["ad_open_T"].ToString() !="") || (dataTable1.Rows[0]["ad_pref"].ToString() !="") || (dataTable1.Rows[0]["ad_pref_t"].ToString() !="")
                || (dataTable1.Rows[0]["ad_open"].ToString() !="") || (dataTable1.Rows[0]["ad_open_T"].ToString() !="") || (dataTable1.Rows[0]["ad_pref"].ToString() !="") || (dataTable1.Rows[0]["ad_pref_t"].ToString() !="")
                || (dtAppReq.Rows.Count!=0) || (dtEntrExam.Rows.Count!=0) || (dtPlaceExam.Rows.Count!=0)
                || (dataTable1.Rows[0]["AP_electronic"].ToString() !="")
                )
                bShow2=true;
            if ((dataTable1.Rows[0]["TUIT_AREA_FT_D"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_NRES_FT_D"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_INTL_FT_D"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_STATE_FT_D"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_OVERALL_FT_D"].ToString() !="")
                || (dataTable1.Rows[0]["TUIT_VARY_PROG"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_VARY_LOC"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_VARY_TIME"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_VARY_LOAD"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_VARY_COURSE_LVL"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_VARY_DEG"].ToString()!="")
                || (dataTable1.Rows[0]["TUIT_VARY_RECIPROCITY"].ToString() !="")
                || (dataTable1.Rows[0]["TUIT_VARY_STUD"].ToString()!="")
                || (dataTable1.Rows[0]["RM_BD_VARY_BD"].ToString()=="X")
                || (dataTable1.Rows[0]["RM_BD_VARY_LOC"].ToString()=="X")
                || (dataTable1.Rows[0]["RM_BD_VARY_GENDER"].ToString()=="X")
                || (dataTable1.Rows[0]["RM_BD_VARY_HOUS"].ToString()=="X")
                || (dataTable1.Rows[0]["TUIT_PLAN_GUAR"].ToString()=="Y")
                || (dataTable1.Rows[0]["TUIT_PLAN_PREPAY"].ToString()=="Y")
                || (dataTable1.Rows[0]["TUIT_PLAN_INSTALL"].ToString()=="X")
                || (dataTable1.Rows[0]["TUIT_PLAN_DEFER"].ToString()=="X"))
                bShow4=true;
            if((dataTable1.Rows[0]["certif"].ToString() == "X")
                || (dataTable1.Rows[0]["diploma"].ToString() == "X")
                || (dataTable1.Rows[0]["deg_assoc_tfer"].ToString() == "X")
                || (dataTable1.Rows[0]["deg_assoc_term"].ToString() == "X")
                ||  (dataTable1.Rows[0]["deg_bach"].ToString() != "")
                ||  (dataTable1.Rows[0]["certif_fp"].ToString() == "X")
                ||	(dataTable1.Rows[0]["deg_fp"].ToString() == "X")
                ||	(dataTable1.Rows[0]["deg_master"].ToString() != "")
                ||	(dataTable1.Rows[0]["certif_post_master"].ToString() == "X")
                ||	(dataTable1.Rows[0]["deg_Doctor"].ToString() != "")
                ||  (dataTable1.Rows[0]["award_t"].ToString() != "")
                || (dataTable1.Rows[0]["assoc_t"].ToString() !="") || (dataTable1.Rows[0]["bach_t"].ToString() !="")
                || (dataTable1.Rows[0]["acad_core"].ToString() == "Y") || (dataTable1.Rows[0]["LANG"].ToString()  == "Y")
                || (dataTable1.Rows[0]["MATH_SCI"].ToString() == "Y") || (dataTable1.Rows[0]["CMPTR"].ToString() == "Y")
                || (dataTable1.Rows[0]["INTERN_ALL"].ToString()  == "Y") || (dataTable1.Rows[0]["INTERN_SOME"].ToString()  == "Y")
                || (dataTable1.Rows[0]["SR_PROJ_ALL"].ToString()  == "Y") || (dataTable1.Rows[0]["SR_PROJ_SOME_MAJ"].ToString()  == "Y")
                || (dataTable1.Rows[0]["SR_PROJ_SOME_HON"].ToString()  == "Y"))
                bShow3=true;
            if ((dataTable1.Rows[0]["EN_TOT_UG_N"].ToString()!="")
                || (dataTable1.Rows[0]["EN_GRAD_FT_MEN_N"].ToString()!="")
                || (dataTable1.Rows[0]["EN_GRAD_FT_WMN_N"].ToString()!="")
                || (dataTable1.Rows[0]["EN_GRAD_PT_MEN"].ToString()!="")
                || (dataTable1.Rows[0]["EN_GRAD_FT_WMN_N"].ToString()!="")
                || (dataTable1.Rows[0]["EN_TOT_FT_MEN_N"].ToString()!="")
                || (dataTable1.Rows[0]["EN_TOT_FT_WMN_N"].ToString()!="")
                || (dataTable1.Rows[0]["EN_TOT_PT_MEN_N"].ToString()!="")
                || (dataTable1.Rows[0]["EN_TOT_PT_WMN_N"].ToString()!="")
                || (dataTable1.Rows[0]["FRSH_HS_RANK_50_P"].ToString()!="")
                || (dataTable1.Rows[0]["FRSH_HS_RANK_25_P"].ToString()!="")
                || (dataTable1.Rows[0]["FRSH_HS_RANK_10_P"].ToString()!="")
                || (dataTable1.Rows[0]["FRSH_GPA"].ToString()!="")
                || (dataTable1.Rows[0]["SAT1_VERB_200_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_VERB_300_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_VERB_400_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_VERB_500_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_VERB_600_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_VERB_700_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_MATH_200_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_MATH_300_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_MATH_400_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_MATH_500_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_MATH_600_P"].ToString() !="")
                || (dataTable1.Rows[0]["SAT1_MATH_700_P"].ToString() !="")
                || (dataTable1.Rows[0]["ACT_1_P"].ToString() !="")
                || (dataTable1.Rows[0]["ACT_2_P"].ToString() !="")
                || (dataTable1.Rows[0]["ACT_3_P"].ToString() !="")
                || (dataTable1.Rows[0]["ACT_4_P"].ToString() !="")
                || (dataTable1.Rows[0]["ACT_5_P"].ToString() !="")
                || (dataTable1.Rows[0]["ACT_6_P"].ToString() !="")
                )
                bShow5=true;
            if((dataTable1.Rows[0]["lib_main_name"].ToString() != "")
                || (dataTable1.Rows[0]["lib_vol_n"].ToString() != "")
                || (dataTable1.Rows[0]["lib_serials_n"].ToString() != "")
                || (dataTable1.Rows[0]["lib_micro_n"].ToString() != "")
                || (dataTable1.Rows[0]["lib_av_n"].ToString() != "")
                || (dataTable1.Rows[0]["lib_vol_n"].ToString() != "")
                || (dataTable1.Rows[0]["cmptr_n"].ToString() != "")
                || (dataTable1.Rows[0]["www"].ToString() == "X")
                || (dataTable1.Rows[0]["lab"].ToString() == "Y")
                || (dataTable1.Rows[0]["net"].ToString() == "Y")
                || (dataTable1.Rows[0]["net_stud_rm"].ToString() == "Y")
                || (dataTable1.Rows[0]["NET_OFFCMPS"].ToString() == "Y")
                || (dataTable1.Rows[0]["career_counsel_indv"].ToString() != "")
                || (dataTable1.Rows[0]["career_counsel_grp"].ToString() != "")
                || (dataTable1.Rows[0]["career_place"].ToString() != "")
                || (dataTable1.Rows[0]["career_recruit"].ToString() != "")
                || (dataTable1.Rows[0]["career_job_bank"].ToString() == "X")
                || (dataTable1.Rows[0]["career_job_fairs"].ToString() == "X")
                || (dataTable1.Rows[0]["career_job_iview"].ToString() == "X")
                || (dataTable1.Rows[0]["career_lib"].ToString() == "X")
                || (dataTable1.Rows[0]["career_resume_prep"].ToString() == "X")
                || (dataTable1.Rows[0]["career_resume_refer"].ToString() == "X")
                || (dataTable1.Rows[0]["career_testing"].ToString() == "X")
                || (dataTable1.Rows[0]["career_iview_wrkshp"].ToString() == "X")
                || (dataTable1.Rows[0]["career_oth_t"].ToString() != "")
                || (dataTable1.Rows[0]["SRVC_LEGAL"].ToString() == "Y")
                || (dataTable1.Rows[0]["SRVC_HEALTH"].ToString() == "Y")
                || (dataTable1.Rows[0]["SRVC_PSYCH"].ToString() == "Y")
                || (dataTable1.Rows[0]["SRVC_WMN_CTR"].ToString() == "Y")
                )
                bShow6=true;
            if (((dataTable1.Rows[0]["hous"].ToString() == "Y")
                && ((dataTable1.Rows[0]["hous_coed"].ToString() == "X")
                || (dataTable1.Rows[0]["hous_men"].ToString() == "X")
                || (dataTable1.Rows[0]["hous_wmn"].ToString() == "X")))
                || (dataTable1.Rows[0]["hous_req_yr"].ToString() != "")
                || (dataTable1.Rows[0]["life_frat_nat"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_frat_local"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_sor_nat"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_sor_local"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_chorus"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_drama"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_band"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_news"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_radio"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_television"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_pbk"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_sx"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_org_1_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_org_2_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_org_3_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_org_4_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_org_5_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_event_1_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_event_2_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_event_3_t"].ToString() != ""))
                bShow7=true;
            if ((bSportScholarships)
                || (bIntraSports)
                || (bInterSports)
                || (dataTable1.Rows[0]["assn_athl_ncaa"].ToString() !="")
                || (dataTable1.Rows[0]["assn_athl_naia"].ToString()=="X")
                || (dataTable1.Rows[0]["assn_athl_nccaa"].ToString()=="X")
                || (dataTable1.Rows[0]["assn_athl_nscaa"].ToString()=="X")
                || (dataTable1.Rows[0]["assn_athl_njcaa"].ToString()=="X"))
                bShow8=true;
        }
        /// <summary>
        /// 显示所有请假记录
        /// </summary>
        /// <returns>请假单信息</returns>
        public ListResult <OrderModel> List(int pageNo, int pageSize, SortModel sort, FilterModel filter)
        {
            using (var dbContext = new MissionskyOAEntities())
            {
                var list = dbContext.Orders.Where(it => ((it.OrderType != (int)OrderType.Overtime))).AsEnumerable();

                if (filter != null && filter.Member == "UserName")
                {
                    var userList = dbContext.Users.Where(it => it.EnglishName == filter.Value);
                    switch (filter.Operator)
                    {
                    case "IsEqualTo":
                        userList = dbContext.Users.Where(it => it.EnglishName == filter.Value);
                        break;

                    case "IsNotEqualTo":
                        userList = dbContext.Users.Where(it => it.EnglishName != filter.Value);
                        break;

                    case "StartsWith":
                        userList =
                            dbContext.Users.Where(
                                it =>
                                it.EnglishName != null &&
                                it.EnglishName.ToLower().StartsWith(filter.Value.ToLower()));
                        break;

                    case "Contains":
                        userList =
                            dbContext.Users.Where(
                                it =>
                                it.EnglishName != null &&
                                it.EnglishName.ToLower().Contains(filter.Value.ToLower()));
                        break;

                    case "DoesNotContain":
                        userList =
                            dbContext.Users.Where(
                                it =>
                                it.EnglishName != null &&
                                !it.EnglishName.ToLower().Contains(filter.Value.ToLower()));
                        break;

                    case "EndsWith":
                        userList =
                            dbContext.Users.Where(
                                it =>
                                it.EnglishName != null &&
                                it.EnglishName.ToLower().EndsWith(filter.Value.ToLower()));
                        break;
                    }
                    List <int> userIds = new List <int>();
                    userList.ToList().ForEach(item =>
                    {
                        userIds.Add(item.Id);
                    });
                    list = list.Where(it => userIds.Contains(it.UserId));
                }
                if (filter != null && filter.Member == "CreatedTime")
                {
                    var dtFormat = new System.Globalization.DateTimeFormatInfo()
                    {
                        ShortDatePattern = "yyyy-MM-dd"
                    };
                    var dt = Convert.ToDateTime(filter.Value, dtFormat);

                    switch (filter.Operator)
                    {
                    case "IsEqualTo":
                        list = list.Where(it => it.CreatedTime.Value.Date == dt);
                        break;

                    case "IsNotEqualTo":
                        list = list.Where(it => it.CreatedTime.Value.Date != dt);
                        break;

                    case "IsGreaterThan":
                        list = list.Where(it => it.CreatedTime.Value.Date > dt);
                        break;

                    case "IsLessThan":
                        list = list.Where(it => it.CreatedTime.Value.Date < dt);
                        break;

                    case "IsGreaterThanOrEqualTo":
                        list = list.Where(it => it.CreatedTime.Value.Date >= dt);
                        break;

                    case "IsLessThanOrEqualTo":
                        list = list.Where(it => it.CreatedTime.Value.Date >= dt);
                        break;
                    }
                }
                if (sort != null)
                {
                    switch (sort.Member)
                    {
                    case "CreatedTime":
                        if (sort.Direction == SortDirection.Ascending)
                        {
                            list = list.OrderBy(item => item.CreatedTime);
                        }
                        else
                        {
                            list = list.OrderByDescending(item => item.CreatedTime);
                        }
                        break;

                    default:
                        break;
                    }
                }

                var count = list.Count();

                list = list.Skip((pageNo - 1) * pageSize).Take(pageSize).ToList();

                var result = new ListResult <OrderModel>()
                {
                    Data = new List <OrderModel>()
                };
                list.ToList().ForEach(item =>
                {
                    var order = item.ToModel();

                    if (result.Data.Any(it => it.OrderNo == order.OrderNo) == false) //过滤批量申请,重复的申请单
                    {
                        OrderService.DoFill(dbContext, order);
                        result.Data.Add(order);
                    }
                });

                result.Total = count;

                return(result);
            }
        }
Example #27
0
        public void Report()
        {
            string selectedServer     = "";
            string selectedServerList = "";
            string date;
            //12/24/2013 NS added
            string downMin = "";

            exactmatch = false;
            //1/30/2015 NS added for VSPLUS-1370
            string selectedType = "";

            selectedTypeList = "";
            if (this.ServerFilterTextBox.Text != "")
            {
                selectedServer = this.ServerFilterTextBox.Text;
            }
            if (this.ServerListFilterListBox.SelectedItems.Count > 0)
            {
                selectedServer = "";
                for (int i = 0; i < this.ServerListFilterListBox.SelectedItems.Count; i++)
                {
                    selectedServer     += this.ServerListFilterListBox.SelectedItems[i].Text + ",";
                    selectedServerList += "'" + this.ServerListFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                exactmatch = true;
                try
                {
                    selectedServer     = selectedServer.Substring(0, selectedServer.Length - 1);
                    selectedServerList = selectedServerList.Substring(0, selectedServerList.Length - 1);
                }
                catch
                {
                    selectedServer     = ""; // throw ex;
                    selectedServerList = "";
                    exactmatch         = false;
                }
                finally { }
            }
            //12/24/2013 NS added
            //downMin = DownFilterTextBox.Text;
            //10/23/2013 NS modified - added jQuery month/year control

            /*
             * if (this.DateParamEdit.Text == "")
             * {
             *  date = DateTime.Now.ToString();
             *  this.DateParamEdit.Date = Convert.ToDateTime(date);
             * }
             * else
             * {
             *  date = this.DateParamEdit.Value.ToString();
             * }
             */
            if (startDate.Value.ToString() == "")
            {
                date = DateTime.Now.ToString();
            }
            else
            {
                date = startDate.Value.ToString();
            }
            //1/30/2015 NS added for VSPLUS-1370
            if (this.ServerTypeFilterListBox.SelectedItems.Count > 0)
            {
                selectedType = "";
                for (int i = 0; i < this.ServerTypeFilterListBox.SelectedItems.Count; i++)
                {
                    selectedType     += this.ServerTypeFilterListBox.SelectedItems[i].Text + ",";
                    selectedTypeList += "'" + this.ServerTypeFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                try
                {
                    selectedType     = selectedType.Substring(0, selectedType.Length - 1);
                    selectedTypeList = selectedTypeList.Substring(0, selectedTypeList.Length - 1);
                }
                catch
                {
                    selectedType     = ""; // throw ex;
                    selectedTypeList = "";
                }
                finally { }
            }
            DateTime dt = Convert.ToDateTime(date);

            //11/11/2015 NS added for VSPLUS-2023
            if (dt.Month == DateTime.Now.Month && dt.Year == DateTime.Now.Year)
            {
                dt = DateTime.Now;
            }
            DashboardReports.ServerUpTimeXtraRpt report = new DashboardReports.ServerUpTimeXtraRpt();
            report.Parameters["DateM"].Value = dt.Month;
            report.Parameters["DateY"].Value = dt.Year;
            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
            string strMonthName = mfi.GetMonthName(dt.Month).ToString() + ", " + dt.Year.ToString();

            report.Parameters["MonthYear"].Value     = strMonthName;
            report.Parameters["ServerName"].Value    = selectedServer;
            report.Parameters["ServerNameSQL"].Value = selectedServerList;
            report.Parameters["ExactMatch"].Value    = exactmatch;
            //12/24/2013 NS added
            report.Parameters["DownMin"].Value = downMin;
            //1/30/2015 NS added for VSPLUS-1370
            report.Parameters["ServerType"].Value    = selectedType;
            report.Parameters["ServerTypeSQL"].Value = selectedTypeList;
            report.Parameters["RptType"].Value       = this.MinPctRadioButtonList.SelectedItem.Value;
            report.Parameters["DateD"].Value         = dt.Day;
            report.PageColor = Color.Transparent;
            report.CreateDocument();
            ASPxDocumentViewer1.Report = report;
            ASPxDocumentViewer1.DataBind();
        }
        /* This method returns the month name according to the month id
         * @param id : integer value which represents a month
         * @returns strMonthName : String name of the month for given id
         */
        public String getMonthByID(int id)
        {
            // Create a object to format the month id given
            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
            string strMonthName = mfi.GetMonthName(id).ToString();  // Convert month id to month name

            return strMonthName;
        }
Example #29
0
        public Calculo(int Cliente)
        {
            _Cliente = Cliente;
            System.Globalization.DateTimeFormatInfo x = new System.Globalization.DateTimeFormatInfo();
            x.FirstDayOfWeek = DayOfWeek.Monday;
            int          DiaDeLaSemana = (int)(DateTime.Now.DayOfWeek);
            DateTime     SourceDate    = DateTime.MinValue;
            string       strCalculo    = "";
            Programacion oProg;

            oProg = new Programacion(_Cliente);
            int _TotalRegistros = oProg.ProgramacionesAsignadas.Count;

            if (_TotalRegistros <= 0)
            {
                throw new ApplicationException("El cliente " + _Cliente.ToString() + " no tiene programaciones asignadas.");
            }
            //Carga de los ultimos 5 pedidos de gas del cliente, ordenados cronológicamente
            SqlDataReader dr;
            ////Dim cn As New SqlConnection(SigaMetClasses.LeeInfoConexion(False))
            SqlConnection cn  = SigaMetClasses.DataLayer.Conexion;
            SqlCommand    cmd = new SqlCommand("spCCConsultaUltimos5PedidosCliente", cn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@Cliente", SqlDbType.Int);
            cmd.Parameters[0].Value = _Cliente;
            try
            {
                cn.Open();
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            }
            catch (Exception ex)
            {
                throw new Exception("No se pudo conectar a la base de datos.", ex);
            }
            //Exit Sub


            //		//**CALCULO PARA LA FECHA ORÍGEN
            ////Leo el primer registro
            dr.Read();

            try
            {
                //	//Checo cuál es el status de ese pedido

                switch (((String)(dr["Status"])).Trim())
                {
                case "SURTIDO":                                         ////Si está surtido...
                    SourceDate  = ((DateTime)(dr["FSuministro"])).Date; ////Tomo en cuenta su fecha de suministro
                    strCalculo += "SURTIDO - Pedido: " + dr["PedidoReferencia"].ToString().Trim() + "// Fecha Orígen: " + SourceDate.ToShortDateString();
                    break;

                case "CANCELADO":                                            //Si está cancelado...
                    strCalculo += " ***EL ULTIMO PEDIDO FUE CANCELADO*** ";
                    if (((byte)(dr["TipoPedido"]) == 2))                     //Si era programado...
                    {
                        SourceDate  = ((DateTime)(dr["FCancelacion"])).Date; //Tomo en cuenta su fecha de cancelación (REGLA)
                        strCalculo += "CANCELADO - Pedido: " + dr["PedidoReferencia"].ToString().Trim() + "/ Fecha Orígen: " + SourceDate.ToShortDateString();
                    }
                    else                             //De lo contrario tomo en cuenta la fecha del último pedido suministrado (REGLA)
                    {
                        strCalculo += " //Leyendo el histórico.../// ";

                        while (dr.Read())
                        {
                            if (((String)(dr["Status"])).Trim() == "SURTIDO")
                            {
                                SourceDate  = (((DateTime)(dr["FSuministro"]))).Date;
                                strCalculo += "SURTIDO - Pedido: " + dr["PedidoReferencia"].ToString().Trim() + "/ Fecha Orígen: " + SourceDate.ToShortDateString();
                            }
                            else
                            {
                                //De plano si no tiene un pedido surtido en su historial, lo programo para mañana!
                                SourceDate  = FechaServidor.AddDays(1);
                                strCalculo += "El cliente no tiene histórico pedidos surtidos.  Se programará para el día de mañana " + SourceDate.ToShortDateString();
                            }
                        }
                    }
                    break;

                case "ACTIVO":                         //Si está activo
                    SourceDate  = (((DateTime)(dr["FCompromiso"]))).Date;
                    strCalculo += " [El último pedido está activo.  Se tomará en cuenta la fecha de compromiso de éste [" + SourceDate.ToShortDateString() + "]";
                    break;
                }
            }

            catch (Exception ex)
            {
                throw new Exception("Error fatal!", ex);
            }

            //De plano... DE PLANO si no se pudo determinar la fecha orígen... entonces hay un error!
            if (SourceDate == DateTime.MinValue)
            {
                throw new Exception("No se pudo determinar la fecha orígen para la programación.");
            }
            _Calculo = strCalculo;
            if (cn.State == ConnectionState.Open)
            {
                cn.Close();
            }

            _FProximoPedido = SiguienteFecha(_FOrigen, _Cliente);
        }
Example #30
0
        protected override void InitForm()
        {
            Pub.SetFormAppIcon(this);
            System.Globalization.DateTimeFormatInfo fmtInfo = System.Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat;
            LocalFormat = "dddd  " + fmtInfo.LongDatePattern + " " + fmtInfo.LongTimePattern;
            Rectangle rect = Screen.PrimaryScreen.WorkingArea;

            formCode = "Main";
            base.InitForm();
            MDICaption = SystemInfo.AppTitle + " " + SystemInfo.AppVersion;
            if (SystemInfo.CustomerName != "")
            {
                MDICaption = MDICaption + "[" + SystemInfo.CustomerName + "]";
            }
            this.Left               = rect.Left;
            this.Top                = rect.Top;
            this.Width              = rect.Width;
            this.Height             = rect.Height;
            this.WindowState        = FormWindowState.Maximized;
            this.Text               = SystemInfo.AppTitle;
            SystemInfo.SystemIsExit = false;
            SystemInfo.MainHandle   = this.Handle;
            lblUser.Text            = lblUser.Text + OprtInfo.OprtNoAndName;
            lblAcc.Text             = lblAcc.Text + SystemInfo.AccDBName;
            if (SystemInfo.AccDBName != SystemInfo.DatabaseName)
            {
                lblAcc.Text = lblAcc.Text + "[" + SystemInfo.DatabaseName + "]";
            }
            SystemInfo.funcList.Clear();
            int itemIndex = 1;

            LoadDll(ref objRS, ref tpRS, "ECard.RS.dll", ref itemIndex, mnuRS_Click);
            LoadDll(ref objKQ, ref tpKQ, "ECard.KQ.dll", ref itemIndex, mnuKQ_Click);
            LoadDll(ref objMJ, ref tpMJ, "ECard.MJNew.dll", ref itemIndex, mnuMJ_Click);
            if (objMJ == null || tpMJ == null)
            {
                LoadDll(ref objMJ, ref tpMJ, "ECard.MJ.dll", ref itemIndex, mnuMJ_Click);
            }
            SystemInfo.IsNewMJ = MJIsNew(objMJ, tpMJ);
            LoadDll(ref objSF, ref tpSF, "ECard.SF.dll", ref itemIndex, mnuSF_Click);
            LoadDll(ref objSK, ref tpSK, "ECard.SK.dll", ref itemIndex, mnuSK_Click);
            SystemInfo.HasRS  = (objRS != null) && (tpRS != null);
            SystemInfo.HasKQ  = (objKQ != null) && (tpKQ != null);
            SystemInfo.HasMJ  = (objMJ != null) && (tpMJ != null);
            SystemInfo.HasSF  = (objSF != null) && (tpSF != null);
            SystemInfo.HasSK  = (objSK != null) && (tpSK != null);
            SystemInfo.KQFlag = KQFlag(objKQ, tpKQ);
            if (SystemInfo.HasRS)
            {
                LoadDll(ref objRSReport, ref tpRSReport, "RSReport.dll", ref itemIndex, mnuRSReport_Click, false);
            }
            if (SystemInfo.HasKQ)
            {
                LoadDll(ref objKQReport, ref tpKQReport, "KQReport.dll", ref itemIndex, mnuKQReport_Click, false);
            }
            if (SystemInfo.HasMJ)
            {
                LoadDll(ref objMJReport, ref tpMJReport, "MJReport.dll", ref itemIndex, mnuMJReport_Click, false);
            }
            if (SystemInfo.HasSF)
            {
                LoadDll(ref objSFReport, ref tpSFReport, "SFReport.dll", ref itemIndex, mnuSFReport_Click, false);
            }
            if (SystemInfo.HasSK)
            {
                LoadDll(ref objSKReport, ref tpSKReport, "SKReport.dll", ref itemIndex, mnuSKReport_Click, false);
            }
            SystemInfo.HasFaCard = false;
            if ((SystemInfo.HasKQ && ((SystemInfo.KQFlag == 0) || (SystemInfo.KQFlag == 2))) || SystemInfo.HasSF || SystemInfo.HasSK)
            {
                SystemInfo.HasFaCard = true;
            }
            ToolBar.Items.Clear();
            AddToolbarButton(mnuWindowClose.Text, mnuWindowClose.Image, mnuWindowClose_Click);
            AddToolbarSeparator();
            AddToolbarButton(mnuSYClose.Text, mnuSYClose.Image, mnuSYClose_Click);
            string dllName = "";

            System.Collections.ArrayList objList = new System.Collections.ArrayList();
            System.Collections.ArrayList tpList  = new System.Collections.ArrayList();
            System.Collections.ArrayList naList  = new System.Collections.ArrayList();
            Assembly obj;
            Type     tp;
            string   na;

            for (int i = 1; i <= 10; i++)
            {
                dllName = SystemInfo.ini.ReadIni("ExtDll", i.ToString(), "");
                if (dllName == "")
                {
                    continue;
                }
                if (!File.Exists(SystemInfo.AppPath + dllName))
                {
                    continue;
                }
                obj = null;
                tp  = null;
                LoadDll(ref obj, ref tp, dllName, ref itemIndex, mnuExt_Click);
                na = GetDllName(obj, tp);
                objList.Add(obj);
                tpList.Add(tp);
                naList.Add(na);
            }
            ExtModuleInfo.objDll   = new Assembly[objList.Count];
            ExtModuleInfo.tpDll    = new Type[objList.Count];
            ExtModuleInfo.homeName = new string[objList.Count];
            for (int i = 0; i < objList.Count; i++)
            {
                ExtModuleInfo.objDll[i]   = (Assembly)objList[i];
                ExtModuleInfo.tpDll[i]    = (Type)tpList[i];
                ExtModuleInfo.homeName[i] = (string)naList[i];
            }
            ShowMDIForm(new frmMainHome());
            db.SetConnStr(SystemInfo.ConnStr);
            RegisterInfo.Serial      = db.GetRegSerial();
            RegisterInfo.EmpCount    = db.GetEmpCount();
            RegisterInfo.ModuleCount = 0;
            if (SystemInfo.HasKQ)
            {
                RegisterInfo.ModuleCount += 1;
            }
            if (SystemInfo.HasMJ)
            {
                RegisterInfo.ModuleCount += 1;
            }
            if (SystemInfo.HasSF)
            {
                RegisterInfo.ModuleCount += 1;
            }
            if (SystemInfo.HasSK)
            {
                RegisterInfo.ModuleCount += 1;
            }
            if (ExtModuleInfo.objDll != null)
            {
                RegisterInfo.ModuleCount += ExtModuleInfo.objDll.Length;
            }
            RegisterInfo.MustReg = db.ReadConfig("SystemRegister", "MustReg", false);
            if (SystemInfo.DBType == 1)
            {
                Database dbSerial = new Database(GetConnStrSystem());
                try
                {
                    if (!dbSerial.IsOpen)
                    {
                        dbSerial.Open();
                    }
                    string tmpSerial = dbSerial.GetDBServerSerial();
                    if (tmpSerial != "")
                    {
                        RegisterInfo.Serial = tmpSerial;
                    }
                }
                finally
                {
                    dbSerial.Close();
                }
            }
            db.IsRegister(true, "", "");
            RegisterInfo.AllowReg = (RegisterInfo.EmpCount >= 300) || (RegisterInfo.ModuleCount > 1) || RegisterInfo.MustReg;
            SetMDICaption();
            if (SystemInfo.HasRS)
            {
                db.UpdateModuleResources(this.Text, objRS);
            }
            if (SystemInfo.HasKQ)
            {
                db.UpdateModuleResources(this.Text, objKQ);
            }
            if (SystemInfo.HasMJ)
            {
                db.UpdateModuleResources(this.Text, objMJ);
            }
            if (SystemInfo.HasSF)
            {
                db.UpdateModuleResources(this.Text, objSF);
            }
            if (SystemInfo.HasSK)
            {
                db.UpdateModuleResources(this.Text, objSK);
            }
            if (objRSReport != null)
            {
                db.UpdateModuleResources(this.Text, objRSReport);
            }
            if (objKQReport != null)
            {
                db.UpdateModuleResources(this.Text, objKQReport);
            }
            if (objMJReport != null)
            {
                db.UpdateModuleResources(this.Text, objMJReport);
            }
            if (objSFReport != null)
            {
                db.UpdateModuleResources(this.Text, objSFReport);
            }
            if (objSKReport != null)
            {
                db.UpdateModuleResources(this.Text, objSKReport);
            }
            DataTableReader dr = null;

            try
            {
                dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_000002, new string[] { "2" }));
                if (dr.Read())
                {
                    SystemInfo.AccDBVersion = dr["DbVersion"].ToString() + ".";
                    DateTime dt = Convert.ToDateTime(dr["DbDate"]);
                    SystemInfo.AccDBVersion = SystemInfo.AccDBVersion + dt.ToString(SystemInfo.DateFormatDBVer);
                }
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
        }
        private void btnFinish_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtTicketName.Text))
            {
                XtraMessageBox.Show("请输入操作票名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrEmpty(this.txtTaskName.Text))
            {
                XtraMessageBox.Show("请输入操作任务!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrEmpty(this.txtNo.Text))
            {
                XtraMessageBox.Show("请输入操作编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrEmpty(this.txtOperationDate.Text))
            {
                XtraMessageBox.Show("请选择操作日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrEmpty(this.txtUser.Text))
            {
                XtraMessageBox.Show("请输入开票人!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (this.viewRoom.RowCount < 1)
            {
                XtraMessageBox.Show("请录入操作步骤!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (this.txtStartTime.Text == "00:00:00")
            {
                if (XtraMessageBox.Show(string.Format("确认操作开始时间为 00:00:00 吗?"), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
                {
                    return;
                }
            }
            if (this.txtEndTime.Text == "00:00:00")
            {
                if (XtraMessageBox.Show(string.Format("确认操作结束时间为 00:00:00 吗?"), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
                {
                    return;
                }
            }
            System.Globalization.DateTimeFormatInfo dtForm = new System.Globalization.DateTimeFormatInfo();
            dtForm.ShortTimePattern = "HH:mm:ss";
            if (Convert.ToDateTime(this.txtStartTime.Text, dtForm) > Convert.ToDateTime(this.txtEndTime.Text, dtForm))
            {
                if (XtraMessageBox.Show(string.Format("确认操作开始时间大于结束时间吗?"), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
                {
                    return;
                }
            }
            if (this.txtStartTime.Text == this.txtEndTime.Text)
            {
                XtraMessageBox.Show("操作开始时间和结束时间相同!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            Dictionary <string, string> dicTicket = new Dictionary <string, string>();

            dicTicket["No"]            = this.txtNo.Text;;
            dicTicket["Name"]          = this.txtTicketName.Text;
            dicTicket["Task"]          = this.txtTaskName.Text;
            dicTicket["OperationDate"] = this.txtOperationDate.Text;
            dicTicket["User"]          = this.txtUser.Text;
            dicTicket["StartTime"]     = this.txtStartTime.Text;
            dicTicket["EndTime"]       = this.txtEndTime.Text;
            dicTicket["CreateTime"]    = this.txtCreateTime.Text;
            dicTicket["CreateComment"] = this.txtCreateComment.Text;

            for (int i = 0; i < dtGridView.Rows.Count; i++)
            {
                dtGridView.Rows[i]["CreateTime"] = this.txtCreateTime.Text;
            }

            if (!sqlTool.AddTicket(dicTicket))
            {
                XtraMessageBox.Show("新增操作票失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (!sqlTool.AddOperations(dtGridView))
            {
                XtraMessageBox.Show("新增操作票步骤失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        private int[] AddData()
        {
            int[] result = new int[2];
            if (Session["UserId"] != null && Session["UserId"].ToString() != string.Empty)
            {
                int    PortalId      = Convert.ToInt32(ddlPortalList.SelectedValue);
                int    ContentItemId = int.Parse(ddlContentItem.SelectedValue);
                int    RouteId       = int.Parse(ddlRouterList.SelectedValue);
                string TabName       = txt_TabName.Text;
                string Title         = txt_Title.Text;
                int    ParentId      = int.Parse(ddlParentTab.SelectedValue);
                string Description   = txt_Desc.Text;
                string Keywords      = txt_Keywords.Text;

                string  Url             = txt_Url.Text;
                string  TabPath         = txt_Path.Text;
                decimal SiteMapPriority = Convert.ToDecimal(txtSiteMapPriority.Text) / 10;

                string PageHeadText   = txt_PageHeadText.Text;
                string PageFooterText = txt_PageFooterText.Text;
                string CssClass       = txt_CssClass.Text;
                string CultureCode    = ddlCultureCode.SelectedValue;
                //  string StartDate=txt_StartDate.Text;
                //   string EndDate= txt_EndDate.Text;

                #region xu ly thoi gian  ====================================================================================
                System.Globalization.DateTimeFormatInfo MyDateTimeFormatInfo = new System.Globalization.DateTimeFormatInfo();
                MyDateTimeFormatInfo.ShortDatePattern = "dd/MM/yyyy";

                string StartDate = null, EndDate = null;

                if (txt_StartDate.Text != string.Empty && txt_StartDate.Text != "__/__/____")
                {
                    DateTime _start_date = DateTime.Parse(txt_StartDate.Text, MyDateTimeFormatInfo);
                    StartDate = _start_date.ToString("yyyy-MM-dd");
                }
                if (txt_EndDate.Text != string.Empty && txt_EndDate.Text != "__/__/____")
                {
                    DateTime _end_date = DateTime.Parse(txt_EndDate.Text, MyDateTimeFormatInfo);
                    EndDate = _end_date.ToString("yyyy-MM-dd");
                }
                if (txt_StartDate.Text != string.Empty && txt_StartDate.Text != "__/__/____" &&
                    txt_EndDate.Text != string.Empty && txt_EndDate.Text != "__/__/____")
                {
                    DateTime _start_date = DateTime.Parse(txt_StartDate.Text, MyDateTimeFormatInfo);
                    DateTime _end_date   = DateTime.Parse(txt_EndDate.Text, MyDateTimeFormatInfo);

                    if (DateTime.Compare(_start_date, _end_date) > 0)
                    {
                        string scriptCode = "<script>alert('Thời điểm bắt đầu phải nhỏ hơn thời điểm kết thúc');</script>";
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scriptName", scriptCode);
                    }
                }
                #endregion ================================================================================================

                /*** UPLOAD *************************************************************************************************************/
                HttpPostedFile icon_file = FileIconInput.PostedFile;
                HttpPostedFile icon_large_file = FileIconLargeInput.PostedFile;
                string         IconFileName = "", IconFileLargeName = "", IconFilePath = string.Empty, IconFileLargePath = string.Empty;
                if (icon_file.ContentLength > 0)
                {
                    ModuleClass module_obj = new ModuleClass();
                    IconFileName = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                    IconFilePath = Server.MapPath(small_icon_path + "/" + IconFileName);
                    icon_file.SaveAs(IconFilePath);
                }

                if (icon_large_file.ContentLength > 0)
                {
                    IconFileLargeName = System.IO.Path.GetFileName(icon_large_file.FileName);
                    IconFileLargePath = Server.MapPath(large_icon_path + "/" + IconFileLargeName);
                    icon_file.SaveAs(IconFileLargePath);
                }
                /************************************************************************************************************************/

                bool IsDeleted = true, IsVisible = true, DisableLink = false, DisplayTitle = false, IsSecure = false, PermanentRedirect = false;
                IsDeleted         = chkIsDelete.Checked;
                IsVisible         = chkIsVisible.Checked;
                DisableLink       = chkDisableLink.Checked;
                DisplayTitle      = chkDisplayTitle.Checked;
                IsSecure          = chkIsSecure.Checked;
                PermanentRedirect = chkPermanentRedirect.Checked;


                result = tab_obj.Insert(PortalId, ContentItemId, ParentId, TabName, Title, CssClass,
                                        IconFileName, IconFileLargeName, Description, Keywords, DisplayTitle, IsDeleted, IsVisible,
                                        DisableLink, IsSecure, PermanentRedirect, SiteMapPriority, Url, TabPath, RouteId, PageHeadText, PageFooterText, "", StartDate, EndDate, CultureCode, UserId);
            }
            return(result);
        }
Example #33
0
        private string[] loadFile( bool setPomodoroCount)
        {
            string[] lines = _storage.GetAllLines();
            bool lastLineIsToday = false;

            string lastLine = "";
            if (lines.Length > 0)
                lastLine = lines.Last();

            if(lastLine.Length >0)
            {
                string[] components = lastLine.Split(',');
                if (components.Length >= 2)
                {
                    string date = components[0];
                    string pomodoros = components[1];
                    IFormatProvider provider = new System.Globalization.DateTimeFormatInfo();

                    if(DateTime.ParseExact(date,"yyyyMMdd", provider).Date == DateTime.Now.Date)
                    {
                        lastLineIsToday = true;
                        if(setPomodoroCount)
                            _pomodorosToday = int.Parse(pomodoros);
                    }
                }
            }

            if(lastLineIsToday)// Special Treatment for today's line
            {
                string[] result = new string[lines.Count()-1];
                Array.Copy(lines, 0, result, 0, lines.Count() - 1);// remove the last line  from our array as we will update the count.
                return result;
            }
            else
            {
                return lines;
            }
        }
Example #34
0
 public string GetIndexableFormat(string propertyName, string value)
 {
     if (!_map.ContainsKey(propertyName)) return value;
     string type = _map[propertyName];
     string retval = value;
     switch (type)
     {
         case "Date":
             System.Globalization.DateTimeFormatInfo dfi = new System.Globalization.DateTimeFormatInfo();
             //dfi.ShortDatePattern = "YYYYMMDD";
             DateTime dt = DateTime.Parse(value);
             //retval = dt.ToString("s");
             //retval = _convertDateStringToIndexable(dt.ToShortDateString());
             retval = dt.ToString(dfi.SortableDateTimePattern);
             break;
         case "Number":
             long l = long.Parse(value);
             retval = l.ToString("000000000000");
             break;
         default:
             break;
     }
     return retval;
 }
Example #35
0
		private void btnNextDinner_Click(object sender, EventArgs e)
		{
			List<int> users = new List<int>();
			for (int i = 0; i < ds.Tables["user"].Rows.Count; i++)
			{
				if (Convert.ToBoolean(ds.Tables["user"].Rows[i]["Active"]))
				{
					users.Add(i);
				}
			}
			int numUsers = users.Count;
			int numDinners = (numUsers + 2) / 4;
			int currentDinner;
			bool isSorted;
			List<int> remaining = new List<int>();
			int[,] hostedCountSorted, currDinnerGridTally = new int[2, numUsers];
			int[,] dinners = new int[numDinners, 5];
			string date = "";

			for (int i = 0; i < dinners.GetLength(0); i++)
			{
				for (int j = 0; j < dinners.GetLength(1); j++)
				{
					dinners[i, j] = -1;
				}
			}

			int to, from, temp1, temp2;

			//get date
			System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
			date = mfi.GetAbbreviatedMonthName(dateTimePicker1.Value.Month) + " " + dateTimePicker1.Value.Year;
			
			hostedCountSorted = new int[2, numUsers];
			for (int i = 0; i < numUsers; i++)
			{
				hostedCountSorted[0, i] = users[i];
				hostedCountSorted[1, i] = Convert.ToInt16(ds.Tables["user"].Rows[users[i]]["Host#"].ToString()) + 1;
			}

			//host month/active exceptions
			int dateMonth = dateTimePicker1.Value.Month;
			int userMonth;
			for (int i = 0; i < numUsers; i++)
			{
				userMonth = Convert.ToInt16(ds.Tables["user"].Rows[users[i]]["Month"]);
				if (userMonth == dateMonth)
				{
					hostedCountSorted[1, users[i]] = 0;
				}
				else if (userMonth != 0)
				{
					hostedCountSorted[1, users[i]] = Int16.MaxValue;
				}
			}

			//randomize
			Random rnd = new Random();

			for (int i = 0; i < numUsers * 2; i++)
			{
				to = rnd.Next(0, hostedCountSorted.GetLength(1));
				from = rnd.Next(0, hostedCountSorted.GetLength(1));
				temp1 = hostedCountSorted[0, to];
				temp2 = hostedCountSorted[1, to];
				hostedCountSorted[0, to] = hostedCountSorted[0, from];
				hostedCountSorted[1, to] = hostedCountSorted[1, from];
				hostedCountSorted[0, from] = temp1;
				hostedCountSorted[1, from] = temp2;
			}

			//sort
			do
			{
				isSorted = true;
				for (int i = 0; i < hostedCountSorted.GetLength(1) - 1; i++)
				{
					if (hostedCountSorted[1, i] > hostedCountSorted[1, i + 1])
					{
						//swap hosted values
						temp1 = hostedCountSorted[1, i];
						hostedCountSorted[1, i] = hostedCountSorted[1, i + 1];
						hostedCountSorted[1, i + 1] = temp1;
						//swap id
						temp1 = hostedCountSorted[0, i];
						hostedCountSorted[0, i] = hostedCountSorted[0, i + 1];
						hostedCountSorted[0, i + 1] = temp1;
						isSorted = false;
					}
				}
			} while (!isSorted);

			//choose the lowest x hosts, where x is the number of dinners
			for (int i = 0; i < numDinners; i++)
			{
				//update number of times user has hosted
				ds.Tables["user"].Rows[hostedCountSorted[0, i]]["Host#"] = Convert.ToInt16(ds.Tables["user"].Rows[hostedCountSorted[0, i]]["Host#"].ToString()) + 1;

				//add host id to dinner array
				dinners[i, 0] = hostedCountSorted[0, i];
			}

			//list of ids
			remaining = users; //(basically name change)
			
			//remove hosts from grid copy
			for (int i = 0; i < dinners.GetLength(0); i++)
			{
				remaining.Remove(dinners[i, 0]);
			}
			
			//for each person left, find them a group
			currentDinner = 0;
			while (remaining.Count > 0)
			{
				//get grid tally for all users according to people in current group
				currDinnerGridTally = new int[2, remaining.Count];
				for (int i = 0; i < dinners.GetLength(1); i++)
				{
					if (dinners[currentDinner, i] == -1)
						break;
					for (int j = 0; j < remaining.Count; j++)
					{
						currDinnerGridTally[0, j] = remaining[j];
						currDinnerGridTally[1, j] += Convert.ToInt16(ds.Tables["matchCount"].Rows[dinners[currentDinner, i]][remaining[j]]);
					}
				}

				//randomize
				for (int i = 0; i < currDinnerGridTally.GetLength(1) * 2; i++)
				{
					to = rnd.Next(0, currDinnerGridTally.GetLength(1));
					from = rnd.Next(0, currDinnerGridTally.GetLength(1));
					temp1 = currDinnerGridTally[0, to];
					temp2 = currDinnerGridTally[1, to];
					currDinnerGridTally[0, to] = currDinnerGridTally[0, from];
					currDinnerGridTally[1, to] = currDinnerGridTally[1, from];
					currDinnerGridTally[0, from] = temp1;
					currDinnerGridTally[1, from] = temp2;
				}

				//sort
				do
				{
					isSorted = true;
					for (int i = 0; i < currDinnerGridTally.GetLength(1) - 1; i++)
					{
						if (currDinnerGridTally[1, i] > currDinnerGridTally[1, i + 1])
						{
							//swap hosted values
							temp1 = currDinnerGridTally[1, i];
							currDinnerGridTally[1, i] = currDinnerGridTally[1, i + 1];
							currDinnerGridTally[1, i + 1] = temp1;
							//swap id
							temp1 = currDinnerGridTally[0, i];
							currDinnerGridTally[0, i] = currDinnerGridTally[0, i + 1];
							currDinnerGridTally[0, i + 1] = temp1;
							isSorted = false;
						}
					}
				} while (!isSorted);

				//find available spot (indicated by -1) and put new member in
				for (int k = 1; k < dinners.GetLength(1); k++)
				{
					if (dinners[currentDinner, k] == -1)
					{
						dinners[currentDinner, k] = currDinnerGridTally[0, 0];

						break;
					}
				}
				remaining.Remove(currDinnerGridTally[0, 0]);

				currentDinner = (currentDinner + 1) % numDinners;
			}

			//increase matched (grid) count
			//loop through dinners
			for (int i = 0; i < dinners.GetLength(0); i++)
			{
				for (int j = 0; j < dinners.GetLength(1); j++)
				{
					for (int k = 0; k < dinners.GetLength(1); k++)
					{
						if (!(j == k || dinners[i, j] == -1 || dinners[i, k] == -1))
						{
							ds.Tables["matchCount"].Rows[dinners[i, j]][dinners[i, k]] = Convert.ToInt16(ds.Tables["matchCount"].Rows[dinners[i, j]][dinners[i, k]]) + 1;
						}
					}
				}
			}

			history.Add(dinners);
			historyDate.Add(date);
			if (lsbDinnerSelect.Items[0].ToString().Equals("<empty>"))
				lsbDinnerSelect.Items.Clear();
			lsbDinnerSelect.Items.Add(date);

			UpdateCellColors();
		}
Example #36
0
        protected void borrowButton_Click(object sender, EventArgs e)
        {
            if (perm == "user")
            {
                try
                {
                    List <string> columnNames = new List <string>();
                    List <string> values      = new List <string>();
                    string        itemID      = String.Empty;
                    string        userID      = String.Empty;
                    string        date        = String.Empty;
                    string        itemColumns = String.Empty;
                    string        userColumns = String.Empty;
                    string        itemValues  = String.Empty;
                    string        userValues  = String.Empty;
                    string        addColumns  = String.Empty;
                    DateTime      dateNow;

                    assetsConn.Open();

                    assetsCmd.Connection = assetsConn;

                    assetsCmd.CommandText = "SELECT * FROM Assets";

                    OleDbDataReader dr = assetsCmd.ExecuteReader();

                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        if (i > 4)
                        {
                            itemColumns += dr.GetName(i) + ", ";
                        }
                    }
                    dr.Close();

                    assetsCmd.CommandText = "SELECT * FROM People";

                    dr = assetsCmd.ExecuteReader();

                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        if (i > 1 && i != dr.FieldCount - 1)
                        {
                            userColumns += dr.GetName(i) + ", ";
                        }
                        if (i > 1 && i == dr.FieldCount - 1)
                        {
                            userColumns += dr.GetName(i);
                        }
                    }
                    dr.Close();

                    itemID = borrowsGrid.SelectedRow.Cells[1].Text;

                    assetsCmd.CommandText = "SELECT ID FROM People WHERE Nazwa = @userName";
                    assetsCmd.Parameters.AddWithValue("@userName", HttpContext.Current.User.Identity.Name);

                    userID = assetsCmd.ExecuteScalar().ToString();
                    date   = System.DateTime.Now.ToString();
                    System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo();
                    dateInfo.FullDateTimePattern = "dd/MM/yyyy HH:mm:ss tt";
                    dateNow = Convert.ToDateTime(date, dateInfo);

                    assetsCmd.Parameters.Clear();

                    itemColumns           = itemColumns.Remove(itemColumns.LastIndexOf(','));
                    assetsCmd.CommandText = "SELECT " + itemColumns + " FROM Assets WHERE ID = " + itemID;

                    dr = assetsCmd.ExecuteReader();
                    dr.Read();
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        itemValues += "'" + dr.GetString(i) + "'" + ", ";
                    }
                    dr.Close();

                    assetsCmd.CommandText = "SELECT " + userColumns + " FROM People WHERE ID = " + userID;
                    dr = assetsCmd.ExecuteReader();
                    dr.Read();
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        if (i < dr.FieldCount - 1)
                        {
                            userValues += "'" + dr.GetString(i) + "'" + ", ";
                        }
                        if (i == dr.FieldCount - 1)
                        {
                            userValues += "'" + dr.GetString(i) + "'";
                        }
                    }
                    dr.Close();

                    itemColumns += ", ";

                    assetsCmd.CommandText = "SELECT * FROM Assets";
                    dr = assetsCmd.ExecuteReader();

                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        if (i > 3)
                        {
                            addColumns += dr.GetName(i) + " string" + ", ";
                        }
                    }
                    dr.Close();

                    assetsCmd.CommandText = "SELECT * FROM People";
                    dr = assetsCmd.ExecuteReader();

                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        if (i > 1 && i < dr.FieldCount - 1)
                        {
                            addColumns += dr.GetName(i) + " string" + ", ";
                        }
                        if (i == dr.FieldCount - 1)
                        {
                            addColumns += dr.GetName(i) + " string";
                        }
                    }
                    dr.Close();

                    if (columnNames.Count == 7)
                    {
                        assetsCmd.CommandText = "ALTER TABLE Borrows ADD " + addColumns;
                        assetsCmd.ExecuteNonQuery();
                    }

                    assetsCmd.CommandText = "INSERT INTO Borrows (ID_przedmiotu, ID_użytkownika, Wypożyczony, Data_wypożyczenia, " + itemColumns + userColumns + ") VALUES (@itemID, @userID, 'Tak', @dateNow, " + itemValues + userValues + ")";
                    assetsCmd.Parameters.AddWithValue("@itemID", itemID);
                    assetsCmd.Parameters.AddWithValue("@userID", userID);
                    assetsCmd.Parameters.AddWithValue("@dateNow", dateNow);
                    assetsCmd.ExecuteNonQuery();
                    assetsCmd.Parameters.Clear();

                    assetsCmd.CommandText = "UPDATE Assets SET Wypożyczony = 'Tak' WHERE ID = @itemID";
                    assetsCmd.Parameters.AddWithValue("@itemID", itemID);
                    assetsCmd.ExecuteNonQuery();
                    assetsCmd.Parameters.Clear();
                    assetsConn.Close();

                    if (createPDFCheckBox.Checked)
                    {
                        assetsConn.Open();
                        assetsCmd.CommandText = "SELECT * FROM Borrows WHERE ID = (SELECT MAX(ID) FROM Borrows)";

                        dr = assetsCmd.ExecuteReader();
                        for (int i = 0; i < dr.FieldCount; i++)
                        {
                            columnNames.Add(dr.GetName(i));
                        }

                        dr.Read();

                        for (int i = 0; i < dr.FieldCount; i++)
                        {
                            values.Add(dr.GetValue(i).ToString());
                        }

                        assetsConn.Close();

                        var doc = new Document();
                        PdfWriter.GetInstance(doc, new FileStream(AppDomain.CurrentDomain.BaseDirectory + "PDF\\Wypożyczenia\\" + System.DateTime.Now.ToString("yyyy_MM_dd-HH_mm") + ".pdf", FileMode.Create));

                        doc.Open();

                        Font      titleFont = FontFactory.GetFont(BaseFont.TIMES_ROMAN, BaseFont.CP1257, 14f, Font.BOLD);
                        Font      dataFont  = FontFactory.GetFont(BaseFont.TIMES_ROMAN, BaseFont.CP1257, 12f);
                        Phrase    title     = new Phrase("Potwierdzenie wypożyczenia", titleFont);
                        Paragraph titlePar  = new Paragraph(title);
                        Paragraph dataPar   = new Paragraph();

                        for (int i = 0; i < columnNames.Count; i++)
                        {
                            Phrase p = new Phrase(columnNames[i] + ": " + values[i] + "\n", dataFont);
                            dataPar.Add(p);
                        }
                        titlePar.SetAlignment("Center");
                        doc.Add(titlePar);
                        doc.Add(dataPar);
                        doc.Close();

                        Scripts.OperationLogCreator op1 = new Scripts.OperationLogCreator();
                        op1.OperationLog("UserID: " + userID + " || Operacja wykonana: wygenerowanie wydruku potwierdzającego wypożyczenie przedmiotu o ID: " + itemID);
                    }
                    Scripts.OperationLogCreator op = new Scripts.OperationLogCreator();
                    op.OperationLog("UserID: " + userID + " || Operacja wykonana: wypożyczenie przedmiotu o ID: " + itemID);

                    ClearTextBoxes();
                }
                catch (Exception exc)
                {
                    Scripts.ErrorLogCreator err = new Scripts.ErrorLogCreator();
                    err.ErrorLog(exc.Message);
                    errorLabel.Text = "Błąd! " + exc.Message;
                }
                finally
                {
                    assetsConn.Close();
                    usersConn.Close();
                }
            }
        }
        private int UpdateData()
        {
            string ApplicationId = ddlApplicationList.SelectedValue;
            string PortalName = txtPortalName.Text;           
            string Currency = ddlCurrencyTypeList.SelectedValue;
            string HostFee = txtHostFee.Text;
            int HostSpace = Convert.ToInt32(txtHostSpace.Text);          
            string DefaultLanguage = ddlLanguageList.Text;
            string HomeDirectory = txtHomeDirectory.Text;
            string Url = txtUrl.Text;
            string KeyWords = txtKeyWords.Text;
            string FooterText = txtFooterText.Text;
            string Description = txtDescription.Text;
            string LastModifiedByUserId = Session["UserId"].ToString(); ;

            #region UPLOAD ************************************************************************************************************/            
            string logo_dir_path = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"] + "/portal_images/logo");
            string background_dir_path = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"] + "/portal_images/backgrounds");
            string LogoFile = string.Empty; string BackgroundFile = string.Empty;            
            FileHandleClass file_handle_obj = new FileHandleClass();

            HttpPostedFile _logo_file = InputLogoFile.PostedFile;
            if (_logo_file.ContentLength > 0)
            {
                string logo_file_path = logo_dir_path + "/" + HiddenLogoFile.Value;
                if (File.Exists(logo_file_path))
                {
                    File.Delete(logo_file_path);
                }
                LogoFile = file_handle_obj.uploadInputFile(_logo_file, logo_dir_path);
            }
            else
            {
                LogoFile = HiddenLogoFile.Value;
            }

            HttpPostedFile _background_file = InputBackgroundFile.PostedFile;
            if (_background_file.ContentLength > 0)
            {
                string background_file_path = background_dir_path + "/" + HiddenLogoFile.Value;
                if (File.Exists(background_file_path))
                {
                    File.Delete(background_file_path);
                }
                BackgroundFile = file_handle_obj.uploadInputFile(_background_file, background_dir_path);
            }
            else
            {
                BackgroundFile = HiddenBackgroundFile.Value;
            }
            #endregion ================================================================================

            #region xu ly thoi gian  =====================================================================================
            System.Globalization.DateTimeFormatInfo MyDateTimeFormatInfo = new System.Globalization.DateTimeFormatInfo();
            MyDateTimeFormatInfo.ShortDatePattern = "dd/MM/yyyy";
            string ExpiryDate = null;

            if (txtExpiryDate.Text != string.Empty)
            {
                DateTime _ExpiryDate = DateTime.Parse(txtExpiryDate.Text, MyDateTimeFormatInfo);
                ExpiryDate = _ExpiryDate.ToString("yyyy-MM-dd");
            }
            #endregion ====================================================================================================

            PortalController portal_obj = new PortalController();
            int i = portal_obj.Update(_idx, ApplicationId, PortalName, ExpiryDate, Currency, HostFee, HostSpace, DefaultLanguage,
                 HomeDirectory, Url, LogoFile, BackgroundFile, KeyWords, FooterText, Description, LastModifiedByUserId);
            return i;
        }
Example #38
0
 public DateType(System.Globalization.DateTimeFormatInfo dateFormat, TypeCodec dateCodec)
     : base("date")
 {
     dateFormatter = dateFormat;
     this.dateCodec = dateCodec;
 }
Example #39
0
 /// <summary>
 /// ������� �������� ��� ������������� � �������. ���������������� ��������� ������������
 /// </summary>
 private void CreateCulture()
 {
     try
       {
     System.Globalization.DateTimeFormatInfo dt = new System.Globalization.DateTimeFormatInfo();
     dt.ShortDatePattern = "dd.MM.yyyy";
     dt.LongDatePattern = "dd.MM.yyyy";
     dt.ShortTimePattern = "HH:mm";
     dt.LongTimePattern = "HH:mm:ss";
     System.Globalization.CultureInfo newCulture = new System.Globalization.CultureInfo(System.Globalization.CultureInfo.CurrentCulture.Name);
     newCulture.NumberFormat.NumberDecimalSeparator = ",";
     newCulture.NumberFormat.CurrencyDecimalSeparator = ",";
     newCulture.NumberFormat.PercentDecimalSeparator = ",";
     newCulture.NumberFormat.NumberGroupSeparator = " ";
     newCulture.DateTimeFormat = dt;
     System.Threading.Thread.CurrentThread.CurrentCulture = newCulture;
       }
       catch
       {
       }
 }
        private int[] AddData()
        {            
            int[] result = new int[2];
            if (Session["UserId"] != null && Session["UserId"].ToString() != string.Empty)
            {
                int PortalId = Convert.ToInt32(ddlPortalList.SelectedValue);
                int ContentItemId = int.Parse(ddlContentItem.SelectedValue);
                int RouteId = int.Parse(ddlRouterList.SelectedValue);
                string TabName = txt_TabName.Text;
                string Title = txt_Title.Text;
                int ParentId = int.Parse(ddlParentTab.SelectedValue);
                string Description = txt_Desc.Text;
                string Keywords = txt_Keywords.Text;

                string Url = txt_Url.Text;
                string TabPath = txt_Path.Text;
                decimal SiteMapPriority = Convert.ToDecimal(txtSiteMapPriority.Text)/10;

                string PageHeadText = txt_PageHeadText.Text;
                string PageFooterText = txt_PageFooterText.Text;
                string CssClass = txt_CssClass.Text;
                string CultureCode = ddlCultureCode.SelectedValue;
                //  string StartDate=txt_StartDate.Text;
                //   string EndDate= txt_EndDate.Text;

                #region xu ly thoi gian  ====================================================================================
                System.Globalization.DateTimeFormatInfo MyDateTimeFormatInfo = new System.Globalization.DateTimeFormatInfo();
                MyDateTimeFormatInfo.ShortDatePattern = "dd/MM/yyyy";

                string StartDate = null, EndDate = null;

                if (txt_StartDate.Text != string.Empty && txt_StartDate.Text != "__/__/____")
                {
                    DateTime _start_date = DateTime.Parse(txt_StartDate.Text, MyDateTimeFormatInfo);
                    StartDate = _start_date.ToString("yyyy-MM-dd");
                }
                if (txt_EndDate.Text != string.Empty && txt_EndDate.Text != "__/__/____")
                {
                    DateTime _end_date = DateTime.Parse(txt_EndDate.Text, MyDateTimeFormatInfo);
                    EndDate = _end_date.ToString("yyyy-MM-dd");
                }
                if (txt_StartDate.Text != string.Empty && txt_StartDate.Text != "__/__/____"
                    && txt_EndDate.Text != string.Empty && txt_EndDate.Text != "__/__/____")
                {
                    DateTime _start_date = DateTime.Parse(txt_StartDate.Text, MyDateTimeFormatInfo);
                    DateTime _end_date = DateTime.Parse(txt_EndDate.Text, MyDateTimeFormatInfo);

                    if (DateTime.Compare(_start_date, _end_date) > 0)
                    {
                        string scriptCode = "<script>alert('Thời điểm bắt đầu phải nhỏ hơn thời điểm kết thúc');</script>";
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scriptName", scriptCode);
                    }
                }
                #endregion ================================================================================================

                /*** UPLOAD *************************************************************************************************************/
                HttpPostedFile icon_file = FileIconInput.PostedFile;
                HttpPostedFile icon_large_file = FileIconLargeInput.PostedFile;
                string IconFileName = "", IconFileLargeName = "", IconFilePath = string.Empty, IconFileLargePath = string.Empty;
                if (icon_file.ContentLength > 0)
                {
                    ModuleClass module_obj = new ModuleClass();
                    IconFileName = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                    IconFilePath = Server.MapPath(small_icon_path + "/" + IconFileName);
                    icon_file.SaveAs(IconFilePath);
                }

                if (icon_large_file.ContentLength > 0)
                {
                    IconFileLargeName = System.IO.Path.GetFileName(icon_large_file.FileName);
                    IconFileLargePath = Server.MapPath(large_icon_path + "/" + IconFileLargeName);
                    icon_file.SaveAs(IconFileLargePath);
                }
                /************************************************************************************************************************/

                bool IsDeleted = true, IsVisible = true, DisableLink = false, DisplayTitle = false, IsSecure = false, PermanentRedirect = false;
                IsDeleted = chkIsDelete.Checked;
                IsVisible = chkIsVisible.Checked;
                DisableLink = chkDisableLink.Checked;
                DisplayTitle = chkDisplayTitle.Checked;
                IsSecure = chkIsSecure.Checked;
                PermanentRedirect = chkPermanentRedirect.Checked;

                
                result = tab_obj.Insert(PortalId, ContentItemId, ParentId, TabName, Title, CssClass,
                    IconFileName, IconFileLargeName, Description, Keywords, DisplayTitle, IsDeleted, IsVisible,
                    DisableLink, IsSecure, PermanentRedirect, SiteMapPriority, Url, TabPath, RouteId, PageHeadText, PageFooterText, "", StartDate, EndDate, CultureCode, UserId);
            }
            return result;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string selectedServer = "";
            string date;

            /*
             * if (this.ServerListFilterComboBox.SelectedIndex >= 0)
             * {
             *  selectedServer = this.ServerListFilterComboBox.SelectedItem.Value.ToString();
             * }
             */
            if (this.ServerListFilterListBox.SelectedItems.Count > 0)
            {
                selectedServer = "";
                for (int i = 0; i < this.ServerListFilterListBox.SelectedItems.Count; i++)
                {
                    selectedServer += "'" + this.ServerListFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                try
                {
                    selectedServer = selectedServer.Substring(0, selectedServer.Length - 1);
                }
                catch
                {
                    selectedServer = "";     // throw ex;
                }
                finally { }
            }
            //10/23/2013 NS modified - added jQuery month/year control

            /*
             * if (this.DateParamEdit.Text == "")
             * {
             *  date = DateTime.Now.ToString();
             *  this.DateParamEdit.Date = Convert.ToDateTime(date);
             * }
             * else
             * {
             *  date = this.DateParamEdit.Value.ToString();
             * }
             */
            if (startDate.Value.ToString() == "")
            {
                date = DateTime.Now.ToString();
            }
            else
            {
                date = startDate.Value.ToString();
            }
            DateTime dt = Convert.ToDateTime(date);

            DashboardReports.DominoResponseTimesMonthlyXtraRpt report = new DashboardReports.DominoResponseTimesMonthlyXtraRpt();
            report.Parameters["DateM"].Value = dt.Month;
            report.Parameters["DateY"].Value = dt.Year;
            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
            string strMonthName = mfi.GetMonthName(dt.Month).ToString() + ", " + dt.Year.ToString();

            report.Parameters["MonthYear"].Value  = strMonthName;
            report.Parameters["ServerName"].Value = selectedServer;
            this.ReportViewer1.Report             = report;
            this.ReportViewer1.DataBind();
            if (!IsPostBack)
            {
                fillcombo();
            }
        }
        private int UpdateData()
        {
            string ApplicationId        = ddlApplicationList.SelectedValue;
            string PortalName           = txtPortalName.Text;
            string Currency             = ddlCurrencyTypeList.SelectedValue;
            string HostFee              = txtHostFee.Text;
            int    HostSpace            = Convert.ToInt32(txtHostSpace.Text);
            string DefaultLanguage      = ddlLanguageList.Text;
            string HomeDirectory        = txtHomeDirectory.Text;
            string Url                  = txtUrl.Text;
            string KeyWords             = txtKeyWords.Text;
            string FooterText           = txtFooterText.Text;
            string Description          = txtDescription.Text;
            string LastModifiedByUserId = Session["UserId"].ToString();;

            #region UPLOAD ************************************************************************************************************/
            string          logo_dir_path = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"] + "/portal_images/logo");
            string          background_dir_path = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"] + "/portal_images/backgrounds");
            string          LogoFile = string.Empty; string BackgroundFile = string.Empty;
            FileHandleClass file_handle_obj = new FileHandleClass();

            HttpPostedFile _logo_file = InputLogoFile.PostedFile;
            if (_logo_file.ContentLength > 0)
            {
                string logo_file_path = logo_dir_path + "/" + HiddenLogoFile.Value;
                if (File.Exists(logo_file_path))
                {
                    File.Delete(logo_file_path);
                }
                LogoFile = file_handle_obj.uploadInputFile(_logo_file, logo_dir_path);
            }
            else
            {
                LogoFile = HiddenLogoFile.Value;
            }

            HttpPostedFile _background_file = InputBackgroundFile.PostedFile;
            if (_background_file.ContentLength > 0)
            {
                string background_file_path = background_dir_path + "/" + HiddenLogoFile.Value;
                if (File.Exists(background_file_path))
                {
                    File.Delete(background_file_path);
                }
                BackgroundFile = file_handle_obj.uploadInputFile(_background_file, background_dir_path);
            }
            else
            {
                BackgroundFile = HiddenBackgroundFile.Value;
            }
            #endregion ================================================================================

            #region xu ly thoi gian  =====================================================================================
            System.Globalization.DateTimeFormatInfo MyDateTimeFormatInfo = new System.Globalization.DateTimeFormatInfo();
            MyDateTimeFormatInfo.ShortDatePattern = "dd/MM/yyyy";
            string ExpiryDate = null;

            if (txtExpiryDate.Text != string.Empty)
            {
                DateTime _ExpiryDate = DateTime.Parse(txtExpiryDate.Text, MyDateTimeFormatInfo);
                ExpiryDate = _ExpiryDate.ToString("yyyy-MM-dd");
            }
            #endregion ====================================================================================================

            PortalController portal_obj = new PortalController();
            int i = portal_obj.Update(_idx, ApplicationId, PortalName, ExpiryDate, Currency, HostFee, HostSpace, DefaultLanguage,
                                      HomeDirectory, Url, LogoFile, BackgroundFile, KeyWords, FooterText, Description, LastModifiedByUserId);
            return(i);
        }
        public static System.Globalization.DateTimeFormatInfo ReadOnly(System.Globalization.DateTimeFormatInfo dtfi)
        {
            Contract.Ensures(Contract.Result <System.Globalization.DateTimeFormatInfo>() != null);

            return(default(System.Globalization.DateTimeFormatInfo));
        }
Example #44
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            PageTitle = TextCode(79);
            Section = "schools";
            CSS = "schools";
            UsesjQuery = true;
            LeftBar = "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='0'><TR VALIGN='TOP' BGCOLOR='#996699'><TD BACKGROUND='/media/schools/i_c_prpl_bar_bg.gif'><IMG SRC='/media/schools/i_s_schools_icon.gif' WIDTH='24' HEIGHT='23' BORDER='0' alt=''><IMG SRC='/media1/USSchools/h_schools" + SuffixCode() + ".gif' WIDTH='141' HEIGHT='23' ALIGN='TOP' alt=''>";
            #endregion Properties For The Base Class and Check Login

            strSSBackLink = Request.QueryString["SSBackLink"];

            strSSBackLink = (strSSBackLink == null) ? "" : strSSBackLink;
            if (strSSBackLink != "")
            {
                strSSBackLinkHTML = "<DIV ALIGN=\"LEFT\"><TABLE BORDER=\"0\" CELLPADDING=\"0\" cellspacing=\"0\" BGCOLOR=\"#555555\" WIDTH=\"228\" HEIGHT=\"21\">"
                    + "<TR><TD ALIGN=\"LEFT\" VALIGN=\"TOP\">"
                    + "<table WIDTH=\"227\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" HEIGHT=\"20\">"
                    + "<tr VALIGN=\"MIDDLE\">"
                    + "<td bgcolor=\"#999999\"><a href=\"" + strSSBackLink + "SchoolSelector.aspx?LoginID=" + LoginID + "&SSBackLink=" + strSSBackLink + "\" class=\"SSBackLink\"><img src=\"/media/shared/arrow.gif\" width=\"19\" height=\"12\" border=\"0\" ALIGN=\"LEFT\" alt=''><font size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\" COLOR=\"#FFFFFF\">"
                    + "<b>Back to School Selector Results</b></font></a></td>"
                    + "</tr>"
                    + "</table>"
                    + "</TD></TR></TABLE></DIV>";
                strSSBackSelfLink = "&SSBackLink=" + strSSBackLink;
            }

            string action = CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("Action");

            i1 = 0;
            i2 = 0;
            i3 = 0;
            i4 = 0;
            iTemp = 0;
            iIndex = 0; iRowCount = 0;
            bExpense = false;
            bTuition = false;
            bFee = false;
            bBook = false;
            bBoard = false;
            bBach = false; bbBach = false;
            bAssoc = false; bbAssoc = false;
            bNon = false; bbNon = false;
            bVT = false;
            bInterSports = false; bIntraSports = false; bSportScholarships = false;
            bShow1 = false; bShow2 = false; bShow3 = false; bShow4 = false; bShow5 = false; bShow6 = false; bShow7 = false; bShow8 = false;
            INUN_ID = Request["INUN_ID"];
            dtf = new System.Globalization.DateTimeFormatInfo();
            dataTable1 = new DataTable();
            dataTable1 = CCLib.Cache.GetCachedDataTable("UGSchoolProfile_All_" + INUN_ID, "UGSP_SelectAllByID " + INUN_ID);
            dtGRExpense = CCLib.Cache.GetCachedDataTable("GRSchoolExpense_" + INUN_ID, "select TUIT_AREA_FT_D,TUIT_NRES_FT_D,TUIT_INTL_FT_D,TUIT_STATE_FT_D,TUIT_OVERALL_FT_D,TUIT_VARY_PROG,TUIT_VARY_LOC,TUIT_VARY_TIME,TUIT_VARY_LOAD,TUIT_VARY_COURSE_LVL,TUIT_VARY_DEG,TUIT_VARY_RECIPROCITY,TUIT_VARY_STUD,TUIT_VARY_RELIGION,RM_BD_VARY_BD,RM_BD_VARY_LOC,RM_BD_VARY_HOUS,FEES_FT_D,RM_BD_D from GX_INST_View where INUN_ID = " + INUN_ID);
            dtStudentServices = CCLib.Cache.GetCachedDataTable("GRSchoolStudentServices_" + INUN_ID, "select * from GR_STUDENT_SERVICES_View where INUN_ID = " + INUN_ID);

            //DataTable dtLatLong = CCLib.Common.DataAccess.GetDataTable("Select latString, longString from zz_SchoolLoc where SchoolID='" + INUN_ID + "'");
            //strLat = dtLatLong.Rows[0][0].ToString();
            //strLong = dtLatLong.Rows[0][1].ToString();
            //string strLocationText = (dataTable1.Rows[0]["NAME"].ToString() + "+" + dataTable1.Rows[0]["LINE1"] + ",+" + dataTable1.Rows[0]["CITY"] + "+" + dataTable1.Rows[0]["STATE_CODE"] + "+" + dataTable1.Rows[0]["ZIPCODE"]).Replace(" ", "+");
            //strLocationText = (dataTable1.Rows[0]["LINE1"] + ",+" + dataTable1.Rows[0]["CITY"] + "+" + dataTable1.Rows[0]["STATE_CODE"] + "+" + dataTable1.Rows[0]["ZIPCODE"]).Replace(" ", "+");

            strSessionCookieValue = Request.Cookies["ASP.NET_SessionId"].Value;

            if (action == "CompareSchool")
            {
                string commandText = "Select INUN_ID FROM ux_vx_inst_view WHERE INUN_ID= " + INUN_ID;

                DataTable table = CareerCruisingWeb.CCLib.Cache.GetCachedDataTable("USSchoolProfile_INUN_IDs_" + INUN_ID, commandText);//Should Use Cache. Don Xiong 02/03/2010
            }

            if ((dataTable1.Rows[0]["TUIT_AREA_FT_D"].ToString() != "") || (dataTable1.Rows[0]["TUIT_NRES_FT_D"].ToString() != "") || (dataTable1.Rows[0]["TUIT_INTL_FT_D"].ToString() != "") || (dataTable1.Rows[0]["TUIT_STATE_FT_D"].ToString() != "") || (dataTable1.Rows[0]["TUIT_OVERALL_FT_D"].ToString() != ""))
                bTuition = true;
            if (dataTable1.Rows[0]["FEES_FT_D"].ToString() != "")
                bFee = true;
            if (dataTable1.Rows[0]["BOOKS_RES_D"].ToString() != "")
                bBook = true;
            if (dataTable1.Rows[0]["RM_BD_D"].ToString() != "")
                bBoard = true;
            if (dataTable1.Rows[0]["FRSH_FT_AP_N"].ToString() != "" || dataTable1.Rows[0]["UG_FT_AP_N"].ToString() != "" || dataTable1.Rows[0]["FRSH_FT_ND_N"].ToString() != "" || dataTable1.Rows[0]["UG_FT_ND_N"].ToString() != "" ||
                dataTable1.Rows[0]["FRSH_FT_ND_MET_N"].ToString() != "" || dataTable1.Rows[0]["UG_FT_ND_MET_N"].ToString() != "" || dataTable1.Rows[0]["FRSH_FT_ND_MET_P"].ToString() != "" || dataTable1.Rows[0]["UG_FT_ND_MET_P"].ToString() != "" ||
                dataTable1.Rows[0]["FRSH_FT_AVG_PKG_D"].ToString() != "" || dataTable1.Rows[0]["UG_FT_AVG_PKG_D"].ToString() != "" || dataTable1.Rows[0]["FRESH_FT_AVG_NB_LOAN_D"].ToString() != "" || dataTable1.Rows[0]["UG_FT_AVG_NB_LOAN_D"].ToString() != "" ||
                dataTable1.Rows[0]["FRSH_FT_AVG_NB_GIFT_D"].ToString() != "" || dataTable1.Rows[0]["UG_FT_AVG_NB_GIFT_D"].ToString() != "" || dataTable1.Rows[0]["FRESH_FT_NN_NONEED_D"].ToString() != "" || dataTable1.Rows[0]["UG_FT_NN_NONEED_D"].ToString() != "")
                bFinancialAid = true;
            if ((dataTable1.Rows[0]["SCHOL_NB_PELL"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_PERKINS"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_DIRECT_STAFFORD_SUB"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_DIRECT_STAFFORD_UNSUB"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_DIRECT_PLUS"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_FFEL_STAFFORD_SUB"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_FFEL_STAFFORD_UNSUB"].ToString() != "")
                || (dataTable1.Rows[0]["LOAN_FFEL_PLUS"].ToString() != "")
                || (dataTable1.Rows[0]["SCHOL_NB_SEOG"].ToString() == "X")
                || (dataTable1.Rows[0]["LOAN_STATE"].ToString() == "X")
                || (dataTable1.Rows[0]["SCHOL_NB_STATE"].ToString() == "X")
                || (dataTable1.Rows[0]["LOAN_INST"].ToString() == "X")
                || (dataTable1.Rows[0]["SCHOL_NB_INST"].ToString() == "X")
                || (dataTable1.Rows[0]["SCHOL_NB_PRIVATE"].ToString() == "X")
                || (dataTable1.Rows[0]["SCHOL_NB_UNCF"].ToString() == "X"))
                bFinancialAidType = true;

            dtAppReq = new DataTable();
            dtAppReq = CCLib.Cache.GetCachedDataTable("UGSchoolProfile_AppReq_" + INUN_ID, "UGSP_SelectApplReq " + INUN_ID);
            dtEntrExam = new DataTable();
            dtEntrExam = CCLib.Cache.GetCachedDataTable("UGSchoolProfile_EntrExam_" + INUN_ID, "UGSP_SelectEntrExam " + INUN_ID);
            dtPlaceExam = new DataTable();
            dtPlaceExam = CCLib.Cache.GetCachedDataTable("UGSchoolProfile_PlaceExam_" + INUN_ID, "UGSP_SelectPlaceExam " + INUN_ID);
            dtSport = new DataTable();
            dtSport = CCLib.Cache.GetCachedDataTable("UGSchoolProfile_Sports_" + INUN_ID, "UGSP_SelectSports " + INUN_ID);
            strTemp = "";
            dt1 = new DataTable();

            //dt1 = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable("GRSP_SelectAllMajor " + INUN_ID);
            //Should Use Cache, Please do not comment out the line below, it was in the worst query list. Don Xiong 02/03/2010

            dt1 = CCLib.Cache.GetCachedDataTable("GRSchoolProfile_MajorResults_" + INUN_ID, "GRSP_SelectAllMajor " + INUN_ID);
            //dvMajor=new DataView(dt1);//
            dvArea = new DataView(dt1);
            dvArea.Sort = "[1stLevel" + NonEngSuffixCode("US") + "]";
            string strArea = Request["area"];
            string strType = Request["type"];

            DataView view;

            if ((strArea != null) && (strArea != ""))
            {
                strTempFilter = strTempFilter + "[1stCode]='" + strArea + "' and ";
                dvMajor = new DataView(dt1);
                view = new DataView(dt1);
            }
            else//recreate new datatable to get rid of redundant rows
            {
                dt2 = dt1.Clone();
                for (int i = 0; i < dt1.Rows.Count; i++)
                {
                    if (i == 0 || (dt1.Rows[i]["DESCR"].ToString() != dt1.Rows[i - 1]["DESCR"].ToString()) || (dt1.Rows[i]["DESCR"].ToString() == dt1.Rows[i - 1]["DESCR"].ToString() && (dt1.Rows[i]["Non"].ToString() != dt1.Rows[i - 1]["Non"].ToString() || dt1.Rows[i]["BACH"].ToString() != dt1.Rows[i - 1]["BACH"].ToString() || dt1.Rows[i]["GRAD"].ToString() != dt1.Rows[i - 1]["GRAD"].ToString())))//just insert for the first one or if no duplicate
                        dt2.ImportRow(dt1.Rows[i]);
                }
                dvMajor = new DataView(dt2);
                view = new DataView(dt2);
            }

            if ((strType != null) && (strType != ""))
            {
                if (strType == "A")
                    strTempFilter = strTempFilter + "ASSOC='X' and ";
                if (strType == "B")
                    strTempFilter = strTempFilter + "BACH='X' and ";
                if (strType == "N")
                    strTempFilter = strTempFilter + "Non='X' and ";
                if (strType == "G")
                    strTempFilter = strTempFilter + "GRAD='X' and ";
            }

            if (strTempFilter.Length > 0) dvMajor.RowFilter = strTempFilter.Substring(0, strTempFilter.Length - 4);
            else dvMajor.RowFilter = "[1stCode] is not null";
            iRowCount = (int)CCLib.Cache.GetCachedValue("UGSchoolProfile_IsCTSchool_" + INUN_ID, "select count(INUN_ID) from VX_INST where INUN_ID=" + INUN_ID);
            bVT = (iRowCount > 0) ? true : false;

            view.RowFilter = "[1stCode] is not null";

            foreach (DataRowView myRow in view)
            {
                if ((myRow["ASSOC"].ToString() == "X") && (!bAssoc))
                    bAssoc = true;
                if ((myRow["BACH"].ToString() == "X") && (!bBach))
                    bBach = true;
                if ((myRow["Non"].ToString() == "X") && (!bNon))
                    bNon = true;
                if ((myRow["GRAD"].ToString() == "X") && (!bGRAD))
                    bGRAD = true;
            }

            foreach (DataRowView myRow in dvArea)
            {
                if ((myRow["ASSOC"].ToString() == "X") && (!bbAssoc))
                    bbAssoc = true;
                if ((myRow["BACH"].ToString() == "X") && (!bbBach))
                    bbBach = true;
                if ((myRow["Non"].ToString() == "X") && (!bbNon))
                    bbNon = true;
                if ((myRow["GRAD"].ToString() == "X") && (!bbGRAD))
                    bbGRAD = true;
            }

            foreach (DataRow myRow in dtSport.Rows)
            {
                if ((myRow["SCHOL_MEN"].ToString() != "") || (myRow["SCHOL_WMN"].ToString() != ""))
                {
                    bSportScholarships = true;
                    break;
                }
            }
            foreach (DataRow myRow in dtSport.Rows)
            {
                if ((myRow["INTC_MEN"].ToString() != "") || (myRow["INTC_WMN"].ToString() != ""))
                {
                    bInterSports = true;
                    break;
                }
            }
            foreach (DataRow myRow in dtSport.Rows)
            {
                if ((myRow["INTM_MEN"].ToString() != "") || (myRow["INTM_WMN"].ToString() != ""))
                {
                    bIntraSports = true;
                    break;
                }
            }
            if (CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_200_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_300_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_400_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_500_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_600_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_VERB_700_P"].ToString(), 50))
                strSATVerbal = "<td valign=bottom><img src=../media/shared/ugsp_sat_chart_left2.gif width=72 height=340 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%'></td>";
            else
                strSATVerbal = "<td><img src=../media/shared/ugsp_sat_chart_left.gif width=72 height=220 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%'></td>";
            if (CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_200_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_300_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_400_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_500_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_600_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_MATH_700_P"].ToString(), 50))
                strSATMath = "<td valign=bottom><img src=../media/shared/ugsp_sat_chart_left2.gif width=72 height=340 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%'></td>";
            else
                strSATMath = "<td><img src=../media/shared/ugsp_sat_chart_left.gif width=72 height=220 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%'></td>";

            if (CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_200_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_300_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_400_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_500_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_600_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["SAT1_Writing_700_P"].ToString(), 50))
                strSATWriting = "<td valign=bottom><img src=../media/shared/ugsp_sat_chart_left2.gif width=72 height=340 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%'></td>";
            else
                strSATWriting = "<td><img src=../media/shared/ugsp_sat_chart_left.gif width=72 height=220 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%'></td>";

            if (CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_1_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_2_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_3_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_4_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_5_P"].ToString(), 50)
                || CCLib.Common.Strings.StringBiggerInteger(dataTable1.Rows[0]["ACT_6_P"].ToString(), 50))
                strACT = "<td valign=bottom><img src=../media/shared/ugsp_sat_chart_left2.gif width=72 height=340 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%'></td>";
            else
                strACT = "<td><img src=../media/shared/ugsp_sat_chart_left.gif width=72 height=220 alt='Chart: 0%, 10%, 20%, 30%, 40%, 50%, 60%'></td>";
            if ((dataTable1.Rows[0]["instate_area_code"].ToString() != "") || (dataTable1.Rows[0]["outstate_area_code"].ToString() != "")
                || (dataTable1.Rows[0]["fax_area_code"].ToString() != "")
                || (dataTable1.Rows[0]["ap_recd_1st_n"].ToString() != "") || (dataTable1.Rows[0]["ap_admt_1st_n"].ToString() != "")
                || (dataTable1.Rows[0]["ad_open"].ToString() != "") || (dataTable1.Rows[0]["ad_open_T"].ToString() != "") || (dataTable1.Rows[0]["ad_pref"].ToString() != "") || (dataTable1.Rows[0]["ad_pref_t"].ToString() != "")
                || (dataTable1.Rows[0]["ad_open"].ToString() != "") || (dataTable1.Rows[0]["ad_open_T"].ToString() != "") || (dataTable1.Rows[0]["ad_pref"].ToString() != "") || (dataTable1.Rows[0]["ad_pref_t"].ToString() != "")
                || (dtAppReq.Rows.Count != 0) || (dtEntrExam.Rows.Count != 0) || (dtPlaceExam.Rows.Count != 0)
                || (dataTable1.Rows[0]["AP_electronic"].ToString() != "")
                )
                bShow2 = true;
            if ((dataTable1.Rows[0]["TUIT_AREA_FT_D"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_NRES_FT_D"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_INTL_FT_D"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_STATE_FT_D"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_OVERALL_FT_D"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_VARY_PROG"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_VARY_LOC"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_VARY_TIME"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_VARY_LOAD"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_VARY_COURSE_LVL"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_VARY_DEG"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_VARY_RECIPROCITY"].ToString() != "")
                || (dataTable1.Rows[0]["TUIT_VARY_STUD"].ToString() != "")
                || (dataTable1.Rows[0]["RM_BD_VARY_BD"].ToString() == "X")
                || (dataTable1.Rows[0]["RM_BD_VARY_LOC"].ToString() == "X")
                || (dataTable1.Rows[0]["RM_BD_VARY_GENDER"].ToString() == "X")
                || (dataTable1.Rows[0]["RM_BD_VARY_HOUS"].ToString() == "X")
                || (dataTable1.Rows[0]["TUIT_PLAN_GUAR"].ToString() == "Y")
                || (dataTable1.Rows[0]["TUIT_PLAN_PREPAY"].ToString() == "Y")
                || (dataTable1.Rows[0]["TUIT_PLAN_INSTALL"].ToString() == "X")
                || (dataTable1.Rows[0]["TUIT_PLAN_DEFER"].ToString() == "X"))
                bShow4 = true;
            if ((dataTable1.Rows[0]["certif"].ToString() == "X")
                || (dataTable1.Rows[0]["diploma"].ToString() == "X")
                || (dataTable1.Rows[0]["deg_assoc_tfer"].ToString() == "X")
                || (dataTable1.Rows[0]["deg_assoc_term"].ToString() == "X")
                || (dataTable1.Rows[0]["deg_bach"].ToString() != "")
                || (dataTable1.Rows[0]["certif_fp"].ToString() == "X")
                || (dataTable1.Rows[0]["deg_fp"].ToString() == "X")
                || (dataTable1.Rows[0]["deg_master"].ToString() != "")
                || (dataTable1.Rows[0]["certif_post_master"].ToString() == "X")
                || (dataTable1.Rows[0]["deg_Doctor"].ToString() != "")
                || (dataTable1.Rows[0]["award_t"].ToString() != "")
                || (dataTable1.Rows[0]["assoc_t"].ToString() != "") || (dataTable1.Rows[0]["bach_t"].ToString() != "")
                || (dataTable1.Rows[0]["acad_core"].ToString() == "Y") || (dataTable1.Rows[0]["LANG"].ToString() == "Y")
                || (dataTable1.Rows[0]["MATH_SCI"].ToString() == "Y") || (dataTable1.Rows[0]["CMPTR"].ToString() == "Y")
                || (dataTable1.Rows[0]["INTERN_ALL"].ToString() == "Y") || (dataTable1.Rows[0]["INTERN_SOME"].ToString() == "Y")
                || (dataTable1.Rows[0]["SR_PROJ_ALL"].ToString() == "Y") || (dataTable1.Rows[0]["SR_PROJ_SOME_MAJ"].ToString() == "Y")
                || (dataTable1.Rows[0]["SR_PROJ_SOME_HON"].ToString() == "Y"))
                bShow3 = true;
            if ((dataTable1.Rows[0]["EN_TOT_UG_N"].ToString() != "")
                || (dataTable1.Rows[0]["EN_GRAD_FT_MEN_N"].ToString() != "")
                || (dataTable1.Rows[0]["EN_GRAD_FT_WMN_N"].ToString() != "")
                || (dataTable1.Rows[0]["EN_GRAD_PT_MEN"].ToString() != "")
                || (dataTable1.Rows[0]["EN_GRAD_FT_WMN_N"].ToString() != "")
                || (dataTable1.Rows[0]["EN_TOT_FT_MEN_N"].ToString() != "")
                || (dataTable1.Rows[0]["EN_TOT_FT_WMN_N"].ToString() != "")
                || (dataTable1.Rows[0]["EN_TOT_PT_MEN_N"].ToString() != "")
                || (dataTable1.Rows[0]["EN_TOT_PT_WMN_N"].ToString() != "")
                || (dataTable1.Rows[0]["FRSH_HS_RANK_50_P"].ToString() != "")
                || (dataTable1.Rows[0]["FRSH_HS_RANK_25_P"].ToString() != "")
                || (dataTable1.Rows[0]["FRSH_HS_RANK_10_P"].ToString() != "")
                || (dataTable1.Rows[0]["FRSH_GPA"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_VERB_200_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_VERB_300_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_VERB_400_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_VERB_500_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_VERB_600_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_VERB_700_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_MATH_200_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_MATH_300_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_MATH_400_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_MATH_500_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_MATH_600_P"].ToString() != "")
                || (dataTable1.Rows[0]["SAT1_MATH_700_P"].ToString() != "")
                || (dataTable1.Rows[0]["ACT_1_P"].ToString() != "")
                || (dataTable1.Rows[0]["ACT_2_P"].ToString() != "")
                || (dataTable1.Rows[0]["ACT_3_P"].ToString() != "")
                || (dataTable1.Rows[0]["ACT_4_P"].ToString() != "")
                || (dataTable1.Rows[0]["ACT_5_P"].ToString() != "")
                || (dataTable1.Rows[0]["ACT_6_P"].ToString() != "")
                )
                bShow5 = true;
            if ((dataTable1.Rows[0]["lib_main_name"].ToString() != "")
                || (dataTable1.Rows[0]["lib_vol_n"].ToString() != "")
                || (dataTable1.Rows[0]["lib_serials_n"].ToString() != "")
                || (dataTable1.Rows[0]["lib_micro_n"].ToString() != "")
                || (dataTable1.Rows[0]["lib_av_n"].ToString() != "")
                || (dataTable1.Rows[0]["lib_vol_n"].ToString() != "")
                || (dataTable1.Rows[0]["cmptr_n"].ToString() != "")
                || (dataTable1.Rows[0]["www"].ToString() == "X")
                || (dataTable1.Rows[0]["lab"].ToString() == "Y")
                || (dataTable1.Rows[0]["net"].ToString() == "Y")
                || (dataTable1.Rows[0]["net_stud_rm"].ToString() == "Y")
                || (dataTable1.Rows[0]["NET_OFFCMPS"].ToString() == "Y")
                || (dataTable1.Rows[0]["career_counsel_indv"].ToString() != "")
                || (dataTable1.Rows[0]["career_counsel_grp"].ToString() != "")
                || (dataTable1.Rows[0]["career_place"].ToString() != "")
                || (dataTable1.Rows[0]["career_recruit"].ToString() != "")
                || (dataTable1.Rows[0]["career_job_bank"].ToString() == "X")
                || (dataTable1.Rows[0]["career_job_fairs"].ToString() == "X")
                || (dataTable1.Rows[0]["career_job_iview"].ToString() == "X")
                || (dataTable1.Rows[0]["career_lib"].ToString() == "X")
                || (dataTable1.Rows[0]["career_resume_prep"].ToString() == "X")
                || (dataTable1.Rows[0]["career_resume_refer"].ToString() == "X")
                || (dataTable1.Rows[0]["career_testing"].ToString() == "X")
                || (dataTable1.Rows[0]["career_iview_wrkshp"].ToString() == "X")
                || (dataTable1.Rows[0]["career_oth_t"].ToString() != "")
                || (dataTable1.Rows[0]["SRVC_LEGAL"].ToString() == "Y")
                || (dataTable1.Rows[0]["SRVC_HEALTH"].ToString() == "Y")
                || (dataTable1.Rows[0]["SRVC_PSYCH"].ToString() == "Y")
                || (dataTable1.Rows[0]["SRVC_WMN_CTR"].ToString() == "Y")
                )
                bShow6 = true;
            if (((dataTable1.Rows[0]["hous"].ToString() == "Y")
                && ((dataTable1.Rows[0]["hous_coed"].ToString() == "X")
                || (dataTable1.Rows[0]["hous_men"].ToString() == "X")
                || (dataTable1.Rows[0]["hous_wmn"].ToString() == "X")))
                || (dataTable1.Rows[0]["hous_req_yr"].ToString() != "")
                || (dataTable1.Rows[0]["life_frat_nat"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_frat_local"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_sor_nat"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_sor_local"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_chorus"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_drama"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_band"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_news"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_radio"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_television"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_pbk"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_sx"].ToString() == "Y")
                || (dataTable1.Rows[0]["life_org_1_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_org_2_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_org_3_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_org_4_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_org_5_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_event_1_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_event_2_t"].ToString() != "")
                || (dataTable1.Rows[0]["life_event_3_t"].ToString() != ""))
                bShow7 = true;
            if ((bSportScholarships)
                || (bIntraSports)
                || (bInterSports)
                || (dataTable1.Rows[0]["assn_athl_ncaa"].ToString() != "")
                || (dataTable1.Rows[0]["assn_athl_naia"].ToString() == "X")
                || (dataTable1.Rows[0]["assn_athl_nccaa"].ToString() == "X")
                || (dataTable1.Rows[0]["assn_athl_nscaa"].ToString() == "X")
                || (dataTable1.Rows[0]["assn_athl_njcaa"].ToString() == "X"))
                bShow8 = true;
        }
Example #45
0
        /// <summary>Gets formatted date particle string for this.isoDate, based on
        /// date format pattern token specified, and date format information object.
        ///
        /// Eg. for this.isoDate=2003/06/30, pattern=MMM, dateFormat={en-au}, result=Jun</summary>
        /// <param name="patternToken">Format pattern token</param>
        /// <returns>Formatted date particle string</returns>
        private string GetPatternReplacement(string patternToken, System.Globalization.DateTimeFormatInfo dateFormat)
        {
            switch (patternToken[0])
            {
            // Year tokens
            case 'y':
                switch (patternToken)
                {
                case "yyyy": return(this.isoDate.Year.ToString());

                case "yy":
                    int year = this.isoDate.Year % 100;
                    return(year > 9 ? year.ToString() : "0" + year);

                case "y": return((this.isoDate.Year % 100).ToString());

                default: throw new NotSupportedException("Format pattern token '" + patternToken +
                                                         "' not supported for DvDateTime formatted ToString.");
                }

            // Month tokens
            case 'M':
                switch (patternToken)
                {
                case "MMMM": return(dateFormat.MonthNames[this.isoDate.Month - 1]);

                case "MMM": return(dateFormat.AbbreviatedMonthNames[this.isoDate.Month - 1]);

                case "MM":
                    int month = this.isoDate.Month;
                    return(month > 9 ? month.ToString() : "0" + month);

                case "M": return(this.isoDate.Month.ToString());

                default: throw new NotSupportedException("Format pattern token '" + patternToken +
                                                         "' not supported for DvDateTime formatted ToString.");
                }

            // Day tokens
            case 'd':
                switch (patternToken)
                {
                case "dddd":
                    System.DateTime timeDDDD = new System.DateTime(this.isoDate.Year,
                                                                   this.isoDate.Month, this.isoDate.Day);
                    return(dateFormat.DayNames[(int)dateFormat.Calendar.GetDayOfWeek(timeDDDD)]);

                case "ddd":
                    System.DateTime timeDDD = new System.DateTime(this.isoDate.Year,
                                                                  this.isoDate.Month, this.isoDate.Day);
                    return(dateFormat.AbbreviatedDayNames[(int)dateFormat.Calendar.GetDayOfWeek(timeDDD)]);

                case "dd":
                    int day = this.isoDate.Day;
                    return(day > 9 ? day.ToString() : "0" + day);

                case "d": return(this.isoDate.Day.ToString());

                default: throw new NotSupportedException("Format pattern token '" + patternToken +
                                                         "' not supported for DvDateTime formatted ToString.");
                }

            // Cover every other kind of token
            default:
                switch (patternToken)
                {
                // Symbols tokens, misc
                case "/": return(dateFormat.DateSeparator);

                case "gg":
                    throw new NotSupportedException(
                              "Format pattern token 'gg' is explicitly not supported for DvDateTime formatted ToString.");

                default:
                    throw new NotSupportedException("Format pattern token '" + patternToken +
                                                    "' not supported for DvDateTime formatted ToString.");
                }     //end inner (default) switch
            } // end outer switch
        }
Example #46
0
        //=================================================================================================
        private int folder_action_do()
        {
            // check source path
            string lsFilePathS = moSource.msBase + moSource.msPath ;            
            if( ! Directory.Exists( lsFilePathS ) )
            {
                return (int) cMsg.MsgNo.ERROR_FILE_SOURCE_PATH_NOT_EXIST ;
            }

            // check destination path when action type is copy, move, copy_rename
            string lsFilePathD = moDestination.msBase + moDestination.msPath ;           
            if( ( moAction.miType == cAction.Type.COPY 
                || moAction.miType == cAction.Type.COPY_RENAME
                || moAction.miType == cAction.Type.MOVE
                ) 
                &&
                ( ! Directory.Exists( lsFilePathD ) )
                )
            {
                return (int) cMsg.MsgNo.ERROR_FOLDER_DESTINATION_PATH_NOT_EXIST ;
            }
            
            // prepare datum
            DateTime loNow = new DateTime() ;
            DateTime loDatum = new DateTime() ;
            loNow = DateTime.Now ;
            int liValue = System.Convert.ToInt32( moCondition.msValue ) ;
            switch( moCondition.msUnit.ToUpper() )
            {
                case "YEAR" :
                    loDatum = loNow.AddYears( (-1)*liValue ) ;
                    break ;
                case "MONTH" :
                    loDatum = loNow.AddMonths( (-1)*liValue ) ;
                    break ;
                case "DAY" :
                    loDatum = loNow.AddDays( (-1)*liValue ) ;
                    break ;
                case "HOUR" :
                    loDatum = loNow.AddHours( (-1)*liValue ) ;
                    break ;
                case "MINUTE" :
                    loDatum = loNow.AddMinutes( (-1)*liValue ) ;
                    break ;
                case "SECOND" :
                    loDatum = loNow.AddSeconds( (-1)*liValue ) ;
                    break ;
                default :
                    break ;
            }

            // prepare regular expression
            System.Text.RegularExpressions.Regex loReg ;
            System.Text.RegularExpressions.Match loMatch ;
            System.Globalization.DateTimeFormatInfo loDateTimeFormat = new  System.Globalization.DateTimeFormatInfo( ) ;
            if( moCondition.msField == "FILENAME" )
            {
                try{ loReg = new System.Text.RegularExpressions.Regex( moCondition.msRegular ) ; }
                catch( Exception e ){ return (int) cMsg.MsgNo.ERROR_FOLDER_NAMES_REGULAR_EXPRESSION_WRONG ; }
            }            

            // prepare all folder name
            string[] lsaFileNames ;
            if( moSource.msExt == "" )
            {
                lsaFileNames = Directory.GetDirectories( lsFilePathS ) ;
            }
            else
            {
                lsaFileNames = Directory.GetDirectories( lsFilePathS , moSource.msExt ) ;
            }
            
            // process every item
            for( int i=0 ; i < lsaFileNames.Length ; i++ )
            {
                // prepare fileTime
                DirectoryInfo loFileInfo = new DirectoryInfo( lsaFileNames[i] ) ;
                DateTime loFileTime = new DateTime() ;
                string lsFileTime ;
                switch( moCondition.msField )
                {
                    case "WRITE_TIME" :
                        loFileTime = loFileInfo.LastWriteTime ;
                        break ;
                    case "FILENAME" :
                        // get datetime string
                        loReg = new System.Text.RegularExpressions.Regex( moCondition.msRegular ) ;
                        loMatch = loReg.Match( loFileInfo.Name ) ;
                        if( loMatch.Success )
                        {
                            lsFileTime = loMatch.ToString() ;
                        }
                        else
                        {
                            continue ;
                        }
                        // datetime string to datetime
                        loReg = new System.Text.RegularExpressions.Regex( "[^0-9]{1,}" );
                        loMatch = loReg.Match( lsFileTime ) ;
                        if( loMatch.Success )
                        {
                            try
                            { 
                                loFileTime = DateTime.Parse( lsFileTime ) ;
                            }
                            catch( Exception e )
                            {
                                continue ;                          
                            }
                        }
                        else
                        {
                            try
                            {
                                if( ! cDatetime.to_datetime( lsFileTime , moCondition.msFormat , out loFileTime ) )
                                {
                                    continue ; 
                                }                            
                            }
                            catch( Exception e )
                            {
                                continue ;
                            }
                        }
                        break ;
                    default :
                        break ;                
                }
  
                // compare datum and fileTime
                bool lbCompareResult = false ;
                switch( moCondition.msCompare )
                {
                    case ">" :
                        lbCompareResult = ( loDatum > loFileTime ) ;
                        break ;
                    case ">=" :
                        lbCompareResult = ( loDatum >= loFileTime ) ;
                        break ;
                    case "<" :
                        lbCompareResult = ( loDatum < loFileTime ) ;
                        break ;
                    case "<=" :
                        lbCompareResult = ( loDatum <= loFileTime ) ;
                        break ;
                    default :
                        break ;
                }								

                // do action
                string lsNewName = "";
                if( lbCompareResult )
                {                    
                    switch( moAction.miType )
                    {
                        case cAction.Type.COPY :                       
                            cFile.copy_directory( loFileInfo.FullName , lsFilePathD + @"\" + loFileInfo.Name ) ;
                            break ;
                        case cAction.Type.DELETE :
                            System.IO.Directory.Delete( loFileInfo.FullName ,true) ;
                            break ;
                        case cAction.Type.RENAME :
                            lsNewName = lsFilePathS + @"\" + moDestination.msNewName.Replace( "{FILENAME}" , loFileInfo.Name ) ;
                            System.IO.Directory.Move( loFileInfo.FullName , lsNewName ) ;
                            break ;
                        case cAction.Type.MOVE :
                            lsNewName = lsFilePathD + @"\" + loFileInfo.Name ;
                            System.IO.Directory.Move( loFileInfo.FullName , lsNewName ) ;
                            break ;
                        case cAction.Type.COPY_RENAME :
                            // copy 
                            cFile.copy_directory( loFileInfo.FullName , lsFilePathD + @"\" + loFileInfo.Name ) ;
                            // rename
                            lsNewName = lsFilePathS + @"\" + moDestination.msNewName.Replace( "{FILENAME}" , loFileInfo.Name ) ;
                            System.IO.Directory.Move( loFileInfo.FullName , lsNewName ) ;
                            break ;
                        default :
                            break ;
                    }
                }                
            }
 
            return (int) cMsg.MsgNo.SUCCESS ;
        }
Example #47
0
        private void btnNextDinner_Click(object sender, EventArgs e)
        {
            List <int> users = new List <int>();

            for (int i = 0; i < ds.Tables["user"].Rows.Count; i++)
            {
                if (Convert.ToBoolean(ds.Tables["user"].Rows[i]["Active"]))
                {
                    users.Add(i);
                }
            }
            int        numUsers   = users.Count;
            int        numDinners = (numUsers + 2) / 4;
            int        currentDinner;
            bool       isSorted;
            List <int> remaining = new List <int>();

            int[,] hostedCountSorted, currDinnerGridTally = new int[2, numUsers];
            int[,] dinners = new int[numDinners, 5];
            string date = "";

            for (int i = 0; i < dinners.GetLength(0); i++)
            {
                for (int j = 0; j < dinners.GetLength(1); j++)
                {
                    dinners[i, j] = -1;
                }
            }

            int to, from, temp1, temp2;

            //get date
            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
            date = mfi.GetAbbreviatedMonthName(dateTimePicker1.Value.Month) + " " + dateTimePicker1.Value.Year;

            hostedCountSorted = new int[2, numUsers];
            for (int i = 0; i < numUsers; i++)
            {
                hostedCountSorted[0, i] = users[i];
                hostedCountSorted[1, i] = Convert.ToInt16(ds.Tables["user"].Rows[users[i]]["Host#"].ToString()) + 1;
            }

            //host month/active exceptions
            int dateMonth = dateTimePicker1.Value.Month;
            int userMonth;

            for (int i = 0; i < numUsers; i++)
            {
                userMonth = Convert.ToInt16(ds.Tables["user"].Rows[users[i]]["Month"]);
                if (userMonth == dateMonth)
                {
                    hostedCountSorted[1, users[i]] = 0;
                }
                else if (userMonth != 0)
                {
                    hostedCountSorted[1, users[i]] = Int16.MaxValue;
                }
            }

            //randomize
            Random rnd = new Random();

            for (int i = 0; i < numUsers * 2; i++)
            {
                to    = rnd.Next(0, hostedCountSorted.GetLength(1));
                from  = rnd.Next(0, hostedCountSorted.GetLength(1));
                temp1 = hostedCountSorted[0, to];
                temp2 = hostedCountSorted[1, to];
                hostedCountSorted[0, to]   = hostedCountSorted[0, from];
                hostedCountSorted[1, to]   = hostedCountSorted[1, from];
                hostedCountSorted[0, from] = temp1;
                hostedCountSorted[1, from] = temp2;
            }

            //sort
            do
            {
                isSorted = true;
                for (int i = 0; i < hostedCountSorted.GetLength(1) - 1; i++)
                {
                    if (hostedCountSorted[1, i] > hostedCountSorted[1, i + 1])
                    {
                        //swap hosted values
                        temp1 = hostedCountSorted[1, i];
                        hostedCountSorted[1, i]     = hostedCountSorted[1, i + 1];
                        hostedCountSorted[1, i + 1] = temp1;
                        //swap id
                        temp1 = hostedCountSorted[0, i];
                        hostedCountSorted[0, i]     = hostedCountSorted[0, i + 1];
                        hostedCountSorted[0, i + 1] = temp1;
                        isSorted = false;
                    }
                }
            } while (!isSorted);

            //choose the lowest x hosts, where x is the number of dinners
            for (int i = 0; i < numDinners; i++)
            {
                //update number of times user has hosted
                ds.Tables["user"].Rows[hostedCountSorted[0, i]]["Host#"] = Convert.ToInt16(ds.Tables["user"].Rows[hostedCountSorted[0, i]]["Host#"].ToString()) + 1;

                //add host id to dinner array
                dinners[i, 0] = hostedCountSorted[0, i];
            }

            //list of ids
            remaining = users;             //(basically name change)

            //remove hosts from grid copy
            for (int i = 0; i < dinners.GetLength(0); i++)
            {
                remaining.Remove(dinners[i, 0]);
            }

            //for each person left, find them a group
            currentDinner = 0;
            while (remaining.Count > 0)
            {
                //get grid tally for all users according to people in current group
                currDinnerGridTally = new int[2, remaining.Count];
                for (int i = 0; i < dinners.GetLength(1); i++)
                {
                    if (dinners[currentDinner, i] == -1)
                    {
                        break;
                    }
                    for (int j = 0; j < remaining.Count; j++)
                    {
                        currDinnerGridTally[0, j]  = remaining[j];
                        currDinnerGridTally[1, j] += Convert.ToInt16(ds.Tables["matchCount"].Rows[dinners[currentDinner, i]][remaining[j]]);
                    }
                }

                //randomize
                for (int i = 0; i < currDinnerGridTally.GetLength(1) * 2; i++)
                {
                    to    = rnd.Next(0, currDinnerGridTally.GetLength(1));
                    from  = rnd.Next(0, currDinnerGridTally.GetLength(1));
                    temp1 = currDinnerGridTally[0, to];
                    temp2 = currDinnerGridTally[1, to];
                    currDinnerGridTally[0, to]   = currDinnerGridTally[0, from];
                    currDinnerGridTally[1, to]   = currDinnerGridTally[1, from];
                    currDinnerGridTally[0, from] = temp1;
                    currDinnerGridTally[1, from] = temp2;
                }

                //sort
                do
                {
                    isSorted = true;
                    for (int i = 0; i < currDinnerGridTally.GetLength(1) - 1; i++)
                    {
                        if (currDinnerGridTally[1, i] > currDinnerGridTally[1, i + 1])
                        {
                            //swap hosted values
                            temp1 = currDinnerGridTally[1, i];
                            currDinnerGridTally[1, i]     = currDinnerGridTally[1, i + 1];
                            currDinnerGridTally[1, i + 1] = temp1;
                            //swap id
                            temp1 = currDinnerGridTally[0, i];
                            currDinnerGridTally[0, i]     = currDinnerGridTally[0, i + 1];
                            currDinnerGridTally[0, i + 1] = temp1;
                            isSorted = false;
                        }
                    }
                } while (!isSorted);

                //find available spot (indicated by -1) and put new member in
                for (int k = 1; k < dinners.GetLength(1); k++)
                {
                    if (dinners[currentDinner, k] == -1)
                    {
                        dinners[currentDinner, k] = currDinnerGridTally[0, 0];

                        break;
                    }
                }
                remaining.Remove(currDinnerGridTally[0, 0]);

                currentDinner = (currentDinner + 1) % numDinners;
            }

            //increase matched (grid) count
            //loop through dinners
            for (int i = 0; i < dinners.GetLength(0); i++)
            {
                for (int j = 0; j < dinners.GetLength(1); j++)
                {
                    for (int k = 0; k < dinners.GetLength(1); k++)
                    {
                        if (!(j == k || dinners[i, j] == -1 || dinners[i, k] == -1))
                        {
                            ds.Tables["matchCount"].Rows[dinners[i, j]][dinners[i, k]] = Convert.ToInt16(ds.Tables["matchCount"].Rows[dinners[i, j]][dinners[i, k]]) + 1;
                        }
                    }
                }
            }

            history.Add(dinners);
            historyDate.Add(date);
            if (lsbDinnerSelect.Items[0].ToString().Equals("<empty>"))
            {
                lsbDinnerSelect.Items.Clear();
            }
            lsbDinnerSelect.Items.Add(date);

            UpdateCellColors();
        }
 // --Commented out by Inspection START (11/21/05 12:42 PM):
 //   /**
 //    * Get the byte lengthOfSection of this numberOfSection.
 //    *
 //    * @return lengthOfSection in bytes of this numberOfSection
 //    */
 //   public final int getLength()
 //   {
 //      return lengthOfSection;
 //   }
 // --Commented out by Inspection STOP (11/21/05 12:42 PM)
 // --Commented out by Inspection START (11/21/05 12:42 PM):
 //   /**
 //    * Number of this numberOfSection, should be 1
 //    */
 //   public final int getSection()
 //   {
 //      return numberOfSection;
 //   }
 // --Commented out by Inspection STOP (11/21/05 12:42 PM)
 static Grib2IdentificationSection()
 {
     {
         //UPGRADE_ISSUE: Constructor 'java.text.SimpleDateFormat.SimpleDateFormat' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javatextSimpleDateFormat'"
         dateFormat = new System.Globalization.DateTimeFormatInfo();
     }
 }
Example #49
0
        /// <summary>
        /// 期間定義文字列から開始・終了日時を取得します。
        /// </summary>
        /// <param name="terms">期間定義文字列</param>
        /// <param name="year">対象年</param>
        /// <returns>DateTime型配列 / [0]: 開始日時, [1]: 終了日時, [2]: MinValue(日付指定) / MaxValue(相対指定)</returns>
        public static DateTime[] FromTerm(string terms, int year)
        {
            var dt = new DateTime[3];

            if (terms == "<Empty>")
            {
                return(dt);
            }

            var daterm    = @"^(\d\d)/(\d\d)/(\d\d)-(\d\d):(\d\d) (\d{1,3})(Ds|Hs|Ms)$";
            var targeterm = @"^@\[(\s?[A-Za-z0-9]+)*\]-(\d\d):(\d\d) (\d{1,3})(Ds|Hs|Ms)$";

            try {
                if (Regex.IsMatch(terms, daterm))
                {
                    var m = Regex.Match(terms, daterm);
                    dt[0] = new DateTime(
                        int.Parse(m.Groups[1].ToString()) + 2_000, int.Parse(m.Groups[2].ToString()), int.Parse(m.Groups[3].ToString()),
                        int.Parse(m.Groups[4].ToString()), int.Parse(m.Groups[5].ToString()), 0
                        );

                    var timeVal = int.Parse(m.Groups[6].ToString());
                    switch (m.Groups[7].ToString())
                    {
                    case "Ds":
                        dt[1] = dt[0].AddDays(timeVal);
                        break;

                    case "Hs":
                        dt[1] = dt[0].AddHours(timeVal);
                        break;

                    case "Ms":
                        dt[1] = dt[0].AddMinutes(timeVal);
                        break;

                    default:
                        return(null);
                    }
                    dt[2] = DateTime.MinValue;

                    return(dt);
                }
                else if (Regex.IsMatch(terms, targeterm))
                {
                    var m          = Regex.Match(terms, targeterm);
                    var target     = m.Groups[1].Captures.Cast <Capture>().Select(x => x.ToString().Trim()).ToArray();
                    var timeVal    = int.Parse(m.Groups[4].ToString());
                    var weekNumber = int.TryParse(target[0], out int res) ? res : 5;
                    var weekDay    = new System.Globalization.DateTimeFormatInfo().DayNames.ToList()
                                     .FindIndex(x => x == target[1]);
                    var monthNumber = new System.Globalization.DateTimeFormatInfo().MonthNames.ToList()
                                      .FindIndex(x => x == target[2]);

                    if (weekDay == -1 || monthNumber == -1)
                    {
                        return(null);
                    }

                    dt[0] = FromWeekNumber(year, monthNumber + 1, weekNumber, (DayOfWeek)weekDay);
                    dt[0] = dt[0].AddHours(int.Parse(m.Groups[2].ToString())).AddMinutes(int.Parse(m.Groups[3].ToString()));

                    switch (m.Groups[5].ToString())
                    {
                    case "Ds":
                        dt[1] = dt[0].AddDays(timeVal);
                        break;

                    case "Hs":
                        dt[1] = dt[0].AddHours(timeVal);
                        break;

                    case "Ms":
                        dt[1] = dt[0].AddMinutes(timeVal);
                        break;

                    default:
                        return(null);
                    }
                    dt[2] = DateTime.MaxValue;

                    return(dt);
                }
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }

            return(null);
        }
        ///<summary>
        /// This method creates a customer with the same details of a self exclusion customer
        /// <example>RegisterCustomer_selfExclusion(portalbrowser, adminbrowser) </example>
        public void RegisterCustomer_selfExclusion(ISelenium browser, ISelenium adminBrowser)
        {
            try
            {
                string regMsg, gender, xPath;
                var admincommonObj = new AdminSuite.Common();
                Random rnd = new Random();
                int rndNumber = rnd.Next(10000);

                //get details of customer in OB
                adminBrowser.WindowFocus();
                string username = "******" + rndNumber;
                admincommonObj.SelectMainFrame(adminBrowser);
                string firstname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'First Name:')]/following-sibling::td");
                string lastname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Last Name:')]/following-sibling::td");
                string title = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Title:')]/following-sibling::td");
                if (title.ToLower() == "mr")
                {
                    gender = "male";
                }
                else
                {
                    gender = "female";
                }

                string dob = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Date of Birth:')]/following-sibling::td");
                string[] arr = dob.Split('-');
                string DOByear = arr[0];
                System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
                string DOBmonth = mfi.GetMonthName(int.Parse(arr[1])).ToString();
                string DOBday = arr[2];

                string houseno = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Address (1)')]/following-sibling::td");
                string postcode = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Postcode:')]/following-sibling::td");

                string address1 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(2)')]/following-sibling::td") + adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td");
                string address2 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td");
                string city = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'City:')]/following-sibling::td");
                string email = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Email:')]/following-sibling::td");
                string teleCode = "+44";
                string telnumber = "1234567890";
                string mobnumber = "1234512345";

                string password = "******";
                string confirmPassword = "******";
                string securityQuestion = "Favourite Colour";
                string securityAnswer = "Blue";

                string accountCurrency = "UK Pound Sterling";
                string country = "United Kingdom";

                browser.WindowFocus();
                WaitForLoadingIcon_MobileLobby(browser, FrameGlobals.IconLoadTimeout);
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed");

                //Enter data in all the fields
                browser.Type(MobileLobbyControls.promocode, "");
                browser.Select(MobileLobbyControls.title, title);
                browser.Type(MobileLobbyControls.firstname, firstname);
                browser.Type(MobileLobbyControls.lastname, lastname);
                //gender
                if (gender.ToLower().Trim() == "male")
                {
                    browser.Click(MobileLobbyControls.genderMale);
                }
                else
                {
                    browser.Click(MobileLobbyControls.genderFemale);
                }

                browser.Select(MobileLobbyControls.DOBday, DOBday);
                browser.Select(MobileLobbyControls.DOBmonth, DOBmonth);
                browser.Select(MobileLobbyControls.DOByear, DOByear);
                browser.Select(MobileLobbyControls.country, country);

                browser.Type(MobileLobbyControls.housename, houseno);
                browser.Type(MobileLobbyControls.postcode, postcode);
                browser.Type(MobileLobbyControls.address1, address1);
                browser.Type(MobileLobbyControls.address2, address2);
                browser.Type(MobileLobbyControls.city, city);
                browser.Type(MobileLobbyControls.email, email);

                browser.Type(MobileLobbyControls.telintcode, teleCode);
                browser.Type(MobileLobbyControls.telnumber, telnumber);
                browser.Type(MobileLobbyControls.mobintcode, teleCode);
                browser.Type(MobileLobbyControls.mobnumber, mobnumber);
                browser.Select(MobileLobbyControls.accountCurrency, accountCurrency);

                browser.Type(MobileLobbyControls.username, username);
                browser.Type(MobileLobbyControls.password, password);
                browser.Type(MobileLobbyControls.confirmPassword, confirmPassword);
                browser.Select(MobileLobbyControls.securityQuestion, securityQuestion);
                browser.Type(MobileLobbyControls.securityAnswer, securityAnswer);
                MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.contactMe, "on");
                MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.aggreement, "on");
                Thread.Sleep(1000);

                //Validate registration
                clickObject_MobileLobby(browser, MobileLobbyControls.registerNow);
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration page title was not found in the header after registration");
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.failureRgMsg), "Registration failure message was not displayed");

                regMsg = "We are sorry but your country of residence is currently prohibited from using the Ladbrokes service.";
                xPath = "//ul[@class='error_align']/li[contains(text()[2], '" + regMsg + "')]";
                Assert.IsTrue(browser.IsElementPresent(xPath), "Registration failure message was not displayed to the user");
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.contactMessage), "Customer contact message was not displayed on failing to create a  customer from banned country");
                Console.WriteLine("Customer was not registered as his details provided matched a self excluded customer");
            }
            catch (Exception ex)
            {
                CaptureScreenshot(browser, "EnterRegisterDetails");
                Console.WriteLine("Function 'EnterRegisterDetails' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
		public CrateDB()
		{
			System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
			dtfi = culture.DateTimeFormat;
		}
 /// <summary>
 /// Weeks the of year.
 /// </summary>
 /// <param name="datetime">The datetime.</param>
 /// <param name="firstDayOfWeek">The first day of week.</param>
 /// <returns></returns>
 public static int WeekOfYear(this DateTime datetime, DayOfWeek firstDayOfWeek)
 {
     System.Globalization.DateTimeFormatInfo dateinf  = new System.Globalization.DateTimeFormatInfo();
     System.Globalization.CalendarWeekRule   weekrule = dateinf.CalendarWeekRule;
     return(WeekOfYear(datetime, weekrule, firstDayOfWeek));
 }
Example #53
0
        public ActionResult Index()
        {
            ViewBag.Message = Session["msg"];
            ViewBag.Error   = Session["err"];
            Session["err"]  = "";
            Session["msg"]  = "";

            int companyacademicyearid = Convert.ToInt16(Session["CompanyAcademicYearID"].ToString());
            int roleid   = Convert.ToInt16(Session["RoleID"].ToString());
            int userid   = Convert.ToInt16(Session["UserID"].ToString());
            int schoolid = Convert.ToInt16(Session["SchoolID"].ToString());

            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();

            int classid = 0;

            if (Request.QueryString["class"] != null)
            {
                try
                {
                    classid = Convert.ToInt16(Request.QueryString["class"]);
                }
                catch { }
            }
            int sectionid = 0;

            if (Request.QueryString["section"] != null)
            {
                try
                {
                    sectionid = Convert.ToInt16(Request.QueryString["section"]);
                }
                catch { }
            }
            DateTime dte          = Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day);
            DateTime dteyearstart = Convert.ToDateTime(DateTime.Now.Year + "-01-01");

            if (Request.QueryString["date"] != null)
            {
                try
                {
                    dte = Convert.ToDateTime(Request.QueryString["date"]);
                    dte = Convert.ToDateTime(dte.Year + "-" + dte.Month + "-" + dte.Day);
                }
                catch { }
            }

            List <StudentAttendanceModel> studentAttendancemodelList = new List <StudentAttendanceModel>();

            Calendar calendar = db.Calendars.Where(c => c.Date == dte).FirstOrDefault();

            if (calendar.IsHoliday)
            {
                ViewBag.Error = "  Selected date : " + dte.Day + " - " + mfi.GetMonthName(dte.Month).Substring(0, 3) + " - " + dte.Year + " is HOLIDAY : " + calendar.Description;
                calendar      = db.Calendars.Where(c => c.Date <= dte && c.IsHoliday == false).OrderByDescending(c => c.Date).FirstOrDefault();
                dte           = calendar.Date;
                dte           = Convert.ToDateTime(dte.Year + "-" + dte.Month + "-" + dte.Day);
            }
            int workingdays = db.Calendars.Where(c => c.Date <= dte && c.Date >= dteyearstart && c.IsHoliday == false).Count();

            foreach (Student student in db.Students.ToList())
            {
                StudentAttendance isStudentAdded = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate == calendar.Date).FirstOrDefault();
                if (isStudentAdded == null)
                {
                    StudentAttendance studentAttendancenew = new StudentAttendance();
                    studentAttendancenew.AttendanceTypeID = 2;
                    studentAttendancenew.AttendanceDate   = calendar.Date;
                    studentAttendancenew.StudentID        = student.StudentID;
                    studentAttendancenew.IdCard           = student.IdCard;
                    studentAttendancenew.UserID           = userid;
                    studentAttendancenew.UpdatedDate      = DateTime.Now;
                    studentAttendancenew.Percentage       = 0;
                    db.StudentAttendances.Add(studentAttendancenew);
                    db.SaveChanges();
                }
                else
                {
                    StudentAttendance studentAttendanceexist = db.StudentAttendances.Find(isStudentAdded.StudentAttendanceID);
                    int     attendeddays = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate <= calendar.Date && s.AttendanceTypeID == 1).Count();
                    double  perc         = Convert.ToInt16(attendeddays) * 100 / Convert.ToInt16(workingdays);
                    decimal perc1        = Convert.ToDecimal(string.Format("{0:0.00}", perc));
                    studentAttendanceexist.Percentage      = perc1;
                    db.Entry(studentAttendanceexist).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }

            var studentAttendance = db.StudentAttendances.Include(s => s.CurrentAttendanceType).Include(s => s.CurrentStudent).Include(s => s.CurrentStudent.CurrentSchool).Include(s => s.CurrentStudent.CurrentClass).Include(s => s.CurrentStudent.CurrentSection).Include(s => s.CurrentUser).Where(s => s.AttendanceDate == calendar.Date && s.CurrentStudent.CurrentSchool.SchoolID == schoolid && s.CurrentStudent.CurrentClass.ClassID == classid && s.CurrentStudent.CurrentSection.SectionID == sectionid).OrderBy(t => t.CurrentStudent.Name).ToList();

            foreach (StudentAttendance ta in studentAttendance)
            {
                StudentAttendanceModel studentAttendancemodel = new StudentAttendanceModel();
                studentAttendancemodel.StudentAttendanceID = ta.StudentAttendanceID;
                studentAttendancemodel.StudentID           = ta.StudentID;
                studentAttendancemodel.ClassID             = ta.CurrentStudent.CurrentClass.ClassID;
                studentAttendancemodel.SectionID           = ta.CurrentStudent.CurrentSection.SectionID;
                studentAttendancemodel.Class            = ta.CurrentStudent.CurrentClass.Name;
                studentAttendancemodel.Section          = ta.CurrentStudent.CurrentSection.Name;
                studentAttendancemodel.IdCard           = ta.IdCard;
                studentAttendancemodel.StudentName      = ta.CurrentStudent.Name;
                studentAttendancemodel.AttendanceTypeID = ta.AttendanceTypeID;
                studentAttendancemodel.BackDay1         = "";
                studentAttendancemodel.BackDay2         = "";
                studentAttendancemodel.BackDay3         = "";
                studentAttendancemodel.BackDay4         = "";
                studentAttendancemodel.BackDay5         = "";
                studentAttendancemodel.BackDay6         = "";
                studentAttendancemodel.Percentage       = ta.Percentage;
                studentAttendancemodelList.Add(studentAttendancemodel);
            }
            ViewBag.SelectedDate = calendar.Date.Day + " " + mfi.GetMonthName(calendar.Date.Month).Substring(0, 3) + " " + calendar.Date.Year;

            dte      = calendar.Date.AddDays(-1);
            calendar = db.Calendars.Where(c => c.Date <= dte && c.IsHoliday == false).OrderByDescending(c => c.Date).FirstOrDefault();
            foreach (Student student in db.Students.ToList())
            {
                StudentAttendance isStudentAdded = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate == calendar.Date).FirstOrDefault();
                if (isStudentAdded == null)
                {
                    StudentAttendance studentAttendancenew = new StudentAttendance();
                    studentAttendancenew.AttendanceTypeID = 2;
                    studentAttendancenew.AttendanceDate   = calendar.Date;
                    studentAttendancenew.StudentID        = student.StudentID;
                    studentAttendancenew.IdCard           = student.IdCard;
                    studentAttendancenew.UserID           = userid;
                    studentAttendancenew.UpdatedDate      = DateTime.Now;
                    studentAttendancenew.Percentage       = 0;
                    db.StudentAttendances.Add(studentAttendancenew);
                    db.SaveChanges();
                }
                else
                {
                    StudentAttendance studentAttendanceexist = db.StudentAttendances.Find(isStudentAdded.StudentAttendanceID);
                    int     attendeddays = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate <= calendar.Date && s.AttendanceTypeID == 1).Count();
                    double  perc         = Convert.ToInt16(attendeddays) * 100 / Convert.ToInt16(workingdays);
                    decimal perc1        = Convert.ToDecimal(string.Format("{0:0.00}", perc));
                    studentAttendanceexist.Percentage      = perc1;
                    db.Entry(studentAttendanceexist).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            studentAttendance = db.StudentAttendances.Include(s => s.CurrentAttendanceType).Include(s => s.CurrentStudent).Include(s => s.CurrentStudent.CurrentSchool).Include(s => s.CurrentStudent.CurrentClass).Include(s => s.CurrentStudent.CurrentSection).Include(s => s.CurrentUser).Where(s => s.AttendanceDate == calendar.Date && s.CurrentStudent.CurrentSchool.SchoolID == schoolid && s.CurrentStudent.CurrentClass.ClassID == classid && s.CurrentStudent.CurrentSection.SectionID == sectionid).OrderBy(t => t.CurrentStudent.Name).ToList();
            foreach (StudentAttendance ta in studentAttendance)
            {
                StudentAttendanceModel studentattendanceid = studentAttendancemodelList.Find(item => item.StudentID == ta.StudentID);
                studentattendanceid.BackDay1 = ta.CurrentAttendanceType.Name;
            }
            ViewBag.BackDay1 = calendar.Date.Day + " " + mfi.GetMonthName(calendar.Date.Month).Substring(0, 3);


            dte      = calendar.Date.AddDays(-1);
            calendar = db.Calendars.Where(c => c.Date <= dte && c.IsHoliday == false).OrderByDescending(c => c.Date).FirstOrDefault();
            foreach (Student student in db.Students.ToList())
            {
                StudentAttendance isStudentAdded = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate == calendar.Date).FirstOrDefault();
                if (isStudentAdded == null)
                {
                    StudentAttendance studentAttendancenew = new StudentAttendance();
                    studentAttendancenew.AttendanceTypeID = 2;
                    studentAttendancenew.AttendanceDate   = calendar.Date;
                    studentAttendancenew.StudentID        = student.StudentID;
                    studentAttendancenew.IdCard           = student.IdCard;
                    studentAttendancenew.UserID           = userid;
                    studentAttendancenew.UpdatedDate      = DateTime.Now;
                    studentAttendancenew.Percentage       = 0;
                    db.StudentAttendances.Add(studentAttendancenew);
                    db.SaveChanges();
                }
                else
                {
                    StudentAttendance studentAttendanceexist = db.StudentAttendances.Find(isStudentAdded.StudentAttendanceID);
                    int     attendeddays = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate <= calendar.Date && s.AttendanceTypeID == 1).Count();
                    double  perc         = Convert.ToInt16(attendeddays) * 100 / Convert.ToInt16(workingdays);
                    decimal perc1        = Convert.ToDecimal(string.Format("{0:0.00}", perc));
                    studentAttendanceexist.Percentage      = perc1;
                    db.Entry(studentAttendanceexist).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            studentAttendance = db.StudentAttendances.Include(s => s.CurrentAttendanceType).Include(s => s.CurrentStudent).Include(s => s.CurrentStudent.CurrentSchool).Include(s => s.CurrentStudent.CurrentClass).Include(s => s.CurrentStudent.CurrentSection).Include(s => s.CurrentUser).Where(s => s.AttendanceDate == calendar.Date && s.CurrentStudent.CurrentSchool.SchoolID == schoolid && s.CurrentStudent.CurrentClass.ClassID == classid && s.CurrentStudent.CurrentSection.SectionID == sectionid).OrderBy(t => t.CurrentStudent.Name).ToList();
            foreach (StudentAttendance ta in studentAttendance)
            {
                StudentAttendanceModel studentattendanceid = studentAttendancemodelList.Find(item => item.StudentID == ta.StudentID);
                studentattendanceid.BackDay2 = ta.CurrentAttendanceType.Name;
            }
            ViewBag.BackDay2 = calendar.Date.Day + " " + mfi.GetMonthName(calendar.Date.Month).Substring(0, 3);

            dte      = calendar.Date.AddDays(-1);
            calendar = db.Calendars.Where(c => c.Date <= dte && c.IsHoliday == false).OrderByDescending(c => c.Date).FirstOrDefault();
            foreach (Student student in db.Students.ToList())
            {
                StudentAttendance isStudentAdded = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate == calendar.Date).FirstOrDefault();
                if (isStudentAdded == null)
                {
                    StudentAttendance studentAttendancenew = new StudentAttendance();
                    studentAttendancenew.AttendanceTypeID = 2;
                    studentAttendancenew.AttendanceDate   = calendar.Date;
                    studentAttendancenew.StudentID        = student.StudentID;
                    studentAttendancenew.IdCard           = student.IdCard;
                    studentAttendancenew.UserID           = userid;
                    studentAttendancenew.UpdatedDate      = DateTime.Now;
                    studentAttendancenew.Percentage       = 0;
                    db.StudentAttendances.Add(studentAttendancenew);
                    db.SaveChanges();
                }
                else
                {
                    StudentAttendance studentAttendanceexist = db.StudentAttendances.Find(isStudentAdded.StudentAttendanceID);
                    int     attendeddays = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate <= calendar.Date && s.AttendanceTypeID == 1).Count();
                    double  perc         = Convert.ToInt16(attendeddays) * 100 / Convert.ToInt16(workingdays);
                    decimal perc1        = Convert.ToDecimal(string.Format("{0:0.00}", perc));
                    studentAttendanceexist.Percentage      = perc1;
                    db.Entry(studentAttendanceexist).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            studentAttendance = db.StudentAttendances.Include(s => s.CurrentAttendanceType).Include(s => s.CurrentStudent).Include(s => s.CurrentStudent.CurrentSchool).Include(s => s.CurrentStudent.CurrentClass).Include(s => s.CurrentStudent.CurrentSection).Include(s => s.CurrentUser).Where(s => s.AttendanceDate == calendar.Date && s.CurrentStudent.CurrentSchool.SchoolID == schoolid && s.CurrentStudent.CurrentClass.ClassID == classid && s.CurrentStudent.CurrentSection.SectionID == sectionid).OrderBy(t => t.CurrentStudent.Name).ToList();
            foreach (StudentAttendance ta in studentAttendance)
            {
                StudentAttendanceModel studentattendanceid = studentAttendancemodelList.Find(item => item.StudentID == ta.StudentID);
                studentattendanceid.BackDay3 = ta.CurrentAttendanceType.Name;
            }
            ViewBag.BackDay3 = calendar.Date.Day + " " + mfi.GetMonthName(calendar.Date.Month).Substring(0, 3);

            dte      = calendar.Date.AddDays(-1);
            calendar = db.Calendars.Where(c => c.Date <= dte && c.IsHoliday == false).OrderByDescending(c => c.Date).FirstOrDefault();
            foreach (Student student in db.Students.ToList())
            {
                StudentAttendance isStudentAdded = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate == calendar.Date).FirstOrDefault();
                if (isStudentAdded == null)
                {
                    StudentAttendance studentAttendancenew = new StudentAttendance();
                    studentAttendancenew.AttendanceTypeID = 2;
                    studentAttendancenew.AttendanceDate   = calendar.Date;
                    studentAttendancenew.StudentID        = student.StudentID;
                    studentAttendancenew.IdCard           = student.IdCard;
                    studentAttendancenew.UserID           = userid;
                    studentAttendancenew.UpdatedDate      = DateTime.Now;
                    studentAttendancenew.Percentage       = 0;
                    db.StudentAttendances.Add(studentAttendancenew);
                    db.SaveChanges();
                }
                else
                {
                    StudentAttendance studentAttendanceexist = db.StudentAttendances.Find(isStudentAdded.StudentAttendanceID);
                    int     attendeddays = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate <= calendar.Date && s.AttendanceTypeID == 1).Count();
                    double  perc         = Convert.ToInt16(attendeddays) * 100 / Convert.ToInt16(workingdays);
                    decimal perc1        = Convert.ToDecimal(string.Format("{0:0.00}", perc));
                    studentAttendanceexist.Percentage      = perc1;
                    db.Entry(studentAttendanceexist).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            studentAttendance = db.StudentAttendances.Include(s => s.CurrentAttendanceType).Include(s => s.CurrentStudent).Include(s => s.CurrentStudent.CurrentSchool).Include(s => s.CurrentStudent.CurrentClass).Include(s => s.CurrentStudent.CurrentSection).Include(s => s.CurrentUser).Where(s => s.AttendanceDate == calendar.Date && s.CurrentStudent.CurrentSchool.SchoolID == schoolid && s.CurrentStudent.CurrentClass.ClassID == classid && s.CurrentStudent.CurrentSection.SectionID == sectionid).OrderBy(t => t.CurrentStudent.Name).ToList();
            foreach (StudentAttendance ta in studentAttendance)
            {
                StudentAttendanceModel studentattendanceid = studentAttendancemodelList.Find(item => item.StudentID == ta.StudentID);
                studentattendanceid.BackDay4 = ta.CurrentAttendanceType.Name;
            }
            ViewBag.BackDay4 = calendar.Date.Day + " " + mfi.GetMonthName(calendar.Date.Month).Substring(0, 3);

            dte      = calendar.Date.AddDays(-1);
            calendar = db.Calendars.Where(c => c.Date <= dte && c.IsHoliday == false).OrderByDescending(c => c.Date).FirstOrDefault();
            foreach (Student student in db.Students.ToList())
            {
                StudentAttendance isStudentAdded = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate == calendar.Date).FirstOrDefault();
                if (isStudentAdded == null)
                {
                    StudentAttendance studentAttendancenew = new StudentAttendance();
                    studentAttendancenew.AttendanceTypeID = 2;
                    studentAttendancenew.AttendanceDate   = calendar.Date;
                    studentAttendancenew.StudentID        = student.StudentID;
                    studentAttendancenew.IdCard           = student.IdCard;
                    studentAttendancenew.UserID           = userid;
                    studentAttendancenew.UpdatedDate      = DateTime.Now;
                    studentAttendancenew.Percentage       = 0;
                    db.StudentAttendances.Add(studentAttendancenew);
                    db.SaveChanges();
                }
                else
                {
                    StudentAttendance studentAttendanceexist = db.StudentAttendances.Find(isStudentAdded.StudentAttendanceID);
                    int     attendeddays = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate <= calendar.Date && s.AttendanceTypeID == 1).Count();
                    double  perc         = Convert.ToInt16(attendeddays) * 100 / Convert.ToInt16(workingdays);
                    decimal perc1        = Convert.ToDecimal(string.Format("{0:0.00}", perc));
                    studentAttendanceexist.Percentage      = perc1;
                    db.Entry(studentAttendanceexist).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            studentAttendance = db.StudentAttendances.Include(s => s.CurrentAttendanceType).Include(s => s.CurrentStudent).Include(s => s.CurrentStudent.CurrentSchool).Include(s => s.CurrentStudent.CurrentClass).Include(s => s.CurrentStudent.CurrentSection).Include(s => s.CurrentUser).Where(s => s.AttendanceDate == calendar.Date && s.CurrentStudent.CurrentSchool.SchoolID == schoolid && s.CurrentStudent.CurrentClass.ClassID == classid && s.CurrentStudent.CurrentSection.SectionID == sectionid).OrderBy(t => t.CurrentStudent.Name).ToList();
            foreach (StudentAttendance ta in studentAttendance)
            {
                StudentAttendanceModel studentattendanceid = studentAttendancemodelList.Find(item => item.StudentID == ta.StudentID);
                studentattendanceid.BackDay5 = ta.CurrentAttendanceType.Name;
            }
            ViewBag.BackDay5 = calendar.Date.Day + " " + mfi.GetMonthName(calendar.Date.Month).Substring(0, 3);

            dte      = calendar.Date.AddDays(-1);
            calendar = db.Calendars.Where(c => c.Date <= dte && c.IsHoliday == false).OrderByDescending(c => c.Date).FirstOrDefault();
            foreach (Student student in db.Students.ToList())
            {
                StudentAttendance isStudentAdded = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate == calendar.Date).FirstOrDefault();
                if (isStudentAdded == null)
                {
                    StudentAttendance studentAttendancenew = new StudentAttendance();
                    studentAttendancenew.AttendanceTypeID = 2;
                    studentAttendancenew.AttendanceDate   = calendar.Date;
                    studentAttendancenew.StudentID        = student.StudentID;
                    studentAttendancenew.IdCard           = student.IdCard;
                    studentAttendancenew.UserID           = userid;
                    studentAttendancenew.UpdatedDate      = DateTime.Now;
                    studentAttendancenew.Percentage       = 0;
                    db.StudentAttendances.Add(studentAttendancenew);
                    db.SaveChanges();
                }
                else
                {
                    StudentAttendance studentAttendanceexist = db.StudentAttendances.Find(isStudentAdded.StudentAttendanceID);
                    int     attendeddays = db.StudentAttendances.Where(s => s.StudentID == student.StudentID && s.AttendanceDate <= calendar.Date && s.AttendanceTypeID == 1).Count();
                    double  perc         = Convert.ToInt16(attendeddays) * 100 / Convert.ToInt16(workingdays);
                    decimal perc1        = Convert.ToDecimal(string.Format("{0:0.00}", perc));
                    studentAttendanceexist.Percentage      = perc1;
                    db.Entry(studentAttendanceexist).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            studentAttendance = db.StudentAttendances.Include(s => s.CurrentAttendanceType).Include(s => s.CurrentStudent).Include(s => s.CurrentStudent.CurrentSchool).Include(s => s.CurrentStudent.CurrentClass).Include(s => s.CurrentStudent.CurrentSection).Include(s => s.CurrentUser).Where(s => s.AttendanceDate == calendar.Date && s.CurrentStudent.CurrentSchool.SchoolID == schoolid && s.CurrentStudent.CurrentClass.ClassID == classid && s.CurrentStudent.CurrentSection.SectionID == sectionid).OrderBy(t => t.CurrentStudent.Name).ToList();
            foreach (StudentAttendance ta in studentAttendance)
            {
                StudentAttendanceModel studentattendanceid = studentAttendancemodelList.Find(item => item.StudentID == ta.StudentID);
                studentattendanceid.BackDay6 = ta.CurrentAttendanceType.Name;
            }
            ViewBag.BackDay6 = calendar.Date.Day + " " + mfi.GetMonthName(calendar.Date.Month).Substring(0, 3);

            ViewBag.ClassID          = new SelectList(db.Classes, "ClassID", "Name", classid);
            ViewBag.SectionID        = new SelectList(db.Sections, "SectionID", "Name", sectionid);
            ViewBag.AttendanceTypeID = db.AttendanceTypes.ToList();
            Class   classselected   = db.Classes.Find(classid);
            Section sectionselected = db.Sections.Find(sectionid);

            if (classselected != null && sectionselected != null)
            {
                ViewBag.Selected = "Selected Class : " + classselected.Name + ", Section: " + sectionselected.Name;
            }
            return(View(studentAttendancemodelList));
        }
 /// <summary>
 /// Firsts the date time of week.
 /// </summary>
 /// <param name="datetime">The datetime.</param>
 /// <returns></returns>
 public static DateTime FirstDateTimeOfWeek(this DateTime datetime)
 {
     var dateinf = new System.Globalization.DateTimeFormatInfo();
     DayOfWeek firstDayOfWeek = dateinf.FirstDayOfWeek;
     return FirstDateTimeOfWeek(datetime, firstDayOfWeek);
 }
Example #55
0
 public static DateTime ParseDate(string date)
 {
     System.Globalization.DateTimeFormatInfo dateFormatProvider = new System.Globalization.DateTimeFormatInfo();
     dateFormatProvider.ShortDatePattern = "dd/MM/yyyy";
     return(DateTime.Parse(date, dateFormatProvider));
 }
        /// <summary>
        /// Serializes an Object Instance to the UPnP Way ;)
        /// </summary>
        /// <param name="data">Object to be serialized</param>
        /// <returns>The serialized data, in string form</returns>
        public static string SerializeObjectInstance(Object data)
        {
            if (data == null) return "";

            string ObjectType = data.GetType().FullName;
            string RetVal = "";

            switch (ObjectType)
            {
                case "System.Byte[]":
                    RetVal = Base64.Encode((Byte[])data);
                    break;
                case "System.Uri":
                    RetVal = ((Uri)data).AbsoluteUri;
                    break;
                case "System.Boolean":
                    if ((bool)data == true)
                    {
                        RetVal = "1";
                    }
                    else
                    {
                        RetVal = "0";
                    }
                    break;
                case "System.DateTime":
                    System.Globalization.DateTimeFormatInfo dtfi = new System.Globalization.DateTimeFormatInfo();
                    RetVal = ((DateTime)data).ToString(dtfi.SortableDateTimePattern);
                    break;
                default:
                    RetVal = data.ToString();
                    break;
            }
            return (RetVal);
        }
Example #57
0
        private List <UngVien> XuLyCV(XBrowser browser, JobLink job)
        {
            job.trang_thai_xu_ly = TrangThaiXuLy.DA_XU_LY;

            List <UngVien> lst_ung_vien = new List <UngVien>();

            try
            {
                var eles_ung_vien = browser.Find("//div[@class='col-sm-9']//form//div[@class='list-group-item-heading']");
                if (eles_ung_vien.Count > 0)
                {
                    Dictionary <string, string> dic_cv_ung_vien = new Dictionary <string, string>();
                    foreach (var item_ung_vien in eles_ung_vien)
                    {
                        try
                        {
                            var ho_ten_ele  = browser.FindChildElement(item_ung_vien, ".//span[@class='text-accent']");
                            var link_cv_ele = browser.FindChildElement(item_ung_vien, ".//a");

                            if (ho_ten_ele != null && link_cv_ele != null)
                            {
                                string href   = browser.GetAttribute(link_cv_ele, "href").Trim();
                                string ho_ten = browser.GetAttribute(ho_ten_ele, "innerText").Trim();
                                if (!dic_cv_ung_vien.ContainsKey(href))
                                {
                                    dic_cv_ung_vien.Add(href, ho_ten);
                                }
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }
                    foreach (var item in dic_cv_ung_vien)
                    {
                        browser.GoTo(item.Key);
                        UngVien ung_vien = new UngVien();
                        ung_vien.ngay_tao  = ung_vien.ngay_sua = XMedia.XUtil.TimeInEpoch();
                        ung_vien.app_id    = job.app_id;
                        ung_vien.job_link  = job.link;
                        ung_vien.ho_ten    = item.Value;
                        ung_vien.full_text = browser.GetPageSource();
                        ung_vien.vi_tri    = job.ten_job;
                        ThongTinChungUngVien ttuv = new ThongTinChungUngVien();
                        ttuv.domain              = UrlToDomain(item.Key);
                        ttuv.full_text           = browser.GetInnerHtml("//div[@class='resume-show']//div[@class='media']", 200);
                        ttuv.full_text          += browser.GetInnerHtml("//div[@id='divResumeContactInformation']", 200);
                        ung_vien.thong_tin_chung = ttuv;
                        //Bóc tách XPATH để lấy được thông tin này nếu có
                        ung_vien.kinh_nghiem   = browser.GetInnerHtml("//h4[contains(text(),'Kinh nghiệm')]/following-sibling::dl", 200);
                        ung_vien.ky_nang       = "";
                        ung_vien.hoc_van       = browser.GetInnerHtml("//h4[contains(text(),'Học vấn')]/following-sibling::dl", 200);
                        ung_vien.email         = browser.GetInnerHtml("//a[contains(@href,'mailto')]", 200);
                        ung_vien.so_dien_thoai = browser.GetInnerHtml("//div[@id='divResumeContactInformation']//dt[contains(text(),'Điện')]/following-sibling::dd[1]", 200);
                        string ngay_sinh = browser.GetInnerText("//span[@class='confidential-birth-day']", 500);
                        ung_vien.domain    = UrlToDomain(item.Key);
                        ung_vien.custom_id = item.Key.Substring(item.Key.LastIndexOf("/") + 1);
                        ung_vien.nguoi_tao = job.nguoi_tao;
                        if (!string.IsNullOrEmpty(ngay_sinh))
                        {
                            //Convert ngay sinh
                            System.Globalization.DateTimeFormatInfo dtfi = new System.Globalization.DateTimeFormatInfo();
                            dtfi.ShortDatePattern = "dd/MM/yyyy";
                            dtfi.DateSeparator    = "/";
                            try
                            {
                                var bird_day = Convert.ToDateTime(ngay_sinh, dtfi);

                                ung_vien.ngay_sinh = XMedia.XUtil.TimeInEpoch(bird_day);
                            }
                            catch (Exception)
                            {
                            }
                        }
                        var ifr = browser.FindFirst("//iframe");
                        if (ifr != null)
                        {
                            ung_vien.link_cv_offline = browser.DownloadByBrowserInIFrame("//iframe", "//button[@id='download']");
                            if (!string.IsNullOrEmpty(ung_vien.link_cv_offline))
                            {
                                ung_vien.cv_byte = File.ReadAllBytes($"{cv_save_path}\\{ung_vien.link_cv_offline}");
                            }
                        }

                        lst_ung_vien.Add(ung_vien);
                    }
                }
                else
                {
                    job.thong_tin_xu_ly = Common.KHONG_TIM_THAY_UNG_VIEN;
                }
            }
            catch (Exception ex)
            {
                job.trang_thai_xu_ly = TrangThaiXuLy.LOI;
                job.thong_tin_xu_ly  = ex.Message;
            }
            job.ngay_xu_ly = XMedia.XUtil.TimeInEpoch();
            return(lst_ung_vien);
        }
Example #58
0
        protected override void Render(HtmlTextWriter writer)
        {
            try
            {
                DateTime tmpDate;
                try
                {
                    tmpDate = this.SelectedDate == "" ? DateTime.Now : Convert.ToDateTime(SelectedDate);
                }
                catch (Exception ex)
                {
                    tmpDate = DateTime.Now;
                }


                string temp = CssClass;
                CssClass = "";
                if (temp == "")
                {
                    temp = "ampicker";
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString());
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                if (Text != "")
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "white-space:nowrap");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(Text);
                    writer.RenderEndTag();
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString());
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute("class", temp);
                writer.AddAttribute("id", ClientID);
                writer.AddAttribute("name", ClientID);
                writer.AddAttribute("onblur", "return window." + ClientID + ".onblur(this);");
                writer.AddAttribute("onkeypress", "return window." + ClientID + ".onlyDateChars(event);");
                //writer.AddAttribute("onkeydown", "return window." & Me.ClientID & ".KeyPress(event);")
                //writer.AddAttribute("onclick", "return window." & Me.ClientID & ".Click(event);showalert();")
                if (Enabled == false)
                {
                    writer.AddAttribute("disabled", "disabled");
                }
                if (ShowDateBox)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Input);
                    writer.RenderEndTag();

                }
                dtFI = Thread.CurrentThread.CurrentCulture.DateTimeFormat;
                if (!(string.IsNullOrEmpty(SelectedDate)))
                {
                    DateTime dte = DateTime.Parse(SelectedDate);
                    SelectedDate = dte.ToString(dtFI.ShortDatePattern + " " + dtFI.ShortTimePattern);
                }
                writer.AddAttribute("type", "hidden");
                writer.AddAttribute("id", "hid_" + ClientID);
                writer.AddAttribute("name", "hid_" + ClientID);
                writer.AddAttribute("value", SelectedDate);
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();
                writer.AddAttribute("id", "cal_" + ClientID);
                writer.AddAttribute("style", "display:none;position:absolute;");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if (ImageUrl == string.Empty)
                {
                    ImageUrl = Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.calendar.gif");
                }
                if (Enabled)
                {
                    writer.AddAttribute("src", ImageUrl);
                    writer.AddAttribute("onclick", "window." + ClientID + ".Toggle(event);");
                    writer.AddAttribute("id", "img_" + ClientID);
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag();
                }
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderEndTag();
                var str = new StringBuilder();
                str.Append("<script type=\"text/javascript\">");

                cal = new System.Globalization.GregorianCalendar();
                if (Thread.CurrentThread.CurrentCulture != null)
                {
                    cal = Thread.CurrentThread.CurrentCulture.Calendar;
                }
                DateFormat = dtFI.ShortDatePattern;
                TimeFormat = dtFI.ShortTimePattern;
                str.Append("window." + ClientID + "=new asDatePicker('" + ClientID + "');");
                str.Append("window." + ClientID + ".Locale='" + Context.Request.UserLanguages[0].Substring(0, 2).ToUpper() + "';");
                str.Append("window." + ClientID + ".SelectedDate='" + SelectedDate + "';");
                str.Append("window." + ClientID + ".Width='" + CalendarWidth + "';");
                str.Append("window." + ClientID + ".Height='" + CalendarHeight + "';");
                str.Append("window." + ClientID + ".DateFormat='" + dtFI.ShortDatePattern + "';");
                str.Append("window." + ClientID + ".TimeFormat='" + dtFI.ShortTimePattern + "';");
                str.Append("window." + ClientID + ".Year=" + tmpDate.Year + ";");
                str.Append("window." + ClientID + ".Month=" + (tmpDate.Month - 1) + ";");
                str.Append("window." + ClientID + ".Day=" + tmpDate.Day + ";");
                str.Append("window." + ClientID + ".SelectedYear=" + tmpDate.Year + ";");
                str.Append("window." + ClientID + ".SelectedMonth=" + (tmpDate.Month - 1) + ";");
                str.Append("window." + ClientID + ".SelectedDay=" + tmpDate.Day + ";");
                str.Append("window." + ClientID + ".ShowTime=" + ShowTime.ToString().ToLower() + ";");
                str.Append("window." + ClientID + ".DefaultTime='" + DefaultTime + "';");
                str.Append("window." + ClientID + ".CallbackFlag='" + CallbackFlag + "';");
                if (!(string.IsNullOrEmpty(RelatedControl)))
                {
                    Control ctl = Parent.FindControl(RelatedControl);
                    if (ctl == null)
                    {
                        ctl = Page.FindControl(RelatedControl);
                    }
                    if (ctl == null)
                    {
                        RelatedControl = string.Empty;
                    }
                    else
                    {
                        RelatedControl = ctl.ClientID;
                    }
                }
                str.Append("window." + ClientID + ".linkedControl='" + RelatedControl + "';");
                if (IsEndDate)
                {
                    str.Append("window." + ClientID + ".isEndDate=true;");
                }
                else
                {
                    str.Append("window." + ClientID + ".isEndDate=false;");
                }

                string sTime = string.Empty;
                SelectedTime = tmpDate.ToString(TimeFormat);
                if (ShowTime)
                {
                    if (SelectedTime != "12:00 AM")
                    {
                        sTime = SelectedTime;
                    }
                    if (TimeRequired)
                    {
                        str.Append("window." + ClientID + ".RequireTime=true;");
                    }
                    else
                    {
                        str.Append("window." + ClientID + ".RequireTime=false;");
                    }
                }
                else
                {
                    str.Append("window." + ClientID + ".RequireTime=false;");
                }

                str.Append("window." + ClientID + ".SelectedTime='" + sTime + "';");
                if (string.IsNullOrEmpty(ImgNext))
                {
                    str.Append("window." + ClientID + ".ImgNext='" + Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cal_nextMonth.gif") + "';");
                }
                else
                {
                    str.Append("window." + ClientID + ".ImgNext='" + Page.ResolveUrl(ImgNext) + "';");
                }
                if (string.IsNullOrEmpty(ImgPrev) )
                {
                    str.Append("window." + ClientID + ".ImgPrev='" + Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cal_prevMonth.gif") + "';");
                }
                else
                {
                    str.Append("window." + ClientID + ".ImgPrev='" + Page.ResolveUrl(ImgPrev) + "';");
                }
                if (SelectedDate != "")
                {
                    try
                    {
                        if (ShowTime == false && sTime == string.Empty)
                        {
                            str.Append("window." + ClientID + ".textbox.value=new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + ").formatDP('" + DateFormat + "','" + ClientID + "');");
                            str.Append("window." + ClientID + ".dateSel = new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + ",0,0,0,0);");
                        }
                        else
                        {
                            str.Append("window." + ClientID + ".textbox.value=new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + "," + tmpDate.Hour + "," + tmpDate.Minute + ",0).formatDP('" + DateFormat + " " + TimeFormat + "','" + ClientID + "');");
                            str.Append("window." + ClientID + ".dateSel = new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + "," + tmpDate.Hour + "," + tmpDate.Minute + ",0);");
                        }
                    }
                    catch (Exception ex)
                    {

                    }

                }
                int xMonths = cal.GetMonthsInYear(cal.GetYear(tmpDate), cal.GetEra(tmpDate));
                int currMonth = cal.GetMonth(tmpDate);
                int currYear = cal.GetYear(tmpDate);
                int currDay = cal.GetDayOfMonth(tmpDate);

                str.Append("window." + ClientID + ".MonthDays = new Array(");
                for (int i = 0; i < xMonths; i++)
                {
                    str.Append(cal.GetDaysInMonth(currYear, i + 1));
                    if (i < (xMonths - 1))
                    {
                        str.Append(",");
                    }
                }
                str.Append(");");
                str.AppendLine();

                string[] mNames = dtFI.MonthNames;
                str.Append("window." + ClientID + ".MonthNames = new Array(");
                for (int i = 0; i < xMonths; i++)
                {

                    str.Append("'" + mNames[i] + "'");
                    if (i < (xMonths - 1))
                    {
                        str.Append(",");
                    }
                }
                str.Append(");");
                str.AppendLine();
                str.Append("window." + ClientID + ".ShortMonthNames = new Array(");
                string[] mAbbr = dtFI.AbbreviatedMonthNames;
                for (int i = 0; i < xMonths; i++)
                {
                    str.Append("'" + mAbbr[i] + "'");
                    if (i < (xMonths - 1))
                    {
                        str.Append(",");
                    }
                }
                str.Append(");");
                str.AppendLine();
                str.Append("window." + ClientID + ".ShortDayNames = new Array(");
                string[] dAbbr = dtFI.AbbreviatedDayNames;
                for (int i = 0; i <= 6; i++)
                {
                    str.Append("'" + dAbbr[i] + "'");
                    if (i < 6)
                    {
                        str.Append(",");
                    }
                }
                str.Append(");");
                str.AppendLine();

                str.Append("window." + ClientID + ".Class={");
                str.Append("CssCalendarStyle:'" + CssCalendarStyle + "',");
                str.Append("CssMonthStyle:'" + CssMonthStyle + "',");
                str.Append("CssWeekendStyle:'" + CssWeekendStyle + "',");
                str.Append("CssWeekdayStyle:'" + CssWeekdayStyle + "',");
                str.Append("CssSelectedDayStyle:'" + CssSelectedDayStyle + "',");
                str.Append("CssCurrentMonthDayStyle:'" + CssCurrentMonthDayStyle + "',");
                str.Append("CssOtherMonthDayStyle:'" + CssOtherMonthDayStyle + "',");
                str.Append("CssDayHeaderStyle:'" + CssDayHeaderStyle + "',");
                str.Append("CssCurrentDayStyle:'" + CssCurrentDayStyle + "'};");
                str.Append("window." + ClientID + ".selectedDate=window." + ClientID + ".textbox.value;");
                str.Append("window." + ClientID + ".timeLabel='[RESX:Time]';");



                str.Append("</script>");
                writer.Write(str);
            }
            catch (Exception ex)
            {

            }
        }
Example #59
0
        public void Report()
        {
            string selectedServer = "";
            string date;

            /*
             * if (this.ServerListFilterComboBox.SelectedIndex >= 0)
             * {
             *  selectedServer = this.ServerListFilterComboBox.SelectedItem.Value.ToString();
             * }
             */
            if (this.ServerListFilterListBox.SelectedItems.Count > 0)
            {
                selectedServer = "";
                for (int i = 0; i < this.ServerListFilterListBox.SelectedItems.Count; i++)
                {
                    selectedServer += "'" + this.ServerListFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                try
                {
                    selectedServer = selectedServer.Substring(0, selectedServer.Length - 1);
                }
                catch
                {
                    selectedServer = "";     // throw ex;
                }
                finally { }
            }
            //10/22/2013 NS modified - added jQuery month/year control

            /*
             * if (this.DateParamEdit.Text == "")
             * {
             *  date = DateTime.Now.ToString();
             * }
             * else
             * {
             *  date = this.DateParamEdit.Value.ToString();
             * }
             */
            if (startDate.Value.ToString() == "")
            {
                date = DateTime.Now.ToString();
            }
            else
            {
                date = startDate.Value.ToString();
            }
            //2/2/2015 NS added for VSPLUS-1370
            if (this.ServerTypeFilterListBox.SelectedItems.Count > 0)
            {
                selectedType = "";
                for (int i = 0; i < this.ServerTypeFilterListBox.SelectedItems.Count; i++)
                {
                    selectedType += "'" + this.ServerTypeFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                try
                {
                    selectedType = selectedType.Substring(0, selectedType.Length - 1);
                }
                catch
                {
                    selectedType = "";     // throw ex;
                }
                finally { }
            }
            DateTime dt = Convert.ToDateTime(date);

            DashboardReports.DailyMemoryUsedXtraRpt report = new DashboardReports.DailyMemoryUsedXtraRpt();
            report.Parameters["DateM"].Value = dt.Month;
            report.Parameters["DateY"].Value = dt.Year;
            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
            string strMonthName = mfi.GetMonthName(dt.Month).ToString() + ", " + dt.Year.ToString();

            report.Parameters["MonthYear"].Value  = strMonthName;
            report.Parameters["ServerName"].Value = selectedServer;
            //2/2/2015 NS added for VSPLUS-1370
            report.Parameters["ServerType"].Value = selectedType;
            this.ReportViewer1.Report             = report;
            this.ReportViewer1.DataBind();
        }