示例#1
0
        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");
            }
        }
示例#2
0
        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");
                }
            }
        }
示例#3
0
        //Project name textBox - END

        private void btnCreateProject_Click_1(object sender, EventArgs e)
        {
            if (txtNewProjectName.Text != "Insert project name" && !String.IsNullOrEmpty(txtNewProjectName.Text))
            {
                string repozFolderPathFull = db.GetRepozPath() + @"\" + db.GetRepozName() + @"\Projects\" + txtNewProjectName.Text;
                if (Directory.Exists(repozFolderPathFull))
                {
                    MessageBox.Show("Folder " + repozFolderPathFull + " already exists");
                }
                else
                {
                    Directory.CreateDirectory(repozFolderPathFull);
                    Directory.CreateDirectory(repozFolderPathFull + @"\Doc");
                    Directory.CreateDirectory(repozFolderPathFull + @"\Temp");
                    Directory.CreateDirectory(repozFolderPathFull + @"\Support");
                    db.SendQueryToDb(@"INSERT INTO t_projects(name, folder, owner) values ('" + txtNewProjectName.Text + "','" + txtNewProjectName.Text + "','" + glob.loggedUser + "'); "); //insert new project in db
                    MessageBox.Show("Created project folder " + repozFolderPathFull);
                }
            }
            else
            {
                MessageBox.Show("Insert name for project");
            }
        }
示例#4
0
        public string GetUsersWorkingFolderPath(string username)
        {
            string WorkingFolderPath = Path.Combine(db.GetRepozPath(), db.GetRepozName(), "Users", username);

            return(WorkingFolderPath);
        }
示例#5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string sqlString       = string.Format(@"SELECT filename FROM t_workingdoc WHERE workinguser LIKE '{0}';", glob.loggedUser); //check if there is notcommited file
            string FileNotCommited = (db.GetSingleLastValue(sqlString, "filename"));

            if (String.IsNullOrEmpty(FileNotCommited))
            {
                string TempFolderPath = db.GetRepozPath() + @"\\" + db.GetRepozName() + @"\\Temp"; //Delete repository temp folder
                sy.ClearFolder(TempFolderPath);
                this.Hide();
                FormLogin FrmLogin = new FormLogin();
                FrmLogin.ShowDialog();
                //this.Close();
            }
            else
            {
                MessageBox.Show("There are documents to be commited before exit");
            }
        }