示例#1
0
    private void UpdatePicInit()
    {
        if (!this.ValidateFields(5))
        {
            this.ClearDesignPic();
            return;
        }

        DesignPic p = (DesignPic)this.Master._PapaDal.Get("designPic", this.designHiddenUp.Value);

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

        try
        {
            this.designPicStatusLabel.Text     = p.spActive;
            this.designPicLastUpdateLabel.Text = p.spUploadTime;
            this.designPic.Src = p.PicRelativePath;
        }
        catch (Exception t)
        {
            this.Master._Logger.Error(t, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(0, "Red", ""));
        }
    }
示例#2
0
    private void DisablePic()
    {
        if (!this.ValidateFields(5))
        {
            this.ClearDesignPic();
            return;
        }

        DesignPic p = (DesignPic)this.Master._PapaDal.Get("designPic", this.designHiddenUp.Value);

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

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

        try
        {
            this.Master._PapaDal.Disable("designPic", this.designHiddenUp.Value);
            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));
        }
    }
示例#3
0
    private void RemovePic()
    {
        if (!this.ValidateFields(4))
        {
            this.ClearDesignPic();
            return;
        }

        DesignPic p = (DesignPic)this.Master._PapaDal.Get("designPic", this.designHiddenRe.Value);

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

        try
        {
            if (File.Exists(p.PicFullPath))
            {
                File.Delete(p.PicFullPath);
            }

            this.Master._PapaDal.Remove("designPic", 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));
        }
    }
示例#4
0
    private void UpdatePic()
    {
        if (!this.ValidateFields(5))
        {
            this.ClearDesignPic();
            return;
        }

        DesignPic g = (DesignPic)this.Master._PapaDal.Get("designPic", this.designHiddenUp.Value);

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

        if (this.designPicUpload.Value != "")
        {
            if (!this.Master._GlobalFunctions.ValidatePicEnd(this.designPicUpload.Value))
            {
                this.Master._Logger.Error(new AdminException
                                              (". !this.Master._GlobalFunctions.ValidatePicEnd(this.designPicUpload.Value)"),
                                          MethodBase.GetCurrentMethod().Name);
                this.Notify(this.Master._Notifier.Notify(14, "Red", this.designPicUpload.Value));
                this.ClearDesignPic();
                return;
            }
            try
            {
                string fileName       = this.designPicUpload.PostedFile.FileName;
                string fileNameToSave = "designPic_id-" + g.PicID + "_" + fileName;
                string fullPath       = this.Master._GlobalFunctions.GetFullPath() + fileNameToSave;
                string relativePath   = this.Master._GlobalFunctions.GetRelativePath() + fileNameToSave;

                if (File.Exists(g.PicFullPath))
                {
                    File.Delete(g.PicFullPath);
                }
                g.PicRelativePath = relativePath;
                this.designPicUpload.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.designPicUpload.Value));
                this.ClearDesignPic();
                return;
            }
        }

        try
        {
            g.LastUpdate   = TimeNow.TheTimeNow;
            g.spLastUpdate = TimeNow.TheTimeNow.ToShortDateString();

            this.Master._PapaDal.Update("designPic", 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));
        }
    }
示例#5
0
    private void AddDesignPic()
    {
        if (!this.ValidateFields(2))
        {
            this.ClearDesignPic();
            return;
        }

        string ID             = this.Master._PapaDal.GetNextAvailableID("designPic");
        string fileName       = this.designPicUpload.PostedFile.FileName;
        string fileNameToSave = "designPic_id-" + ID + "_" + fileName;
        string fullPath       = this.Master._GlobalFunctions.GetFullPath() + fileNameToSave;
        string relativePath   = this.Master._GlobalFunctions.GetRelativePath() + fileNameToSave;


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

        try
        {
            this.designPicUpload.PostedFile.SaveAs(fullPath);
        }
        catch (Exception y)
        {
            this.Master._Logger.Error(y, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(36, "Red", this.designPicUpload.Value));
            this.ClearDesignPic();
            return;
        }

        try
        {
            DesignPic p = new DesignPic
            {
                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("designPic", 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" + p.PicID));
        }
        catch (Exception e)
        {
            this.Master._Logger.Error(e, MethodBase.GetCurrentMethod().Name);
            this.Notify(this.Master._Notifier.Notify(16, "Red", fileName));
        }
    }
示例#6
0
    public void Start(string type)  //this method create and insert values for all the lists, or update them if they are exists
    {
        //in this part, will be inserted all the text stuff
        //check to see witch section need to be full of values
        //if yes, insert them. if no, create
        //if no, create object and insert him to the session
        //the first case have explenation, same for all

        switch (type)
        {
        case "complexAbout":
            if (this.GetCount(type) == 0)
            {
                ComplexAbout m = new ComplexAbout
                {
                    ComplexAboutID = this.GetNextAvailableID(type),
                    AboutEn        = "contact us",
                    AboutHe        = "צור קשר",
                    LastUpdate     = DateTime.Now,
                    spLastUpdate   = DateTime.Now.ToString()
                };
                this.papaDal.ComplexAbouts.InsertOnSubmit(m);
            }
            break;

        case "studioAbout":

            if (this.GetCount(type) == 0)
            {
                StudioAbout m = new StudioAbout
                {
                    StudioAboutID = this.GetNextAvailableID(type),
                    AboutEn       = "contact us",
                    AboutHe       = "צור קשר",
                    LastUpdate    = DateTime.Now,
                    spLastUpdate  = DateTime.Now.ToString()
                };
                this.papaDal.StudioAbouts.InsertOnSubmit(m);
            }
            break;

        case "designText":
            if (this.GetCount(type) == 0)
            {
                DesignText m = new DesignText
                {
                    DesignTextID = this.GetNextAvailableID(type),
                    TextEn       = "contact us",
                    TextHe       = "צור קשר",
                    LastUpdate   = DateTime.Now,
                    spLastUpdate = DateTime.Now.ToString()
                };
                this.papaDal.DesignTexts.InsertOnSubmit(m);
            }
            break;

        case "prText":
            if (this.GetCount(type) == 0)
            {
                PrText m = new PrText
                {
                    PrTextID     = this.GetNextAvailableID(type),
                    TextEn       = "contact us",
                    TextHe       = "צור קשר",
                    LastUpdate   = DateTime.Now,
                    spLastUpdate = DateTime.Now.ToString()
                };
                this.papaDal.PrTexts.InsertOnSubmit(m);
            }
            break;

        case "mainContact":
            if (this.GetCount(type) == 0)
            {
                StreamReader  aben      = new StreamReader(@"C:\Works\Papaito\StudioMokeUpUniteDfinal3\DataBaseReceiver\Files\ContactEn.txt");
                StringBuilder contactEn = new StringBuilder();

                try
                {
                    while (!aben.EndOfStream)
                    {
                        contactEn.Append(aben.ReadLine());
                    }
                }
                finally
                {
                    if (aben != null)
                    {
                        aben.Close();
                    }
                }


                StreamReader  abhe      = new StreamReader(@"C:\Works\Papaito\StudioMokeUpUniteDfinal3\DataBaseReceiver\Files\ContactHe.txt");
                StringBuilder contactHe = new StringBuilder();

                try
                {
                    while (!abhe.EndOfStream)
                    {
                        string w = abhe.ReadLine();

                        UTF8Encoding utf8Contact       = new UTF8Encoding();
                        byte[]       theTextContact    = utf8Contact.GetBytes(w);
                        string       hebrewTextContact = utf8Contact.GetString(theTextContact);

                        contactHe.Append(hebrewTextContact);
                    }
                }
                finally
                {
                    if (abhe != null)
                    {
                        abhe.Close();
                    }
                }


                MainContact m = new MainContact
                {
                    MainContactID = this.GetNextAvailableID(type),
                    ContactEn     = contactEn.ToString(),
                    ContactHe     = contactHe.ToString(),
                    LastUpdate    = DateTime.Now,
                    spLastUpdate  = DateTime.Now.ToString()
                };
                this.papaDal.MainContacts.InsertOnSubmit(m);
            }
            break;

        case "mainAbout":
            if (this.GetCount(type) == 0)
            {
                StreamReader  aben    = new StreamReader(@"C:\Works\Papaito\StudioMokeUpUniteDfinal3\DataBaseReceiver\Files\AboutEn.txt");
                StringBuilder aboutEn = new StringBuilder();

                try
                {
                    while (!aben.EndOfStream)
                    {
                        aboutEn.Append(aben.ReadLine());
                    }
                }
                finally
                {
                    if (aben != null)
                    {
                        aben.Close();
                    }
                }

                StreamReader  abhe    = new StreamReader(@"C:\Works\Papaito\StudioMokeUpUniteDfinal3\DataBaseReceiver\Files\AboutHe.txt");
                StringBuilder aboutHe = new StringBuilder();

                try
                {
                    while (!abhe.EndOfStream)
                    {
                        string y = abhe.ReadLine();

                        UTF8Encoding utf8About       = new UTF8Encoding();
                        byte[]       theTextAbout    = utf8About.GetBytes(y);
                        string       hebrewTextAbout = utf8About.GetString(theTextAbout);
                        aboutHe.Append(hebrewTextAbout);
                    }
                }
                finally
                {
                    if (abhe != null)
                    {
                        abhe.Close();
                    }
                }

                MainAbout m = new MainAbout
                {
                    MainAboutID  = this.GetNextAvailableID(type),
                    AboutEn      = aboutEn.ToString(),
                    AboutHe      = aboutHe.ToString(),
                    LastUpdate   = DateTime.Now,
                    spLastUpdate = DateTime.Now.ToString()
                };
                this.papaDal.MainAbouts.InsertOnSubmit(m);
            }
            break;

        case "staffItay":
            if (this.GetCount(type) == 0)
            {
                StaffItay m = new StaffItay
                {
                    StaffItayID  = this.GetNextAvailableID(type),
                    ItayTitleEn  = "Itay Ben Margy",
                    ItayTitleHe  = "איתי בן מרגי",
                    ItayTextEn   = "test",
                    ItayTextHe   = "ניסוי",
                    LastUpdate   = DateTime.Now,
                    spLastUpdate = DateTime.Now.ToString()
                };
                this.papaDal.StaffItays.InsertOnSubmit(m);
            }
            break;

        case "staffNapo":
            if (this.GetCount(type) == 0)
            {
                StaffNapo m = new StaffNapo
                {
                    StaffNapoID  = this.GetNextAvailableID(type),
                    NapoTitleEn  = "Napo",
                    NapoTitleHe  = "נאפו",
                    NapoTextEn   = "test",
                    NapoTextHe   = "ניסוי",
                    LastUpdate   = DateTime.Now,
                    spLastUpdate = DateTime.Now.ToString()
                };
                this.papaDal.StaffNapos.InsertOnSubmit(m);
            }
            break;

        case "staffPerri":
            if (this.GetCount(type) == 0)
            {
                StaffPerri m = new StaffPerri
                {
                    StaffPerriID = this.GetNextAvailableID(type),
                    PerriTitleEn = "Perri Attia",
                    PerriTitleHe = "פרי אטיה",
                    PerriTextEn  = "test",
                    PerriTextHe  = "ניסוי",
                    LastUpdate   = DateTime.Now,
                    spLastUpdate = DateTime.Now.ToString()
                };
                this.papaDal.StaffPerris.InsertOnSubmit(m);
            }
            break;

        case "staffDudu":
            if (this.GetCount(type) == 0)
            {
                StaffDudu m = new StaffDudu
                {
                    StaffDuduID  = this.GetNextAvailableID(type),
                    DuduTitleEn  = "Dudu Bones",
                    DuduTitleHe  = "דוד 'דודו' בונס",
                    DuduTextEn   = "test",
                    DuduTextHe   = "ניסוי",
                    LastUpdate   = DateTime.Now,
                    spLastUpdate = DateTime.Now.ToString()
                };
                this.papaDal.StaffDudus.InsertOnSubmit(m);
            }
            break;

        case "news":
            StreamReader  newsREn = new StreamReader(@"C:\Works\Papaito\StudioMokeUpUniteDfinal3\DataBaseReceiver\Files\NewsEn.txt");
            StringBuilder newsBEn = new StringBuilder();

            List <string> listEn = new List <string>();
            try
            {
                while (!newsREn.EndOfStream)
                {
                    string m = newsREn.ReadLine();
                    if (m == "%")
                    {
                        listEn.Add(newsBEn.ToString());
                        newsBEn = new StringBuilder();
                    }
                    else
                    {
                        newsBEn.Append(m);
                    }
                }
            }
            finally
            {
                if (newsREn != null)
                {
                    newsREn.Close();
                }
            }


            StreamReader  newsRHe = new StreamReader(@"C:\Works\Papaito\StudioMokeUpUniteDfinal3\DataBaseReceiver\Files\NewsHe.txt");
            StringBuilder newsBHe = new StringBuilder();

            List <string> listHe = new List <string>();
            try
            {
                while (!newsRHe.EndOfStream)
                {
                    UTF8Encoding utf8News = new UTF8Encoding();


                    string m = newsRHe.ReadLine();
                    if (m == "%")
                    {
                        byte[] theTextNews    = utf8News.GetBytes(m);
                        string hebrewTextNews = utf8News.GetString(theTextNews);

                        listHe.Add(hebrewTextNews);
                        newsBHe = new StringBuilder();
                    }
                    else
                    {
                        byte[] theTextNews    = utf8News.GetBytes(m);
                        string hebrewTextNews = utf8News.GetString(theTextNews);

                        newsBHe.Append(hebrewTextNews);
                    }
                }
            }
            finally
            {
                if (newsRHe != null)
                {
                    newsRHe.Close();
                }
            }

            for (int i = 0; i < listHe.Count; i++)
            {
                NewsOb p20 = new NewsOb
                {
                    NewsID       = i.ToString(),
                    NewsEn       = listEn[i],
                    NewsHe       = listHe[i],
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString()
                };
                this.papaDal.NewsObs.InsertOnSubmit(p20);
            }
            break;
        }


        //in this section, all the pics will be created and inserted to the list


        string ID            = "";                                     //thr id of the object
        string path          = "ImagesR/1.jpg";                        //example of pic
        string pathColor     = "ImagesR/4smC.jpg";                     //example of color pic
        string pathBW        = "ImagesR/4smB.jpg";                     //example of black & white pic
        byte   active        = 1;                                      //pic is enabled
        string spActive      = "Enable";                               //pic is enabled
        string artistNameHe  = "מולה ג";                               //example of hebrew artist name
        string artistNameEn  = "Mula j";                               //example of english artist name
        string pathProBig    = "OrImage/proC43big.jpg";                //example of normal pic
        string pathProColor  = "OrImage/proC43.jpg";                   //example of small color pic
        string pathProBW     = "OrImage/proB43.jpg";                   //example of small black and white pic
        string textPublishHe = "שם הפירסום";                           //example of name of the publish pics in hebrew
        string textPublishEn = "Publish Name";                         //example of name of the publish pics in english
        string artistTextEn  = @"Text Text Text Text Text Text Text
                                Text Text Text Text Text Text Text
                                Text Text Text Text Text Text Text ";  //example pf artist Text English
        string artistTextHe  = @"טקסט טקסט טקסט טקסט טקסט טקסט טקסט
                                טקסט טקסט טקסט טקסט טקסט טקסט טקסט
                                טקסט טקסט טקסט טקסט טקסט טקסט טקסט  "; //example pf artist Text English


        for (int i = 0, z = 1; i < 30; i++, z++) //create 10 objects for each list
        {
            ID = i.ToString();

            if (z == 6)
            {
                z = 1;
            }


            //the first case have explenation, same for all

            switch (type)
            {
            case "header":
                HeaderPic p1 = new HeaderPic     //create new object
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.HeaderPics.InsertOnSubmit(p1);     //add the object to the list
                break;

            case "lastRec":
                LastRecordPic p3 = new LastRecordPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPathColor = pathColor,
                    PicPathBW    = pathBW,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.LastRecordPics.InsertOnSubmit(p3);
                break;

            case "roomA":
                RoomAPic p4 = new RoomAPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.RoomAPics.InsertOnSubmit(p4);
                break;

            case "roomB":
                RoomBPic p5 = new RoomBPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.RoomBPics.InsertOnSubmit(p5);
                break;

            case "roomC":
                RoomCPic p6 = new RoomCPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.RoomCPics.InsertOnSubmit(p6);
                break;

            case "complexLookAround":
                ComplexLookAroundPic p7 = new ComplexLookAroundPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.ComplexLookAroundPics.InsertOnSubmit(p7);
                break;

            case "recordingRoom":
                RecordingRoomPic p9 = new RecordingRoomPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPathColor = pathColor,
                    PicPathBW    = pathBW,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.RecordingRoomPics.InsertOnSubmit(p9);
                break;

            case "controlRoom":
                ControlRoomPic p10 = new ControlRoomPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.ControlRoomPics.InsertOnSubmit(p10);
                break;

            case "studioLookAround":
                StudioLookAroundPic p11 = new StudioLookAroundPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.StudioLookAroundPics.InsertOnSubmit(p11);
                break;

            case "designPic":
                DesignPic p13 = new DesignPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.DesignPics.InsertOnSubmit(p13);
                break;

            case "production":
                //same is normal, add the songlist to the new Production object

                Production p14 = new Production
                {
                    Active       = active,
                    ArtistNameHe = artistNameHe,
                    ArtistNameEn = artistNameEn,
                    ArtistTextEn = artistTextEn,
                    ArtistTextHe = artistTextHe,
                    PicPathMain  = pathProBig,
                    PicPathColor = pathProColor,
                    PicPathBW    = pathProBW,
                    ProID        = ID,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.Productions.InsertOnSubmit(p14);
                this.papaDal.SubmitChanges();

                for (int y = 0; y < 3; y++)                          //create 3 songs
                {
                    string songID = this.GetNextAvailableID("song"); //get next available id for song

                    /*this is the the
                    * youtube embed*/
                    string youtube = @"<object width=""320"" height=""265""><param name=""movie"" value=""http://www.youtube.com/v/ECbJdeh1VvA&hlen_US&fs=1&color1=0xe1600f&color2=0xfebd01""></param><param
                                                                name=""allowFullScreen"" value=""true""></param><param name=""allowscriptaccess""value=""always""></param><embed
                                                                src=""http://www.youtube.com/v/ECbJdeh1VvA&hlen_US&fs=1&color1=0xe1600f&color2=0xfebd01"" type=""application/x-shockwave-flash"" allowscriptaccess=""always""
                                                                allowfullscreen=""true""width=""200"" height=""25""></embed></object>";
                    Song   s       = new Song //create new song object
                    {
                        Active       = active,
                        SongID       = songID,
                        SongNameHe   = "זמר זמר" + y,
                        SongNameEn   = "song song" + y,
                        YouTubePath  = youtube,
                        ProIDParent  = ID,
                        UploadTime   = DateTime.Now,
                        spUploadTime = DateTime.Now.ToString(),
                        spActive     = spActive
                    };

                    this.papaDal.Songs.InsertOnSubmit(s);     //add the object to the songlist
                    this.papaDal.SubmitChanges();
                }

                break;

            case "allArtistsGallery":
                if (i < 5)
                {
                    AllArtistGallery p81 = new AllArtistGallery
                    {
                        AllArtistGalleryID = z.ToString(),
                        AllArtistNameEn    = "Gallery " + z.ToString(),
                        AllArtistNameHe    = "גלריה " + z.ToString(),
                        LastUpdate         = DateTime.Now,
                        spLastUpdate       = DateTime.Now.ToString()
                    };
                    this.papaDal.AllArtistGalleries.InsertOnSubmit(p81);
                }
                break;

            case "allArtists":
                AllArtistPic p15 = new AllArtistPic
                {
                    PicID        = ID,
                    PicPath      = path,
                    TextEn       = textPublishEn,
                    TextHe       = textPublishHe,
                    Active       = active,
                    GalleryID    = z.ToString(),
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.AllArtistPics.InsertOnSubmit(p15);
                break;

            case "prPic":
                PrPic p21 = new PrPic
                {
                    Active       = active,
                    PicID        = ID,
                    PicPath      = path,
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.PrPics.InsertOnSubmit(p21);
                break;

            case "publishGallery":
                if (i < 5)
                {
                    PublishGallery p82 = new PublishGallery
                    {
                        PublishGalleryID     = z.ToString(),
                        PublishGalleryNameEn = "Gallery " + z.ToString(),
                        PublishGalleryNameHe = "גלריה " + z.ToString(),
                        LastUpdate           = DateTime.Now,
                        spLastUpdate         = DateTime.Now.ToString()
                    };
                    this.papaDal.PublishGalleries.InsertOnSubmit(p82);
                }
                break;

            case "publish":
                PublishPic p22 = new PublishPic
                {
                    PicID        = ID,
                    PicPath      = path,
                    TextEn       = textPublishEn,
                    TextHe       = textPublishHe,
                    Active       = active,
                    TopPage      = 2,
                    TopPagePlace = 0,
                    GalleryID    = z.ToString(),
                    UploadTime   = DateTime.Now,
                    spUploadTime = DateTime.Now.ToString(),
                    spActive     = spActive
                };
                this.papaDal.PublishPics.InsertOnSubmit(p22);
                break;
            }

            //here it just save the new list with the values in session (DB)

            this.papaDal.SubmitChanges();
        }
    }
示例#7
0
    public string GetNextAvailableID(string type)
    {
        int result = 0;

        if (type == "")
        {
            return("");
        }

        switch (type)
        {
        case "admin":
            AdminUser a1 = null;
            while ((a1 = (AdminUser)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "complexAbout":
            ComplexAbout a2 = null;
            while ((a2 = (ComplexAbout)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "studioAbout":
            StudioAbout a3 = null;
            while ((a3 = (StudioAbout)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "designText":
            DesignText a4 = null;
            while ((a4 = (DesignText)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "prText":
            PrText a5 = null;
            while ((a5 = (PrText)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "mainContact":
            MainContact a6 = null;
            while ((a6 = (MainContact)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "mainAbout":
            MainAbout a7 = null;
            while ((a7 = (MainAbout)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "staffItay":
            StaffItay a8 = null;
            while ((a8 = (StaffItay)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "staffNapo":
            StaffNapo a9 = null;
            while ((a9 = (StaffNapo)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "staffPerri":
            StaffPerri a10 = null;
            while ((a10 = (StaffPerri)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "staffDudu":
            StaffDudu a11 = null;
            while ((a11 = (StaffDudu)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "header":
            HeaderPic a12 = null;
            while ((a12 = (HeaderPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "lastRec":
            LastRecordPic a13 = null;
            while ((a13 = (LastRecordPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "roomA":
            RoomAPic a14 = null;
            while ((a14 = (RoomAPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "roomB":
            RoomBPic a15 = null;
            while ((a15 = (RoomBPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "roomC":
            RoomCPic a16 = null;
            while ((a16 = (RoomCPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "complexLookAround":
            ComplexLookAroundPic a17 = null;
            while ((a17 = (ComplexLookAroundPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "recordingRoom":
            RecordingRoomPic a18 = null;
            while ((a18 = (RecordingRoomPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "controlRoom":
            ControlRoomPic a19 = null;
            while ((a19 = (ControlRoomPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "studioLookAround":
            StudioLookAroundPic a20 = null;
            while ((a20 = (StudioLookAroundPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "designPic":
            DesignPic a21 = null;
            while ((a21 = (DesignPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "production":
            Production a22 = null;
            while ((a22 = (Production)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "song":
            Song a23 = null;
            while ((a23 = (Song)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "allArtists":
            AllArtistPic a24 = null;
            while ((a24 = (AllArtistPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "news":
            NewsOb a25 = null;
            while ((a25 = (NewsOb)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "prPic":
            PrPic a26 = null;
            while ((a26 = (PrPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "publish":
            PublishPic a27 = null;
            while ((a27 = (PublishPic)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "publishGallery":
            PublishGallery a28 = null;
            while ((a28 = (PublishGallery)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        case "allArtistsGallery":
            AllArtistGallery a29 = null;
            while ((a29 = (AllArtistGallery)this.Get(type, result.ToString())) != null)
            {
                result += 1;
            }
            break;

        default:
            break;
        }

        return(result.ToString());
    }