Esempio n. 1
0
    public bool Insert_Album_Genere_save(tbl_Album_Genere objAlbumSave, SqlTransaction trans, SqlConnection cn)
    {
        bool    flag    = false;
        DataSet dataSet = new DataSet();
        string  strQuer = "";

        strQuer = "set dateformat dmy; insert into tbl_Album_Genere([AlbumGenere_Album_Id],[AlbumGenere_Genere_id],[AlbumGenere_AddedBy],[AlbumGenere_AddedOn],[AlbumGenere_Status]) values ('" + objAlbumSave.AlbumGenere_Album_Id + "','" + objAlbumSave.AlbumGenere_Genere_id + "','" + objAlbumSave.AlbumGenere_AddedBy + "', getdate(),'" + objAlbumSave.AlbumGenere_Status + "' );select @@Identity";
        int ret_type = 0;

        if (trans == null)
        {
            try
            {
                dataSet = ExecuteSelectQuery(strQuer);
                flag    = true;
            }
            catch (Exception ee)
            {
                ret_type = 0;
                flag     = false;
            }
        }
        else
        {
            dataSet = ExecuteSelectQuerywithTransaction(cn, strQuer, trans);
            flag    = true;
        }
        return(flag);
    }
Esempio n. 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtAlbumName.Text.Trim() == "")
        {
            txtAlbumName.Focus();
            return;
        }
        if (txtDescription.Text.Trim() == "")
        {
            txtDescription.Focus();
            return;
        }
        if (ddlMountingRating.Text.Trim() == "")
        {
            ddlMountingRating.Focus();
        }
        if (ddlStudio.SelectedValue == "0")
        {
            ddlStudio.Focus();
            return;
        }
        if (ddlCategory.SelectedValue == "0")
        {
            ddlCategory.Focus();
            return;
        }

        tbl_Album_Save objAlbumSave = new tbl_Album_Save();

        try
        {
            objAlbumSave.Album_Id = Convert.ToInt32(hf_AlbumId.Value);
        }
        catch
        {
            objAlbumSave.Album_Id = 0;
        }
        List <tbl_Upload_Banner>    obj_tbl_Upload_BannerLi  = new List <tbl_Upload_Banner>();
        Dictionary <string, byte[]> file_Upload_Array_Banner = new Dictionary <string, byte[]>();

        if (Session["FileUpload1"] != null)
        {
            file_Upload_Array_Banner = (Dictionary <string, byte[]>)Session["FileUpload1"];
            foreach (KeyValuePair <string, byte[]> item in file_Upload_Array_Banner)
            {
                if (item.Value != null)
                {
                    tbl_Upload_Banner obj_tbl_Upload_Banner = new tbl_Upload_Banner();
                    obj_tbl_Upload_Banner.AlbumUpload_Status     = 1;
                    obj_tbl_Upload_Banner.AlbumUpload_Type       = "B";
                    obj_tbl_Upload_Banner.AlbumUpload_File_Bytes = item.Value;
                    obj_tbl_Upload_Banner.AlbumUpload_Path       = item.Key;
                    obj_tbl_Upload_BannerLi.Add(obj_tbl_Upload_Banner);
                }
            }
        }
        else
        {
            file_Upload_Array_Banner = null;
        }

        Dictionary <string, byte[]> file_Upload_Array_Video = new Dictionary <string, byte[]>();

        if (Session["FileUpload2"] != null)
        {
            file_Upload_Array_Video = (Dictionary <string, byte[]>)Session["FileUpload2"];
            foreach (KeyValuePair <string, byte[]> item in file_Upload_Array_Video)
            {
                if (item.Value != null)
                {
                    tbl_Upload_Banner obj_tbl_Upload_Banner = new tbl_Upload_Banner();
                    obj_tbl_Upload_Banner.AlbumUpload_Status     = 1;
                    obj_tbl_Upload_Banner.AlbumUpload_Type       = "V";
                    obj_tbl_Upload_Banner.AlbumUpload_File_Bytes = item.Value;
                    obj_tbl_Upload_Banner.AlbumUpload_Path       = item.Key;
                    obj_tbl_Upload_BannerLi.Add(obj_tbl_Upload_Banner);
                }
            }
        }
        else
        {
            file_Upload_Array_Video = null;
        }
        if (file_Upload_Array_Banner == null || file_Upload_Array_Banner.Count == 0)
        {
            MessageBox.Show("Please Upload Album Banner.");
            return;
        }
        if (file_Upload_Array_Video == null || file_Upload_Array_Video.Count == 0)
        {
            MessageBox.Show("Please Upload Trailer Video.");
            return;
        }
        objAlbumSave.Album_Name            = txtAlbumName.Text.Trim();
        objAlbumSave.Album_Description     = txtDescription.Text.Trim();
        objAlbumSave.Album_Rating          = Rating1.CurrentRating;
        objAlbumSave.Album_Mounting_Rating = ddlMountingRating.Text.Trim();
        objAlbumSave.Album_Studio_Id       = Convert.ToInt32(ddlStudio.SelectedValue);
        objAlbumSave.Album_Category        = Convert.ToInt32(ddlCategory.SelectedValue);
        objAlbumSave.Album_AddedBy         = Convert.ToInt32(Session["Person_Id"].ToString());
        objAlbumSave.Album_Status          = 1;
        List <tbl_Album_Staff> obj_tbl_Album_Staff_Li = new List <tbl_Album_Staff>();

        for (int i = 0; i < lbStarring.Items.Count; i++)
        {
            if (lbStarring.Items[i].Selected)
            {
                tbl_Album_Staff obj_tbl_Album_Staff = new tbl_Album_Staff();
                obj_tbl_Album_Staff.AlbumStaff_AddedBy     = Convert.ToInt32(Session["Person_Id"].ToString());
                obj_tbl_Album_Staff.AlbumStaff_Starring_id = Convert.ToInt32(lbStarring.Items[i].Value);
                obj_tbl_Album_Staff.AlbumStaff_Status      = 1;
                obj_tbl_Album_Staff_Li.Add(obj_tbl_Album_Staff);
            }
        }
        for (int i = 0; i < lbDirector.Items.Count; i++)
        {
            if (lbDirector.Items[i].Selected)
            {
                tbl_Album_Staff obj_tbl_Album_Staff = new tbl_Album_Staff();
                obj_tbl_Album_Staff.AlbumStaff_AddedBy     = Convert.ToInt32(Session["Person_Id"].ToString());
                obj_tbl_Album_Staff.AlbumStaff_Starring_id = Convert.ToInt32(lbDirector.Items[i].Value);
                obj_tbl_Album_Staff.AlbumStaff_Status      = 1;
                obj_tbl_Album_Staff_Li.Add(obj_tbl_Album_Staff);
            }
        }
        for (int i = 0; i < lbSupportingActor.Items.Count; i++)
        {
            if (lbSupportingActor.Items[i].Selected)
            {
                tbl_Album_Staff obj_tbl_Album_Staff = new tbl_Album_Staff();
                obj_tbl_Album_Staff.AlbumStaff_AddedBy     = Convert.ToInt32(Session["Person_Id"].ToString());
                obj_tbl_Album_Staff.AlbumStaff_Starring_id = Convert.ToInt32(lbSupportingActor.Items[i].Value);
                obj_tbl_Album_Staff.AlbumStaff_Status      = 1;
                obj_tbl_Album_Staff_Li.Add(obj_tbl_Album_Staff);
            }
        }
        List <tbl_Album_Genere> obj_tbl_Album_Genere_Li = new List <tbl_Album_Genere>();

        for (int i = 0; i < lbGenere.Items.Count; i++)
        {
            if (lbGenere.Items[i].Selected)
            {
                tbl_Album_Genere obj_tbl_Album_Genere = new tbl_Album_Genere();
                obj_tbl_Album_Genere.AlbumGenere_AddedBy   = Convert.ToInt32(Session["Person_Id"].ToString());
                obj_tbl_Album_Genere.AlbumGenere_Genere_id = Convert.ToInt32(lbGenere.Items[i].Value);
                obj_tbl_Album_Genere.AlbumGenere_Status    = 1;
                obj_tbl_Album_Genere_Li.Add(obj_tbl_Album_Genere);
            }
        }

        if (new DataLayer().Insert_Album(objAlbumSave, obj_tbl_Album_Staff_Li, obj_tbl_Album_Genere_Li, obj_tbl_Upload_BannerLi))
        {
            MessageBox.Show("Created Successfully");
            reset();
        }
        else
        {
            MessageBox.Show("Error");
        }
    }