Example #1
0
    protected void updateStudioPicButton_Click(object sender, EventArgs e)
    {
        if (!this.ValidateFields(3))
        {
            return;
        }

        this.studioHiddenUp.Value = this.removeUpdatePicSelector.SelectedValue.Remove(0, 1);

        StudioRoomPic p = (StudioRoomPic)this.Master._PapaDal.Get("studioPic", this.studioHiddenUp.Value);

        if (p == null)
        {
            this.Master._Logger.Error(new AdminException
                                          (". p == null"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(0, "Red", ""));
            return;
        }

        if (p.PicFullBWPath != "")
        {
            this.studioHiddenType.Value = p.PicFullBWPath;
        }

        this.UpdatePicInit();
        this.DivSwitcher(2);
    }
Example #2
0
    private void EnablePic()
    {
        if (!this.ValidateFields(5))
        {
            this.ClearFields(3);
            return;
        }

        StudioRoomPic p = (StudioRoomPic)this.Master._PapaDal.Get("studioPic", this.studioHiddenUp.Value);

        if (p == null)
        {
            this.Master._Logger.Error(new AdminException
                                          (". p == null"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(0, "Red", ""));
            this.ClearStudioPic();
            return;
        }

        if (p.Active == 1)
        {
            this.Master._Logger.Warn(new AdminException
                                         (". " + this.studioHiddenUp.Value + " Is Already Disabled"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(9, "Red", p.PicName));
            this.ClearStudioPic();
            return;
        }

        if (!this.Master._PapaDal.CheckPlacesStatus(p.RoomName))
        {
            this.Master._Logger.Warn(new AdminException
                                         (". Max Pictures For " + p.RoomName), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(54, "Red", p.RoomName));
            this.ClearStudioPic();
            return;
        }

        try
        {
            this.Master._PapaDal.Enable("studioPic", p.PicID);
            this.Master._Logger.Log(new AdminException(". " + p.PicID +
                                                       " Has Been Successfully Enabled"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(6, "White", p.PicName));
        }
        catch (Exception f)
        {
            this.Master._Logger.Log(f, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(10, "Red", p.PicName));
        }
    }
Example #3
0
    private void RemovePic()
    {
        if (!this.ValidateFields(4))
        {
            this.ClearStudioPic();
            return;
        }

        StudioRoomPic p = (StudioRoomPic)this.Master._PapaDal.Get("studioPic", this.studioHiddenRe.Value);

        if (p == null)
        {
            this.Master._Logger.Error(new AdminException
                                          (". p == null"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(0, "Red", ""));
            this.ClearFields(3);
            return;
        }

        try
        {
            if (p.PicFullBWPath != "")
            {
                File.Delete(p.PicFullBWPath);
            }

            if (p.PicFullColorPath != "")
            {
                File.Delete(p.PicFullColorPath);
            }

            this.Master._PapaDal.Remove("studioPic", 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));

            this.removeUpdatePicSelector.Items.Remove
                (this.removeUpdatePicSelector.Items.FindByValue("s" + p.PicID));
        }
        catch (Exception e)
        {
            this.Master._Logger.Log(e, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(13, "Red", p.PicName));
        }
    }
Example #4
0
    private void DisablePic()
    {
        if (!this.ValidateFields(5))
        {
            this.ClearStudioPic();
            return;
        }

        StudioRoomPic p = (StudioRoomPic)this.Master._PapaDal.Get("studioPic", this.studioHiddenUp.Value);

        if (p == null)
        {
            this.Master._Logger.Error(new AdminException
                                          (". p == null"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(0, "Red", p.PicName));
            this.ClearStudioPic();
            return;
        }

        if (p.Active == 2)
        {
            this.Master._Logger.Warn(new AdminException
                                         (". " + this.studioHiddenUp.Value + " Is Already Disabled"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(8, "Red", p.PicName));
            this.ClearStudioPic();
            return;
        }

        try
        {
            this.Master._PapaDal.Disable("studioPic", 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));
        }
    }
Example #5
0
    private void UpdatePic()
    {
        if (!this.ValidateFields(5))
        {
            this.ClearStudioPic();
            return;
        }

        if (this.studioPicTypeSelector.SelectedIndex == 3 && this.studioBWPicUpload.Value == "")
        {
            this.Master._Logger.Error(new AdminException
                                          (". this.studioBWPicUpload.Value == \"\""), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(37, "Red", "Black And White Complex Picture"));
            this.ClearStudioPic();
            return;
        }

        StudioRoomPic p = (StudioRoomPic)this.Master._PapaDal.Get("studioPic", this.studioHiddenUp.Value);

        if (p == null)
        {
            this.Master._Logger.Error(new AdminException
                                          (". p == null"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(0, "Red", ""));
            this.ClearStudioPic();
            return;
        }

        if (!this.Master._PapaDal.CheckAvailablePlaceExcept(this.studioPicTypeSelector.SelectedValue,
                                                            p.PicPlace, int.Parse(this.studioPicPlaceSelector.SelectedValue)))
        {
            this.Master._Logger.Error(new AdminException
                                          (@". if (!this.Master._PapaDal.CheckAvailablePlaceExcept(""this.studioPicTypeSelector.SelectedValue"",
            p.PicPlace, int.Parse(this.studioPicPlaceSelector.SelectedValue)))"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(21, "Red", this.studioPicPlaceSelector.SelectedValue));
            this.ClearStudioPic();
            return;
        }

        if (this.studioColorPicUpload.Value != "")
        {
            if (!this.Master._GlobalFunctions.ValidatePicEnd(this.studioColorPicUpload.Value))
            {
                this.Master._Logger.Error(new AdminException
                                              (". !this.Master._GlobalFunctions.ValidatePicEnd(this.studioColorPicUpload.Value)"),
                                          MethodBase.GetCurrentMethod().Name);
                this.Notify(this.Master._Notifier.Notify(14, "Red", this.studioColorPicUpload.Value));
                this.ClearStudioPic();
                return;
            }

            string fileColorName       = this.studioColorPicUpload.PostedFile.FileName;
            string fileColorNameToSave = "studioColorPic_id-" + ID + "_" + fileColorName;
            string fullColorPath       = this.Master._GlobalFunctions.GetFullPath() + fileColorNameToSave;
            string relativeColorPath   = this.Master._GlobalFunctions.GetRelativePath() + fileColorNameToSave;

            try
            {
                if (File.Exists(p.PicFullColorPath))
                {
                    File.Delete(p.PicFullColorPath);
                }
                this.studioColorPicUpload.PostedFile.SaveAs(fullColorPath);

                p.PicName              = fileColorName;
                p.PicFullColorPath     = fullColorPath;
                p.PicRelativeColorPath = relativeColorPath;
            }
            catch (Exception f)
            {
                this.Master._Logger.Error(f, MethodBase.GetCurrentMethod().Name);
                this.Notify(this.Master._Notifier.Notify(36, "Red", this.studioColorPicUpload.Value));
                this.ClearStudioPic();
                return;
            }
        }

        if (this.studioBWPicUpload.Value != "")
        {
            if (!this.Master._GlobalFunctions.ValidatePicEnd(this.studioBWPicUpload.Value))
            {
                this.Master._Logger.Error(new AdminException
                                              (". !this.Master._GlobalFunctions.ValidatePicEnd(this.studioBWPicUpload.Value)"),
                                          MethodBase.GetCurrentMethod().Name);
                this.Notify(this.Master._Notifier.Notify(14, "Red", this.studioBWPicUpload.Value));
                this.ClearStudioPic();
                return;
            }

            string fileBWName       = this.studioBWPicUpload.PostedFile.FileName;
            string fileBWNameToSave = "studioBWPic_id-" + p.PicID + "_" + fileBWName;
            string fullBWPath       = this.Master._GlobalFunctions.GetFullPath() + fileBWNameToSave;
            string relativeBWPath   = this.Master._GlobalFunctions.GetRelativePath() + fileBWNameToSave;

            try
            {
                if (File.Exists(p.PicFullBWPath))
                {
                    File.Delete(p.PicFullBWPath);
                }
                this.studioBWPicUpload.PostedFile.SaveAs(fullBWPath);

                p.PicFullBWPath     = fullBWPath;
                p.PicRelativeBWPath = relativeBWPath;
            }
            catch (Exception f)
            {
                this.Master._Logger.Error(f, MethodBase.GetCurrentMethod().Name);
                this.Notify(this.Master._Notifier.Notify(36, "Red", this.studioBWPicUpload.Value));
                this.ClearStudioPic();
                return;
            }
        }
        else
        {
            if (File.Exists(p.PicFullBWPath))
            {
                File.Delete(p.PicFullBWPath);
            }

            p.PicFullBWPath     = "";
            p.PicRelativeBWPath = "";
        }

        try
        {
            p.spLastUpdate = TimeNow.TheTimeNow.ToShortDateString();
            p.LastUpdate   = TimeNow.TheTimeNow;
            p.RoomName     = this.studioPicTypeSelector.SelectedValue;
            p.PicPlace     = int.Parse(this.studioPicPlaceSelector.SelectedValue);

            this.Master._PapaDal.Update("studioPic", p, TimeNow.TheTimeNow);
            this.Master._Logger.Log(new AdminException(". " + p.PicID +
                                                       " Was Successfully Updated"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(17, "White", p.PicName));

            this.removeUpdatePicSelector.Items.FindByValue("s" + p.PicID).Text = p.PicName;
        }
        catch (Exception e)
        {
            this.Master._Logger.Log(e, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(18, "Red", p.PicName));
        }
    }
Example #6
0
    private void UpdatePicInit()
    {
        if (!this.ValidateFields(5))
        {
            this.ClearStudioPic();
            return;
        }

        StudioRoomPic p = (StudioRoomPic)this.Master._PapaDal.Get("studioPic", this.studioHiddenUp.Value);

        if (p == null)
        {
            this.Master._Logger.Error(new AdminException
                                          (". p == null"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(0, "Red", ""));
            this.ClearStudioPic();
            return;
        }

        foreach (ListItem l in this.studioPicTypeSelector.Items)
        {
            l.Selected = false;
        }

        if (p.RoomName == "studioWhoPlaysHere")
        {
            this.SetPicPlaceSelector("who", "update");
        }
        else
        {
            this.SetPicPlaceSelector("notWho", "none");
        }

        try
        {
            this.studioPicStatusLabel.Text     = p.spActive;
            this.studioPicLastUpdateLabel.Text = p.spLastUpdate;
            this.studioPicTypeSelector.Items.FindByValue(p.RoomName).Selected = true;
            this.studioPicPlaceSelector.SelectedValue = p.PicPlace.ToString();
            this.studioColorPicUploadPic.Src          = p.PicRelativeColorPath;
            this.ShowColorPic(true);
            this.ShowColorFile(true);
            this.ShowStudioPicUpdateInfo(true);

            if (p.PicFullBWPath != null)
            {
                if (p.PicFullBWPath != "")
                {
                    this.studioBWPicUploadPic.Src = p.PicRelativeBWPath;
                    this.ShowBWPic(true);
                    this.ShowBWFile(true);
                    this.ShowBWArea(true);
                }
            }
        }
        catch (Exception t)
        {
            this.Master._Logger.Error(t, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(0, "Red", ""));
            this.ClearStudioPic();
        }
    }
Example #7
0
    private void AddStudioPic()
    {
        if (this.studioColorPicUpload.Value == "")
        {
            this.Master._Logger.Error(new AdminException
                                          (". this.studioColorPicUpload.Value == \"\""), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(37, "Red", "Color Picture"));
            this.ClearStudioPic();
            return;
        }

        string ID                  = this.Master._PapaDal.GetNextAvailableID("studioPic");
        string fileColorName       = this.studioColorPicUpload.PostedFile.FileName;
        string fileColorNameToSave = "studioColorPic_id-" + ID + "_" + fileColorName;
        string fullColorPath       = this.Master._GlobalFunctions.GetFullPath() + fileColorNameToSave;
        string relativeColorPath   = this.Master._GlobalFunctions.GetRelativePath() + fileColorNameToSave;
        string fileBWName          = "";
        string fileBWNameToSave    = "";
        string fullBWPath          = "";
        string relativeBWPath      = "";

        if (!this.Master._PapaDal.CheckAvailablePlace(this.studioPicTypeSelector.SelectedValue,
                                                      int.Parse(this.studioPicPlaceSelector.SelectedValue)))
        {
            this.Master._Logger.Error(new AdminException
                                          (@". !this.Master._PapaDal.CheckAvailablePlace(""this.studioPicTypeSelector.SelectedValue"", 
                    int.Parse(this.studioPicPlace.Text))"), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(21, "Red", this.studioPicPlaceSelector.SelectedValue));
            this.ClearStudioPic();
            return;
        }

        if (!this.Master._GlobalFunctions.ValidatePicEnd(this.studioColorPicUpload.Value))
        {
            this.Master._Logger.Error(new AdminException
                                          (". !this.Master._GlobalFunctions.ValidatePicEnd(this.studioColorPicUpload.Value)"),
                                      MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(14, "Red", this.studioColorPicUpload.Value));
            this.ClearStudioPic();
            return;
        }

        if (this.studioPicTypeSelector.SelectedIndex == 3 && this.studioBWPicUpload.Value == "")
        {
            this.Master._Logger.Error(new AdminException
                                          (". this.studioBWPicUpload.Value == \"\""), MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(37, "Red", "Black And White Complex Picture"));
            this.ClearStudioPic();
            return;
        }
        else
        {
            if (!this.Master._GlobalFunctions.ValidatePicEnd(this.studioBWPicUpload.Value))
            {
                this.Master._Logger.Error(new AdminException
                                              (". !this.Master._GlobalFunctions.ValidatePicEnd(this.studioBWPicUpload.Value)"),
                                          MethodBase.GetCurrentMethod().Name);
                this.Notify(this.Master._Notifier.Notify(14, "Red", this.studioBWPicUpload.Value));
                this.ClearFields(3);
                return;
            }

            fileBWName       = this.studioBWPicUpload.PostedFile.FileName;
            fileBWNameToSave = "studioBWPic_id-" + ID + "_" + fileBWName;
            fullBWPath       = this.Master._GlobalFunctions.GetFullPath() + fileBWNameToSave;
            relativeBWPath   = this.Master._GlobalFunctions.GetRelativePath() + fileBWNameToSave;

            try
            {
                this.studioBWPicUpload.PostedFile.SaveAs(fullBWPath);
            }
            catch (Exception b)
            {
                this.Master._Logger.Error(b, MethodBase.GetCurrentMethod().Name);
                this.Notify(this.Master._Notifier.Notify(36, "Red", this.studioBWPicUpload.Value));
                this.ClearStudioPic();
                return;
            }
        }

        try
        {
            this.studioColorPicUpload.PostedFile.SaveAs(fullColorPath);
        }
        catch (Exception m)
        {
            this.Master._Logger.Error(m, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(36, "Red", this.studioColorPicUpload.Value));
            this.ClearStudioPic();
            return;
        }

        try
        {
            StudioRoomPic p = new StudioRoomPic
            {
                Active               = 2,
                PicName              = fileColorName,
                PicPlace             = int.Parse(this.studioPicPlaceSelector.SelectedValue),
                PicID                = ID,
                PicFullBWPath        = fullBWPath,
                PicRelativeBWPath    = relativeBWPath,
                PicFullColorPath     = fullColorPath,
                PicRelativeColorPath = relativeBWPath,
                LastUpdate           = TimeNow.TheTimeNow,
                spLastUpdate         = TimeNow.TheTimeNow.ToShortDateString(),
                RoomName             = this.studioPicTypeSelector.SelectedValue,
                UploadTime           = TimeNow.TheTimeNow,
                spUploadTime         = TimeNow.TheTimeNow.ToString(),
                spActive             = "Disable"
            };

            this.Master._PapaDal.Add("studioPic", p);
            this.Master._Logger.Log(new AdminException(". " + p.PicID + " Was Successfully Added"),
                                    MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(15, "White", p.PicName));

            this.removeUpdatePicSelector.Items.Add(new ListItem(p.PicName, "s" + ID));
        }
        catch (Exception e)
        {
            this.Master._Logger.Error(e, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(16, "Red", fileBWName + " And " + fileColorName));
        }
    }