private void RemovePic() { if (!this.ValidateFields(4)) { return; } MainContactAboutPic p = (MainContactAboutPic)this.Master._PapaDal.Get("mainContactAboutPic", this.contactAndAboutHiddenRe.Value); if (p == null) { this.Master._Logger.Error(new AdminException (". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(0, "Red", "")); this.ClearContactAndAboutPic(); return; } try { File.Delete(p.PicFullPath); this.Master._PapaDal.Remove("mainContactAboutPic", p.PicID); this.Master._Logger.Log(new AdminException(". " + p.PicID + " Was Successfully Removed"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(12, "White", p.PicName)); } catch (Exception e) { this.Master._Logger.Log(e, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(13, "Red", p.PicName)); } }
private void UpdatePicInit() { if (!this.ValidateFields(5)) { this.ClearContactAndAboutPic(); return; } MainContactAboutPic p = (MainContactAboutPic)this.Master._PapaDal.Get("mainContactAboutPic", this.contactAndAboutHiddenUp.Value); if (p == null) { this.Master._Logger.Error(new AdminException (". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(0, "Red", "")); } try { this.contactAndAboutPicStatusLabel.Text = p.spActive; this.contactAndAboutPicLastUpdateLabel.Text = p.spUploadTime; this.contactAndAboutPic.Src = p.PicRelativePath; this.ShowContactAndAboutPicUpdateInfo(true); this.ShowContactAndAboutFile(true); this.ShowContactAndAboutPicture(true); this.ShowContactAndAboutEnableDisable(true); } catch (Exception t) { this.Master._Logger.Error(t, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(0, "Red", "")); } }
private void DisablePic() { if (!this.ValidateFields(5)) { this.ClearContactAndAboutPic(); return; } MainContactAboutPic p = (MainContactAboutPic)this.Master._PapaDal.Get("mainContactAboutPic", this.contactAndAboutHiddenUp.Value); if (p == null) { this.Master._Logger.Error(new AdminException (". p == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(0, "Red", "")); this.ClearContactAndAboutPic(); return; } if (p.Active == 2) { this.Master._Logger.Warn(new AdminException (". " + this.contactAndAboutHiddenUp.Value + " Is Already Disabled"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(8, "Red", p.PicName)); this.ClearContactAndAboutPic(); return; } try { this.Master._PapaDal.Disable("mainContactAboutPic", p.PicID); this.Master._Logger.Log(new AdminException(". " + p.PicID + " Has Been Successfully Disabled"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(7, "White", p.PicName)); } catch (Exception f) { this.Master._Logger.Log(f, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(11, "Red", p.PicName)); } }
private void UpdatePic() { if (!this.ValidateFields(5)) { this.ClearContactAndAboutPic(); return; } MainContactAboutPic g = (MainContactAboutPic)this.Master._PapaDal.Get("mainContactAboutPic", this.contactAndAboutHiddenUp.Value); if (g == null) { this.Master._Logger.Error(new AdminException (". g == null"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(0, "Red", "")); this.ClearContactAndAboutPic(); return; } if (this.contactAndAboutPicUpload.Value != "") { if (!this.Master._GlobalFunctions.ValidatePicEnd(this.contactAndAboutPicUpload.Value)) { this.Master._Logger.Error(new AdminException (". !this.Master._GlobalFunctions.ValidatePicEnd(this.contactAndAboutPicUpload.Value)"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(14, "Red", this.contactAndAboutPicUpload.Value)); return; } string fileName = this.contactAndAboutPicUpload.PostedFile.FileName; string fileNameToSave = "contactAndAboutPic_id-" + g.PicID + "_" + fileName; string fullPath = this.Master._GlobalFunctions.GetFullPath() + fileNameToSave; string relativePath = this.Master._GlobalFunctions.GetRelativePath() + fileNameToSave; try { if (File.Exists(g.PicFullPath)) { File.Delete(g.PicFullPath); } this.contactAndAboutPicUpload.PostedFile.SaveAs(fullPath); g.PicName = fileName; g.PicFullPath = fullPath; g.PicRelativePath = relativePath; } catch (Exception r) { this.Master._Logger.Error(r, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(36, "Red", this.contactAndAboutPicUpload.Value)); this.ClearContactAndAboutPic(); return; } } try { g.LastUpdate = TimeNow.TheTimeNow; g.spLastUpdate = TimeNow.TheTimeNow.ToShortDateString(); this.Master._PapaDal.Update("mainContactAboutPic", g, TimeNow.TheTimeNow); this.Master._Logger.Log(new AdminException(". " + g.PicID + " Was Successfully Updated"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(17, "White", g.PicName)); this.removeUpdatePicSelector.Items.FindByValue("s" + g.PicID).Text = g.PicName; } catch (Exception e) { this.Master._Logger.Log(e, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(18, "Red", g.PicName)); } }
private void AddContactAndAboutPic() { if (!this.ValidateFields(2)) { this.ClearContactAndAboutPic(); return; } string ID = this.Master._PapaDal.GetNextAvailableID("mainContactAboutPic"); string fileName = this.contactAndAboutPicUpload.PostedFile.FileName; string fileNameToSave = "contactAndAboutPic_id-" + ID + "_" + fileName; string fullPath = this.Master._GlobalFunctions.GetFullPath() + fileNameToSave; string relativePath = this.Master._GlobalFunctions.GetRelativePath() + fileNameToSave; if (!this.Master._GlobalFunctions.ValidatePicEnd(this.contactAndAboutPicUpload.Value)) { this.Master._Logger.Error(new AdminException (". !this.Master._GlobalFunctions.ValidatePicEnd(this.contactAndAboutPicUpload.Value)"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(14, "Red", this.contactAndAboutPicUpload.Value)); this.ClearContactAndAboutPic(); return; } try { this.contactAndAboutPicUpload.PostedFile.SaveAs(fullPath); } catch (Exception t) { this.Master._Logger.Error(t, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(36, "Red", this.contactAndAboutPicUpload.Value)); this.ClearContactAndAboutPic(); return; } try { MainContactAboutPic p = new MainContactAboutPic { Active = 2, PicName = fileName, PicID = ID, PicFullPath = fullPath, PicRelativePath = relativePath, UploadTime = TimeNow.TheTimeNow, spUploadTime = TimeNow.TheTimeNow.ToString(), spActive = "Disable", LastUpdate = TimeNow.TheTimeNow, spLastUpdate = TimeNow.TheTimeNow.ToShortDateString() }; this.Master._PapaDal.Add("mainContactAboutPic", p); this.Master._Logger.Log(new AdminException(". " + p.PicID + " Was Successfully Added"), MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(15, "White", fileName)); this.removeUpdatePicSelector.Items.Add(new ListItem(p.PicName, "s" + p.PicID)); } catch (Exception e) { this.Master._Logger.Error(e, MethodBase.GetCurrentMethod().Name); this.Notify(this.Master._Notifier.Notify(16, "Red", fileName)); } }