private void btnAdd_Click(object sender, EventArgs e)
        {
            DataRow dr = dt.NewRow();

            dr["Title"]    = txtTitle.Text.Trim();
            dr["Album"]    = txtAlbum.Text.Trim();
            dr["Composer"] = txtComposer.Text.Trim();
            dr["Release"]  = dtpRelease.Value.ToString("yyyy-MM-dd");
            dr["Artist"]   = txtArtist.Text.Trim();
            dr["File"]     = txtFile.Text.Trim();
            dt.Rows.Add(dr);
            dt.AcceptChanges();

            string fileName   = Path.GetFileName(Videofilename);
            string sourcePath = @"C:\Users\v-vijayalakshmi.k\Desktop\vid";
            string targetPath = @"D:\Development\Test\MusicLibrary\MusicLibrary\Video";
            string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
            string destFile   = System.IO.Path.Combine(targetPath, fileName);

            System.IO.Directory.CreateDirectory(targetPath);
            System.IO.File.Copy(sourceFile, destFile, true);

            frmSearch objfrmSearch = new frmSearch();

            objfrmSearch.dt            = dt;
            objfrmSearch.StartPosition = FormStartPosition.CenterParent;
            objfrmSearch.Dock          = DockStyle.Fill;
            objfrmSearch.Show();
        }
Beispiel #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //var role = (from a in ObjLogin where a.UserName == txtUserName.Text.Trim() select new { a.Role });
            var role = (from a in ObjLogin where (a.UserName.ToLower().Contains(txtUserName.Text.Trim().ToLower())) select a).ToList();  // -- Changes On 14/10/2019 by sriram after

            if (IsvalidUser())
            {
                if (Convert.ToString(role[0].Role.ToLower()).Equals("admin"))
                {
                    frmAddorSearchItems objfrmAddorSearchItems = new frmAddorSearchItems();
                    objfrmAddorSearchItems.StartPosition = FormStartPosition.CenterParent;
                    objfrmAddorSearchItems.Dock          = DockStyle.Fill;
                    objfrmAddorSearchItems.Show();
                }
                else
                {
                    frmSearch objfrmSearch = new frmSearch();
                    objfrmSearch.StartPosition = FormStartPosition.CenterParent;
                    objfrmSearch.Dock          = DockStyle.Fill;
                    objfrmSearch.Show();
                }
            }
        }