コード例 #1
0
        private async void button1_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                if (!studentRequirementController.findSame(sno, selectedReqId))
                {
                    string path = CreateDirectory.CreateDir(sno + "-" + name.Split(',')[0]);
                    studentRequirementController.addStudentReq(sno, selectedReqId);
                    auditTrail.addAudit(label7.Text, name + "Submit " + comboBox2.SelectedItem.ToString());

                    string datenow  = DateTime.Now.ToString("yyyy--MM--dd");
                    string timenow  = DateTime.Now.ToString("HH--mm--ss--tt");
                    string combine  = datenow + "--" + timenow;
                    string filename = combine + "--" + selectedReqId + ".jpg";
                    pbAutomated.Image.Save(path + filename);

                    await saveDb(selectedReqId, filename, path);

                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Already has the requirement", "validation", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Complete Required Field", "validation", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private async void save()
        {
            string path = CreateDirectory.CreateDir(StudentModel.getSno() + "-" + StudentModel.getLn());

            foreach (DocsAdding d in panelParam.Controls)
            {
                dicImage.Add(d.ReqId, d.Image);
            }

            foreach (KeyValuePair <int, Image> kp in dicImage)
            {
                string datenow  = DateTime.Now.ToString("yyyy--MM--dd");
                string timenow  = DateTime.Now.ToString("HH--mm--ss--tt");
                string combine  = datenow + "--" + timenow;
                string filename = combine + "--" + kp.Key + ".jpg";
                kp.Value.Save(path + filename);

                await  saveDb(kp.Key, filename, path);
            }
        }