protected void Page_Load(object sender, EventArgs e)
 {
     AppCode appcode = new AppCode();
     DataTable dt = appcode.DataTableSelectQuery("pic_update_category_select");
     DropDownList1.DataSource = dt;
     DropDownList1.DataBind();
 }
 protected void Button1_Click(object sender, EventArgs e)
 {            
     //DataView DV1 = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);
     AppCode appcode = new AppCode();
     DataSet DV1 = appcode.SelectQuery("Enewsletter_Email_Select");
     foreach (DataRow row in DV1.Tables[0].Rows)
     {
         string ToAddress = row["Email_Address"].ToString();
         MailMessage message = new MailMessage("*****@*****.**", ToAddress);                
         message.Body = TextBox2.Text;
         message.Subject = TextBox1.Text;
         message.BodyEncoding = System.Text.Encoding.UTF8;
         string Path = HttpContext.Current.Server.MapPath("~/images/EnewsLetters/Temp/");
         FileUpload1.SaveAs(Path + FileUpload1.FileName);
         Attachment attach1 = new Attachment(Path + FileUpload1.FileName);
         message.Attachments.Add(attach1);
         SmtpClient mailserver = new SmtpClient("amcsmail02.amcs.com", 25);
         try
         {
             mailserver.Send(message);
         }
         catch
         {
         }
         attach1.Dispose();
     }
     System.IO.File.Delete(HttpContext.Current.Server.MapPath("~/images/EnewsLetters/Temp/") + FileUpload1.FileName);
     TextBox1.Text = "";
     TextBox2.Text = "";
 }
Esempio n. 3
0
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            //Get Event Data for Calendar
            AppCode appcode = new AppCode();
            string sc = "Calendar_DayRender_Select";
            DataSet ds = new DataSet();
            ds = appcode.SelectQuery(sc);
            foreach (DataRow row in ds.Tables[0].Rows) // loop through each rows in order to compare with day cell's date  
            {
                try
                {
                    if (Convert.ToDateTime(row["Event_Date"]) == e.Day.Date)
                    {
                        if (e.Cell.Controls.Count > 1)
                        {
                            Image img = new Image();
                            img.ImageUrl = Convert.ToString(row["Icon_Path"]);
                            img.ToolTip = Convert.ToString(row["Additional_Info"]);
                            e.Cell.Controls.Add(img);
                            string linkbutn = Convert.ToString(row["Event_Name"]);
                            linkbutn = linkbutn + "<br />";
                            Label linkb = new Label();
                            linkb.Text = linkbutn;
                            linkb.ToolTip = Convert.ToString(row["Additional_Info"]);
                            linkb.Font.Size = 10;
                            e.Cell.Controls.Add(linkb);

                        }
                        else
                        {
                            e.Cell.Controls.Clear();
                            Label label = new Label();
                            string labelstring = e.Day.Date.Day.ToString();
                            labelstring = labelstring + "<br />";
                            label.Text = labelstring;
                            e.Cell.Controls.Add(label);
                            Image img = new Image();
                            img.ImageUrl = Convert.ToString(row["Icon_Path"]);
                            img.ToolTip = Convert.ToString(row["Additional_Info"]);
                            e.Cell.Controls.Add(img);
                            string linkbutn = Convert.ToString(row["Event_Name"]);
                            linkbutn = linkbutn + "<br />";
                            Label linkb = new Label();
                            linkb.Text = linkbutn;
                            linkb.ToolTip = Convert.ToString(row["Additional_Info"]);
                            linkb.Font.Size = 10;
                            e.Cell.Controls.Add(linkb);
                        }

                    }
                }
                catch
                {
                    return;
                }

            }
        }
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     Panel1.Visible = true;
     DataTable dt = new DataTable();
     AppCode appcode = new AppCode();
     dt = appcode.DataTableSelectQuery("PictureGallery_Select", DropDownList1.SelectedValue, "category");
     DataList1.DataSource = dt;
     DataList1.DataBind();
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     AppCode appcode = new AppCode();
     int param1 = Convert.ToInt16(DropDownList1.SelectedValue);
     int parma2 = Convert.ToInt16(DropDownList2.SelectedValue);
     DataTable dt = appcode.DataTableSelectQuery("Calendar_Modify_Select", param1, "month", parma2, "year");
     DataList1.DataSource = dt;
     DataList1.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     Button3.Attributes["onclick"] = "recurrdatepop()";
     tbDateList.Visible = false;
     if (!Page.IsPostBack)
     {
         AppCode appcode = new AppCode();
         DataTable dt = appcode.DataTableSelectQuery("Calendar_Update_Icon_Select");
         DropDownList1.DataSource = dt;
         DropDownList1.DataBind();
     }
 }
 void IconReSizeImage(string ImagePath, string ImageName)
 {
     System.Drawing.Image Image1 = System.Drawing.Image.FromFile(ImagePath);
     System.Drawing.Image Image2 = new Bitmap(Image1,14,16);
     Graphics oGraphic = Graphics.FromImage(Image2);
     oGraphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
     oGraphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
     oGraphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
     Rectangle oRectangle = new Rectangle(0, 0, 14, 16);
     oGraphic.DrawImage(Image2, oRectangle);           
     Image1.Dispose();
     string NewIconPath = Server.MapPath("~/images/PictureGallery/Icon/");
     NewIconPath += ImageName;
     Image2.Save(NewIconPath, System.Drawing.Imaging.ImageFormat.Jpeg);
     Image2.Dispose();
     Label2.Text = "~/images/PictureGallery/Icon/" + ImageName;
     //AccessDataSource1.Insert();
     try
     {
         AppCode appcode = new AppCode();
         appcode.Query("pic_update_insert", "Icon_Name", ImageName, "Path", ImagePath);
     }
     catch (Exception)
     {
     }
     //Rename the Original Image File to the same name as the new Image ...
     try
     {
         System.IO.File.Copy(ImagePath, Server.MapPath("~/images/PictureGallery/Original_Icon/" + ImageName), true);
     }
     catch
     {                
     }
     try
     {
         System.IO.File.Delete(ImagePath);
         System.IO.File.Delete(Server.MapPath("~/images/PictureGallery/Original_Icon/" + ImageName));
     }
     catch (Exception)
     {
     }
 }
 protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     string IconPath = "Text";
     DataSet ds = new DataSet("Event_Calendar");
     AppCode appcode = new AppCode();
     ds = appcode.SelectQuery("Calendar_Modify_Select_Record", DataList1.SelectedValue, "p1");
     foreach (DataRow row in ds.Tables[0].Rows)
     {
         TextBox_EventDate.Text = Convert.ToString(row["Event_Date"]);
         TextBox_EventName.Text = Convert.ToString(row["Event_Name"]);
         TextBoxEventInfo.Text = Convert.ToString(row["Additional_Info"]);
         IconPath = Convert.ToString(row["Icon_Path"]);
     }
     DropDownList3.DataBind();
     DropDownList3.ClearSelection();            
     ListItem li = DropDownList3.Items.FindByValue(IconPath);
     DropDownList3.SelectedIndex = DropDownList3.Items.IndexOf(li);
     Image1.ImageUrl = IconPath;
     DataList1.Visible = false;
     Panel1.Visible = true;
     
 }
Esempio n. 9
0
        protected void Button4_Click(object sender, EventArgs e)
        {
                //Find todays date, and place it in the hidden text box...
            Submit_Time.Text = DateTime.Today.Date.ToShortDateString();
            
                //Set which times were selected in the form, and place those times in the hiddend text boxes.
            if (RadioButton1.Checked)
            {
                Pref_Time.Text = RadioButton1.Text;
            }
            else if (RadioButton2.Checked)
            {
                Pref_Time.Text = RadioButton2.Text;
            }
            if (RadioButton3.Checked)
            {
                Second_Time.Text = RadioButton3.Text;
            }
            else if (RadioButton4.Checked)
            {
                Second_Time.Text = RadioButton4.Text;
            }
            if (RadioButton5.Checked)
            {
                Third_Time.Text = RadioButton5.Text;
            }
            else if (RadioButton6.Checked)
            {
                Third_Time.Text = RadioButton6.Text;
            }

                //Submit to the database.
            try
            {
                //AccessDataSource1.Insert();                
                SqlConnection conn = null;
                SqlDataReader rdr = null;
                conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Home_ARC_ORGConnectionString"].ToString());
                conn.Open();
                SqlCommand cmd = new SqlCommand("Donation_Insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("Donor_Name", TextBox1.Text));
                cmd.Parameters.Add(new SqlParameter("Phone_Number", TextBox2.Text));
                cmd.Parameters.Add(new SqlParameter("Address", TextBox3.Text));
                cmd.Parameters.Add(new SqlParameter("Address2", TextBox8.Text));
                cmd.Parameters.Add(new SqlParameter("City", TextBox9.Text));
                cmd.Parameters.Add(new SqlParameter("State", DropDownList2.SelectedValue));
                cmd.Parameters.Add(new SqlParameter("Zipcode", TextBox11.Text));
                cmd.Parameters.Add(new SqlParameter("Item_Number", DropDownList1.SelectedValue));
                if (TextBox4.Text != "Click to Select")
                {
                    cmd.Parameters.Add(new SqlParameter("Preferred_Date", TextBox4.Text));
                }
                cmd.Parameters.Add(new SqlParameter("Preferred_Time", Pref_Time.Text));
                if (TextBox5.Text != "Click to Select")
                {
                    cmd.Parameters.Add(new SqlParameter("Second_Date", TextBox5.Text));
                }
                cmd.Parameters.Add(new SqlParameter("Second_Time", Second_Time.Text));
                if (TextBox6.Text != "Click to Select")
                {
                    cmd.Parameters.Add(new SqlParameter("Third_Date", TextBox6.Text));
                }
                cmd.Parameters.Add(new SqlParameter("Third_Time", Third_Time.Text));
                cmd.Parameters.Add(new SqlParameter("Comments", TextBox7.Text));
                cmd.Parameters.Add(new SqlParameter("Submit_Date", Submit_Time.Text));
                cmd.Parameters.Add(new SqlParameter("Email_Address", Email_Addr.Text));
                rdr = cmd.ExecuteReader();
                rdr.Close();
            }
            catch ( Exception m)
            {
                if (!ClientScript.IsStartupScriptRegistered("alert"))
                {
                    string message = "donor_email_fail_pop('" + m.Message + ", please contact the Website Administrator for help.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "donor_email_fail_pop", message, true);
                }
            }

                //Create an email.            
            MailMessage NewMailMessage = new MailMessage();
            MailAddress FromAddress = new MailAddress("*****@*****.**");
                //Build To: Address list                                 
            //DataView dv = (DataView)AccessDataSource2.Select(DataSourceSelectArguments.Empty); 
            AppCode ac = new AppCode();
            DataSet dv = ac.SelectQuery("Donation_Email_Select");
            
            foreach (DataRow row in dv.Tables[0].Rows)
            {
                NewMailMessage.To.Add(Convert.ToString(row["Email_Address"]));
            }            
            NewMailMessage.From = FromAddress;            
            NewMailMessage.Subject = "A Donation Pickup has been requested!";            
            NewMailMessage.IsBodyHtml = true;
                //Email Body.
            string NewBody = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'><html><head><title></title><style type='text/css'>div {background: #0099CC; padding: 15px;}#header {background: white; padding: 10px; color: #2f4c7c;}.bottom_border {border-bottom-style: solid; border-bottom-color: black; border-bottom-width: 1px; }#Main_table {padding: 10px; color: white; background: #2f4c7c;}#top {background: #6A6A6A; height: 25px;}</style></head><body><div><div id='top'></div><div id='header'><h2>A Donation Pickup has been requested!</h2><br/><h3>Please review the requested times and dates below, and contact the donor to schedule a time for pickup.</h3><br/></div><div id='Main_table'><table style='margin-left: 35px'>";
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors Name:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", TextBox1.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors Telephone Number:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", TextBox2.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors Email Address:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", Email_Addr.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors Address:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", TextBox3.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors Address2:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", TextBox8.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors City:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", TextBox9.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors State:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", DropDownList2.SelectedValue);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors Zip:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", TextBox11.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Number of Items to Pickup:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", DropDownList1.SelectedValue);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Preferred Pickup Date and Time:</h3></td><td class='bottom_border'><table><tr><td><h3 style='margin-right: 10px;'>{0}</h3></td><td><h3>{1}</h3></td></tr></table></td></tr>", TextBox4.Text, Pref_Time.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Secondary Pickup Date and Time:</h3></td><td class='bottom_border'><table><tr><td><h3 style='margin-right: 10px;'>{0}</h3></td><td><h3>{1}</h3></td></tr></table></td></tr>", TextBox5.Text, Second_Time.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Third Pickup Date and Time:</h3></td><td class='bottom_border'><table><tr><td><h3 style='margin-right: 10px;'>{0}</h3></td><td><h3>{1}</h3></td></tr></table></td></tr>", TextBox6.Text, Third_Time.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Donors Comments:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", TextBox7.Text);
            NewBody += string.Format("<tr><td class='bottom_border'><h3 style='margin-right: 15px'>Submitted Date:</h3></td><td class='bottom_border'><h3>{0}</h3></td></tr>", Submit_Time.Text);
            NewBody += "</table></div></div><br/></body></html>";
            NewMailMessage.Body = NewBody;
                        
                //Send the email.
            SmtpClient MyMailServer = new SmtpClient();
            try
            {
                MyMailServer.Send(NewMailMessage);
                if (!ClientScript.IsStartupScriptRegistered("alert"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "donor_email_success_pop", "donor_email_success_pop('Your Donation Pickup Request has been sent!  Thank you so much!');", true);
                }
            }
            catch (Exception m)
            {

                if (!ClientScript.IsStartupScriptRegistered("alert"))
                {
                    string message = "donor_email_fail_pop('" + m.Message + ", please contact the Website Administrator for help.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "donor_email_fail_pop", message, true);
                }
            }
            Clear();
        }
 protected void Button4_Click(object sender, EventArgs e)
 {
     try
     {
         //AccessDataSource4.Insert();
         AppCode appcode = new AppCode();
         appcode.Query("pic_update_category_insert", "Category", TextBox2.Text);
     }
     catch (Exception)
     {
     }            
     // Notify the user that the category is uploaded ... 
     ClientScriptManager cs3 = Page.ClientScript;
     Type cstype3 = this.GetType();
     if (!cs3.IsStartupScriptRegistered(cstype3, "CategorySuccess"))
     {
         string s = "<script language=\"JScript\">window.alert('The new Picture Category was added successfully.');</script>";
         ClientScript.RegisterStartupScript(cstype3, "CategorySuccess", s);
     }
     TextBox2.Text = "";
     AppCode appcode1 = new AppCode();
     DataTable dt = appcode1.DataTableSelectQuery("pic_update_category_select");
     DropDownList1.DataSource = dt;
     DropDownList1.DataBind();
 }
 protected void Button1_Click1(object sender, EventArgs e)
 {
     string path = HttpContext.Current.Server.MapPath("~/images/EnewsLetters/");
     path += FileUpload1.FileName;
     // Take apart selected date, to make it the 1st of the month...
     int TodayMonth = Calendar1.SelectedDate.Month;
     int TodayYear = Calendar1.SelectedDate.Year;
     int TodayDay = 01;
     string eNewsDateString = Convert.ToString(TodayMonth) + "/" + Convert.ToString(TodayDay) + "/" + Convert.ToString(TodayYear);
     Calendar1.SelectedDate = Convert.ToDateTime(eNewsDateString);
     // Check the filename, and make sure there are no spaces in it ...
     string SelectedFileName = FileUpload1.FileName;
     // Check to make sure a date was selected ... 
     if (eNewsDateString == "1/1/1")
     {
         ClientScriptManager cs1 = Page.ClientScript;
         Type cstype1 = this.GetType();
         if (!cs1.IsStartupScriptRegistered(cstype1, "CalendarError"))
         {
             string s = "<script language=\"JScript\">window.alert('Please select a valid date from the calendar for this eNewsLetter, and try again.');</script>";
             ClientScript.RegisterStartupScript(cstype1, "CalendarError", s);
         }
     }
     // Check to make sure there are no spaces in the filename ....
     else if (SelectedFileName.Contains(" "))
     {
        ClientScriptManager cs2 = Page.ClientScript;
        Type cstype2 = this.GetType();
        if (!cs2.IsStartupScriptRegistered(cstype2, "FilenameError"))
        {
             string s = "<script language=\"JScript\">window.alert('Please remove all \"Spaces\" from the filename of the eNewsLetter, and try again.');</script>";
             ClientScript.RegisterStartupScript(cstype2, "FilenameError", s);
        }
     }
     else
     {
         try
         {
             //AccessDataSource1.Insert();
             AppCode appcode = new AppCode();
             appcode.Query("Enewletter_Update_Insert", "p1", Calendar1.SelectedDate, "p2", FileUpload1.FileName, "p3", TextBox2.Text);
         }
         catch (System.Data.OleDb.OleDbException)
         {
             ClientScriptManager cs = Page.ClientScript;
             Type cstype = this.GetType();
             if (!cs.IsStartupScriptRegistered(cstype, "DataError"))
             {
                 string s = "<script language=\"JScript\">window.alert('There was a problem accessing the database file.  Please try again.  If you continue to get this error, please contact the system administrator.');</script>";
                 ClientScript.RegisterStartupScript(cstype, "DataError", s);
             }
         }
         try
         {
             FileUpload1.SaveAs(path);
             ClientScriptManager cs1 = Page.ClientScript;
             Type cstype1 = this.GetType();
             if (!cs1.IsStartupScriptRegistered(cstype1, "UploadSuccess"))
             {
                 string s = "<script language=\"JScript\">window.alert('The eNewsLetter was updated successfully!');</script>";
                 ClientScript.RegisterStartupScript(cstype1, "UploadSuccess", s);
             }
         }
         catch (System.IO.DirectoryNotFoundException)
         {
             ClientScriptManager cs = Page.ClientScript;
             Type cstype = this.GetType();
             if (!cs.IsStartupScriptRegistered(cstype, "IOError"))
             {
                 string s = "<script language=\"JScript\">window.alert('There was a problem uploading the file. Please check the filename, and file location, and try again.  If you continue to get this error, please contact the system administrator.');</script>";
                 ClientScript.RegisterStartupScript(cstype, "IOError", s);
             }
         }
         TextBox2.Text = "";
     }
 }
 void RecentPicturesResizeImage(string ImagePath, string ImageName)
 {
     System.Drawing.Image Image1 = System.Drawing.Image.FromFile(ImagePath);
     System.Drawing.Image Image2 = new Bitmap(Image1, 230, 261);
     Graphics oGraphic = Graphics.FromImage(Image2);
     oGraphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
     oGraphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
     oGraphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
     Rectangle oRectangle = new Rectangle(0, 0, 230, 261);
     oGraphic.DrawImage(Image2, oRectangle);
     Image1.Dispose();
     string NewHomePicturePath = Server.MapPath("~/images/PictureGallery/RecentPic/" + ImageName);
     Image2.Save(NewHomePicturePath, System.Drawing.Imaging.ImageFormat.Jpeg);
     Image2.Dispose();
     Label4.Text = "~/images/PictureGallery/RecentPic/" + ImageName;
     Label6.Text = ImageName;
     try
     {
         //AccessDataSource3.Insert();
         AppCode appcode = new AppCode();
         appcode.Query("recent_pic_update_insert", "ImageName", ImageName, "ImagePath", ImagePath, "Category", DropDownList1.SelectedValue.ToString());
     }
     catch (Exception)
     {
     }
 }
Esempio n. 13
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     AppCode appcode = new AppCode();
     appcode.Query("signup_insert", "@emailaddress", TextBox1.Text);            
     TextBox1.Text = "";
 }
        protected void DataList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            int ControlIndex = this.DataList2.SelectedIndex;
            //Find the Image Control in the selected Datalist Colum
            DataListItem dli = this.DataList2.Controls[ControlIndex] as DataListItem;
            Image MyImage = dli.FindControl("Image2") as Image;
            //Grab the ImageUrl for this picture.
            string MyImagePath = MyImage.ImageUrl;
            //Delete the actual image file.
            string ActualImagePath = Server.MapPath(MyImagePath);
            System.IO.File.Delete(ActualImagePath);
            //Delete the original image file.
            string OrignialImageName = "";
            string[] split = MyImagePath.Split(new Char[] { '/' });
            foreach (string s in split)
            {
                if (s.Trim().Contains(".jpg"))
                {
                    OrignialImageName = s;
                }
            }
            string OriginalImagePath = Server.MapPath("~/images/PictureGallery/Original_HomePic/" + OrignialImageName);
            //Delete the image information from the database.
            //AccessDataSource2.DeleteParameters.Add("FilePath", MyImagePath);
            //AccessDataSource2.Delete();
            try
            {
                AppCode appcode2 = new AppCode();
                appcode2.Query("pic_mod_home_delete", "ImagePath", MyImagePath);
                DataTable dt1 = appcode2.DataTableSelectQuery("pic_mod_home_select");
                DataList2.DataSource = dt1;
                DataList2.DataBind();
            }
            catch (Exception)
            {

            }
        }
Esempio n. 15
0
        public void LabelLogic(DataSet Ds)
        {
            // Test to make sure we have some rows.

            // Determine How many rows we have.
            int ERowCount = Ds.Tables[0].Rows.Count;
            if (ERowCount > 0)  // If we have some rows.
            {
                foreach (DataRow row in Ds.Tables[0].Rows)
                {
                    int ERowID = row.Table.Rows.IndexOf(row);
                    string EventName = Convert.ToString(row["Event_Name"]);
                    AppCode appcode = new AppCode();
                    string Edate = appcode.DateFormater(Convert.ToString(row["Event_Date"]));
                    if (ERowCount >= 4)  // If we have 4 or more rows.
                    {
                        if (ERowID == 0)
                        {
                            LinkButton2.Text = EventName;
                            Literal2.Text = Edate;
                        }
                        if (ERowID == 1)
                        {
                            LinkButton3.Text = EventName;
                            Literal3.Text = Edate;
                        }
                        if (ERowID == 2)
                        {
                            LinkButton4.Text = EventName;
                            Literal4.Text = Edate;
                        }
                        if (ERowID == 3)
                        {
                            LinkButton5.Text = EventName;
                            Literal5.Text = Edate;
                        }
                        if (ERowID > 3)
                        {
                            return;
                        }
                    }
                    else if (ERowCount == 3)  // If we only have 3 rows.
                    {
                        if (ERowID == 0)
                        {
                            LinkButton2.Text = EventName;
                            Literal2.Text = Edate;
                        }
                        if (ERowID == 1)
                        {
                            LinkButton3.Text = EventName;
                            Literal3.Text = Edate;
                        }
                        if (ERowID == 2)
                        {
                            LinkButton4.Text = EventName;
                            Literal4.Text = Edate;
                            LinkButton5.Visible = false;
                            Literal5.Visible = false;
                            return;
                        }
                    }
                    else if (ERowCount == 2)  // If we only have 2 rows.
                    {
                        if (ERowID == 0)
                        {
                            LinkButton2.Text = EventName;
                            Literal2.Text = Edate;
                        }
                        if (ERowID == 1)
                        {
                            LinkButton3.Text = EventName;
                            Literal3.Text = Edate;
                            LinkButton4.Visible = false;
                            Literal4.Visible = false;
                            LinkButton5.Visible = false;
                            Literal5.Visible = false;
                            return;
                        }
                    }
                    else if (ERowCount == 1)  // If we only have 1 row.
                    {
                        if (ERowID == 0)
                        {
                            LinkButton2.Text = EventName;
                            Literal2.Text = Edate;
                            LinkButton3.Visible = false;
                            Literal3.Visible = false;
                            LinkButton4.Visible = false;
                            Literal4.Visible = false;
                            LinkButton5.Visible = false;
                            Literal5.Visible = false;
                            return;
                        }
                    }
                }
            }
            else
            {
                // If we don't have any rows.
                DateTime dt = DateTime.Now;
                string today;
                today = dt.ToLongDateString();
                Literal2.Text = today;
                LinkButton2.Text = "There are no Events scheduled.";
                LinkButton3.Visible = false;
                Literal3.Visible = false;
                LinkButton4.Visible = false;
                Literal4.Visible = false;
                LinkButton5.Visible = false;
                Literal5.Visible = false;
            }
        }
Esempio n. 16
0
		protected void Page_Load(object sender, EventArgs e)
		{
            // Set the date on all pages.
            DateTime dt = DateTime.Now;
            string today;
            today = dt.ToLongDateString();
            Literal1.Text = today;

            // Grab the data for the Up-Coming Events box. 
            AppCode appcode = new AppCode();
            string sc = "Up_Coming_Events_Select";
            string param = dt.ToShortDateString();
            DataSet MyDs = new DataSet();
            MyDs = appcode.SelectQuery(sc, param, "@datestring");

            // Set the text for each Link button in the Up-Coming Events box.
            LabelLogic(MyDs);

            // Set the date for the previous month eNewsletter box.
            int TodayMonth = dt.Month;
            int TodayYear = dt.Year;
            if (TodayMonth == 1)
            {
                TodayMonth = 12;
                TodayYear = TodayYear - 1;
            }
            else
            {
                TodayMonth = dt.Month - 1;
                TodayYear = dt.Year;
            }
            int TodayDay = 01;
            string eNewsDateString = Convert.ToString(TodayMonth) + "/" + Convert.ToString(TodayDay) + "/" + Convert.ToString(TodayYear);

            // Grab the data for the previous month eNewsletter box.
            string eNewsSC = "pre_month_newsletter_select";
            string eNewsparam = eNewsDateString;
            DataSet MyDs1 = new DataSet();
            MyDs1 = appcode.SelectQuery(eNewsSC, eNewsparam, "@enewsdatestring");
            MyDs1.DataSetName = "PreviousMonth";

            // Set the previous month eNewsletter box labels.
            eNewsLableLogic(MyDs1);

            // Set the date for the current month eNewsletter box.
            int CurrentMonth = dt.Month;
            int CurrentYear = dt.Year;
            int CurrentDay = 01;
            string eNewsCurrentDateString = Convert.ToString(CurrentMonth) + "/" + Convert.ToString(CurrentDay) + "/" + Convert.ToString(CurrentYear);

            // Grab the data for the current month eNewsletter box.
            string eNewsCurrentSC = "curr_month_newsletter_select";
            string eNewsCurrentparam = eNewsCurrentDateString;
            DataSet MyDsCurrent = new DataSet();
            MyDsCurrent = appcode.SelectQuery(eNewsCurrentSC, eNewsCurrentparam, "@enewscurrentdatestring");
            MyDsCurrent.DataSetName = "CurrentMonth";

            // Set the current eNewsletter box labels.
            eNewsLableLogic(MyDsCurrent);

            // Determine if there is a new blog post within the last 7 days.
            DateTime BlogDateValue = dt.AddDays(-7).Date;
            DataTable dtable = appcode.AcessDataTable(BlogDateValue);
            if (dtable.Rows.Count != 0)
            {
                ImageButton2.ImageUrl = @"~/images/NewPostBlog.gif";
            }
            else
            {
                ImageButton2.ImageUrl = "~/images/Arc_Blog-man.jpg";
            }
		}
 protected void Button1_Click(object sender, EventArgs e)
 {
     AppCode appcode = new AppCode();
     appcode.Query("eNewsLetter_Unsubscribe_Delete", "@origemailaddress", TextBox1.Text);            
     TextBox1.Text = "";
 }
 protected void Button4_Click(object sender, EventArgs e)
 {
     //AccessDataSource4.Delete();
     AppCode appcode1 = new AppCode();
     appcode1.Query("pic_mod_category_delete", "ID", DropDownList1.SelectedValue);
     DataTable dt1 = appcode1.DataTableSelectQuery("pic_update_category_select");
     DropDownList1.DataSource = dt1;
     DropDownList1.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         AppCode appcode = new AppCode();
         DataTable dt = appcode.DataTableSelectQuery("pic_update_category_select");
         DropDownList1.DataSource = dt;
         DropDownList1.DataBind();
         DataTable dt1 = appcode.DataTableSelectQuery("pic_mod_recent_select");
         DataList3.DataSource = dt1;
         DataList3.DataBind();
         DataTable dt2 = appcode.DataTableSelectQuery("pic_mod_home_select");
         DataList2.DataSource = dt2;
         DataList2.DataBind();
         DataTable dt3 = appcode.DataTableSelectQuery("pic_mod_icon_select");
         DataList1.DataSource = dt3;
         DataList1.DataBind();
     }
 }
 void HomePictureResizeImage(string ImagePath, string ImageName)
 {
     System.Drawing.Image Image1 = System.Drawing.Image.FromFile(ImagePath);
     System.Drawing.Image Image2 = new Bitmap(Image1, 160, 120);
     Graphics oGraphic = Graphics.FromImage(Image2);
     oGraphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
     oGraphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
     oGraphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
     Rectangle oRectangle = new Rectangle(0, 0, 160, 120);
     oGraphic.DrawImage(Image2, oRectangle);
     Image1.Dispose();
     string NewHomePicturePath = Server.MapPath("~/images/PictureGallery/HomePic/" + ImageName);
     Image2.Save(NewHomePicturePath, System.Drawing.Imaging.ImageFormat.Jpeg);
     Image2.Dispose();
     Label3.Text = "~/images/PictureGallery/HomePic/" + ImageName;
     Label5.Text = ImageName;
     try
     {
         //AccessDataSource2.Insert();
         AppCode appcode = new AppCode();
         appcode.Query("home_pic_upate_insert", "FileName", ImageName, "FilePath", ImagePath);
     }
     catch (Exception)
     {                               
     }
 }
 protected void Button5_Click(object sender, EventArgs e)
 {
     AppCode appcode = new AppCode();
     appcode.Query("Calendar_Modify_Delete", "p1", DataList1.SelectedValue);
     TextBox_EventDate.Text = "";
     TextBox_EventName.Text = "";
     TextBoxEventInfo.Text = "";
     Panel1.Visible = false;
     DataList1.DataBind();
     DataList1.Visible = true;
 }