Ejemplo n.º 1
0
 private void UpdateGrid(ClipOFF clip)
 {
     dgrClipDefault["colClipName",currentRow].Value = clip.ClipName;
     dgrClipDefault["colPlayStatus",currentRow].Value= clip.ClipPlayStatus;
     dgrClipDefault["colClipFile",currentRow].Value = clip.ClipFile;
     dgrClipDefault["colClipPath",currentRow].Value = clip.ClipPath;
 }
Ejemplo n.º 2
0
 private void cmdUpdate_Click(object sender, EventArgs e)
 {
     if(MsgBoxVN.ShowDlgMsg("Bạn chắc sẽ cập nhật danh mục này ?",IconStyle.Question,new string[]{"&Có","&Không"},"Cảnh báo",1)== 1)
         return;
     if(!ValidateFile())
         return;
     ClipOFF update = new ClipOFF();
     update.ClipID = clipId;
     update.ClipName = txtClipName.Text;
     update.ClipPlayStatus = chkPlayStatus.Checked?(byte)1:(byte)0;
     update.ClipPath = txtClipPath.Text;
     string ext = txtClipPath.Text.Substring(txtClipPath.Text.LastIndexOf('.')+1,3);
     string name_file = GetFileName(txtClipPath.Text);
     update.ClipFile = name_file+"."+ext;
     try
     {
         string newPath = Properties.Settings.Default.DefaultClipPath+"\\"+update.ClipFile;
         CopyFile(txtClipPath.Text,newPath);
         update.ClipPath = newPath;
         update.Update();
         UpdateGrid(update);
     }
     catch (Exception exp)
     {
         MsgBoxVN.ShowError("Có lỗi khi cập nhật dữ liệu \n"+exp.Message,Dic.STRING_ERROR);
     }
 }
Ejemplo n.º 3
0
 private void cmdDelete_Click(object sender, EventArgs e)
 {
     if(currentRow<=-1)
         return;
       if(MsgBoxVN.ShowDlgMsg("Bạn chắc sẽ xóa danh mục này ?",IconStyle.Question,new string[]{"&Có","&Không"},"Cảnh báo",1)== 1)
         return;
     ClipOFF delete = new ClipOFF();
     delete.ClipID = clipId;
     try
     {
         delete.Delete();
         dgrClipDefault.Rows.RemoveAt(currentRow);
     }
     catch (Exception exp)
     {
         MsgBoxVN.ShowError("Có lỗi khi xóa dữ liệu \n"+exp.Message,Dic.STRING_ERROR);
     }
 }
Ejemplo n.º 4
0
        private void cmdNew_Click(object sender, EventArgs e)
        {
            if(!flgNew)
            {
                // Clear text
                txtClipName.Clear();
                txtClipFile.Clear();
                txtClipPath.Clear();
                cmdNew.Text="&Lưu";
                cmdUpdate.Visible=false;
                cmdDelete.Visible=false;
                flgNew=true;
                return;
            }
            else
            {
                if(!ValidateFile())
                    return;
                string clipFile="";
                string clipName = txtClipName.Text;
                string clipPath=txtClipPath.Text;
                byte clipPlayStatus = chkPlayStatus.Checked?(byte)1:(byte)0;
                string ext = clipPath.Substring(clipPath.LastIndexOf('.')+1,3);
                string name_file = GetFileName(txtClipPath.Text);
                ClipOFF clip = new ClipOFF(clipName,clipPlayStatus,clipFile,clipPath);
                txtClipFile.Text= name_file+"."+ext;
                clip.ClipFile = txtClipFile.Text;

                // Copy file
                string newPath = AppDomain.CurrentDomain.BaseDirectory + "defaultclip\\" + txtClipFile.Text;
                CopyFile(txtClipPath.Text,newPath);
                // end copy file
                clip.ClipFile = newPath;
                clip.Add();
                cmdNew.Text="&Thêm";
                cmdUpdate.Visible=true;
                cmdDelete.Visible=true;
                flgNew=false;
                AddGrid(clip);
                MsgBoxVN.ShowInfor("Đã thêm clip vào danh mục","Thông báo");
            }
        }
Ejemplo n.º 5
0
 private void AddGrid(ClipOFF clip)
 {
     DataRow newRow = ds.Tables[0].NewRow();
     newRow["STT"] = dgrClipDefault.RowCount+1;
     newRow["ID_CLIP"] = clip.ClipID;
     newRow["CLIP_NAME"] = txtClipName.Text;
     newRow["CLIP_PLAY_STATUS"] = chkPlayStatus.Checked;
     newRow["CLIP_FILE"] = txtClipFile.Text;
     newRow["CLIP_PATH"] = txtClipPath.Text;
     ds.Tables[0].Rows.InsertAt(newRow,dgrClipDefault.RowCount+1);
 }