private int AddData()
        {
            string user_id       = Session["UserId"].ToString();
            string composer_name = txtComposerName.Text;
            string description   = txtDescription.Text;
            string status        = rdlStatus.SelectedValue;

            /*** UPLOAD ************************************************************************************************************/
            string[] FileImg = new String[2];
            string   front_image = string.Empty; string main_image = string.Empty;
            string   front_path = Server.MapPath(upload_front_image_dir);
            string   main_path  = Server.MapPath(upload_main_image_dir);

            if (FileUpload1.HasFile)
            {
                FileHandleClass file_bj = new FileHandleClass();
                FileImg     = file_bj.upload_front_main_image(FileUpload1, front_path, main_path, 120, 120);
                main_image  = FileImg[0];
                front_image = FileImg[1];
                //System.Drawing.Image img1 = System.Drawing.Image.FromFile(front_path+ "/" + front_image);
                imgPhoto.ImageUrl = upload_front_image_dir + "/" + front_image;
            }
            ////========================================================================================================================

            MediaComposers artist_obj = new MediaComposers();
            int            i          = artist_obj.Insert(user_id, composer_name, front_image, main_image, description, status);

            return(i);
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MediaComposers dal = new MediaComposers(StoredData);

            if (!Page.IsPostBack)
            {
                LoadStatus2DDL();
                PageAndBind(GridView1);
            }
        }
Exemple #3
0
        protected void PopulateMediaComposerList2DDL(string selected_value)
        {
            List <Media_Composers> lst = MediaComposers.GetListByStatus("1");

            ddlComposerList.Items.Clear();
            ddlComposerList.DataSource     = lst;
            ddlComposerList.DataTextField  = "ComposerName";
            ddlComposerList.DataValueField = "ComposerId";
            ddlComposerList.DataBind();
            ddlComposerList.SelectedValue = selected_value;
            ddlComposerList.AutoPostBack  = true;
        }
        private void LoadData()
        {
            MediaComposers  artist_obj = new MediaComposers();
            Media_Composers entity     = artist_obj.GetDetails(_idx);

            string FrontImage = entity.FrontImage;
            string MainImage  = entity.MainImage;

            imgPhoto.ImageUrl       = upload_front_image_dir + "/" + FrontImage;
            ViewState["FrontImage"] = FrontImage;
            ViewState["MainImage"]  = MainImage;

            txtComposerName.Text = entity.ComposerName;
            txtDescription.Text  = entity.Description;
            string Status = entity.Status;

            PopulateStatus2DDL(Status);
        }
Exemple #5
0
        private void PageAndBind(GridView gv)
        {
            IList <Object>          list     = new List <Object>();
            int                     pageSize = 3;
            int                     startRow = (gv.PageIndex * pageSize);
            string                  status   = ddlStatus.SelectedValue;
            IList <Media_Composers> data     =
                MediaComposers.LoadDatedItemsByPage(status, startRow, pageSize, GridViewSortBy, GridViewSortAscending);

            //copy data into generic list
            foreach (Media_Composers item in data)
            {
                list.Add(item);
            }
            int count = MediaComposers.LoadDatedItemsCount(); //you could cache this

            //here's the bit where we use create an ODS in code to fill the gridview with paged data
            CommonLibrary.UI.GridView.GridViewFiller.Fill(gv, list, count, pageSize);
        }
        private int UpdateData()
        {
            string user_id       = Session["UserId"].ToString();
            string composer_name = txtComposerName.Text;
            string description   = txtDescription.Text;
            string status        = rdlStatus.SelectedValue;

            /*** UPLOAD ************************************************************************************************************/
            string[] FileImg = new String[2];
            string   front_image = string.Empty; string main_image = string.Empty;
            string   front_path = Server.MapPath(upload_front_image_dir);
            string   main_path  = Server.MapPath(upload_main_image_dir);

            string Orginal_front_image = ViewState["FrontImage"].ToString();
            string Orginal_main_image  = ViewState["MainImage"].ToString();

            //if (FileUpload1.HasFile)
            if (Session["FileUpload1"] != null && Session["FileUpload1"].ToString() != string.Empty)
            {
                FileHandleClass file_bj = new FileHandleClass();
                FileImg     = file_bj.upload_front_main_image(FileUpload1, front_path, main_path, 120, 120);
                main_image  = FileImg[0];
                front_image = FileImg[1];
                //System.Drawing.Image img1 = System.Drawing.Image.FromFile(front_path+ "/" + front_image);
                imgPhoto.ImageUrl = upload_front_image_dir + "/" + front_image;
                string folderchild = Orginal_front_image.Substring(0, 10);
                DeleteFrontImage(Orginal_front_image);
                DeleteMainImage(Orginal_main_image);
            }
            else
            {
                front_image = Orginal_front_image;
                main_image  = Orginal_main_image;
            }
            ////========================================================================================================================


            MediaComposers artist_obj = new MediaComposers();
            int            i          = artist_obj.Update(_idx, user_id, composer_name, front_image, main_image, description, status);

            return(i);
        }
Exemple #7
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridView gv = (GridView)sender;
            //to get index and row
            int rowIndex = e.RowIndex;               //here we have the row directly
            //GridViewRow row = gv.Rows[rowIndex]; //the row
            int key = (int)gv.DataKeys[rowIndex][0]; //int key = Convert.ToInt32(gv.DataKeys[e.RowIndex].Values[0].ToString());
            //int key = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
            string         UserId       = Session["UserId"].ToString();
            string         Status       = "1";
            MediaComposers composer_obj = new MediaComposers();

            composer_obj.UpdateStatus(UserId, key, Status);
            //composer_obj.Delete(key);
            if (rowIndex == 0 && gv.Rows.Count == 1)
            {
                gv.PageIndex = gv.PageIndex - 1; //only 1 item on page- page back
            }
            PageAndBind(gv);                     //load the new information
        }