private void btnSendReq_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtSubject.Text) && !string.IsNullOrEmpty(richTxtIssue.Text)) { string issueDir = txtSubject.Text; string supportFoledrPath = Path.Combine(db.GetRepozPath(), db.GetRepozName(), "Projects", glob.ProjectName, "Support", issueDir); //Create dir in support dir, with name form txtBox if (!Directory.Exists(supportFoledrPath)) { Directory.CreateDirectory(supportFoledrPath); //Create dir if not exists, but below file writes on every btn click - overwrite exsiting file(if created) } string supportFilePath = Path.Combine(db.GetRepozPath(), db.GetRepozName(), "Projects", glob.ProjectName, "Support", issueDir, "IssueDescription.rtf"); TextWriter twr = new StreamWriter(supportFilePath); twr.Write(richTxtIssue.Text); twr.Close(); //insert support request details in t_support string sqlString = string.Format(@"INSERT INTO t_support (subject,project,usersent) values ('{0}', '{1}', '{2}');", txtSubject.Text, glob.ProjectName, glob.loggedUser); db.SendQueryToDb(sqlString); MessageBox.Show("Support request for project " + glob.ProjectName + " has been generated"); //reset elements on form richTxtIssue.Text = null; txtSubject.Text = null; richTextMsgToUser.Text = null; } else { MessageBox.Show("No subject enered and/or no description text"); } }
private void FormSettings_Load(object sender, EventArgs e) { this.ControlBox = false; this.Text = "Repository Settings"; string repozFolderName = null; repozFolderName = db.GetRepozName(); if (repozFolderName == "No repository loaded") { txtRepozName.Enabled = true; btnSelectFolder.Enabled = true; } else { txtRepozName.Enabled = false; btnSelectFolder.Enabled = false; } db.LoadCombo(comboTeamMemberRole, "name", @"SELECT name FROM t_role"); listViewUsers.Items.Clear(); string sqlString = string.Format(@"SELECT DISTINCT * FROM t_members"); //Load list of all users db.LoadVeiwListUsers(listViewUsers, sqlString); }
private void btnAddDoc_Click(object sender, EventArgs e) //Add new file in project folder { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { string sourceFullPath = ofd.FileName; //full path string sourceFile = ofd.SafeFileName; //file name string path = sourceFullPath.Replace(sourceFile, ""); //folder path string projPath = db.GetRepozPath() + @"\\" + db.GetRepozName() + @"\\Projects\\" + glob.ProjectName + @"\\Doc"; string targetFile = projPath + @"\\" + sourceFile; if (!sy.FindInColumn(sourceFile, "filename", "t_doc")) { if (!File.Exists(targetFile)) { File.Copy(sourceFullPath, Path.Combine(projPath, ofd.SafeFileName)); //Copy selected file to project folder string sqlString = null; // New file entry in db sqlString = string.Format(@"INSERT INTO t_doc (filename,project,owner,commituser,locked,rev) values ('{0}', '{1}', '{2}', '{2}', 0, 0 );", sourceFile, glob.ProjectName, glob.loggedUser); db.SendQueryToDb(sqlString); listBoxDoc.Items.Clear(); //Clear document list, and reload form db sqlString = string.Format(@"SELECT filename FROM t_doc WHERE project like'{0}';", glob.ProjectName); db.LoadTextList(listBoxDoc, "filename", sqlString); } else { MessageBox.Show("File already exists in project folder"); } } else { MessageBox.Show("File with this name is already added in this(or another) project"); } } }
private void FormProjectSettings_Load(object sender, EventArgs e) { this.Text = "Project settings"; string sqlString = null; Baza db = new Baza(); labRepozName.Text = db.GetRepozName(); labLoggedUser.Text = glob.loggedUser; labProjName.Text = glob.ProjectName; sqlString = @"SELECT username FROM t_members;"; db.LoadCombo(comboUsers, "username", sqlString); listProjectTeam.Items.Clear(); sqlString = string.Format(@"SELECT username FROM t_team WHERE project like'{0}';", glob.ProjectName); db.LoadTextList(listProjectTeam, "username", sqlString); sqlString = string.Format(@"SELECT filename FROM t_doc WHERE project like'{0}';", glob.ProjectName); db.LoadTextList(listBoxDoc, "filename", sqlString); }
private void btnSettings_Click(object sender, EventArgs e) { FormSettings FrmSet = new FormSettings(); this.Hide(); FrmSet.ShowDialog(); this.Show(); //Refresh does not work, so....manualy :) Baza db = new Baza(); labRepozName.Text = db.GetRepozName(); //show repository name in label on the form(if repository is created and in t_repoz table). labProjName.Text = glob.ProjectName; db.GetProjectsInCombo(comboProjects); if (!String.IsNullOrEmpty(glob.ProjectName)) { comboProjects.Text = glob.ProjectName; } }
private void btnProjSet_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(glob.ProjectName) && glob.passLevel > 8) { FormProjectSettings FrmProjSet = new FormProjectSettings(); FrmProjSet.ShowDialog(); //Refresh does not work, so....manualy :) Baza db = new Baza(); labRepozName.Text = db.GetRepozName(); //show repository name in label on the form(if repository is created and in t_repoz table). labProjName.Text = glob.ProjectName; db.GetProjectsInCombo(comboProjects); listViewProjDoc.Items.Clear(); //Clear list, and load all file names from db (Query is hardcoded) db.LoadVeiwListProjectDocuments(listViewProjDoc); } else { MessageBox.Show("No active project or access level < 9"); } }
public string GetUsersWorkingFolderPath(string username) { string WorkingFolderPath = Path.Combine(db.GetRepozPath(), db.GetRepozName(), "Users", username); return(WorkingFolderPath); }
public FormStart() { InitializeComponent(); labRepozName.Text = db.GetRepozName(); //show repository name in label on the form(if repository is created and in t_repoz table). labLoggedUser.Text = glob.loggedUser; labRole.Text = glob.role; labLevel.Text = Convert.ToString(glob.passLevel); db.GetProjectsInCombo(comboProjects); labProjName.Text = glob.ProjectName; }