示例#1
0
        private void SaveData()
        {
            string applicant  = GlobalService.User;
            string category   = cbType.SelectedItem.ToString().Trim();
            string type       = cbR3Type.SelectedItem.ToString().Trim();
            string title      = "R3申請 - " + category + type;
            string r3id       = txtR3Id.Text.Trim();
            string request    = txtRequest.Text.Trim();
            string reason     = txtReason.Text.Trim();
            string start      = dtpStart.Value.ToString("yyyy/MM/dd");
            string attachment = txtAttachment.Text.Trim() != "" ? txtAttachment.Text.Trim() : "";
            string approver   = txtHead.Text.Trim();

            string cmApprover = GlobalService.User; //"Hara Masatoshi(原雅俊)";
            string itApprover = GlobalService.User; //"Chan Fai Lung(陳輝龍,Onyx)";

            string chaseno = GetLatestChaseno();

            string filePath = "";

            if (attachment != "")
            {
                string filename  = Path.GetFileName(attachment);
                string directory = @"\\kdthk-dm1\project\kdthk-dm\Forms\R3 Application\" + GlobalService.User + @"\";

                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                File.Copy(attachment, directory + filename, true);

                filePath = directory + filename;
            }

            string query = string.Format("insert into TB_FORM_R3 (r_applicant, r_title, r_category, r_type, r_r3id, r_request, r_reason" +
                                         ", r_start, r_attachment, r_approver, r_cmapprover, r_itapprover, r_created, r_chaseno) values (N'{0}', N'{1}', N'{2}', '{3}', N'{4}', N'{5}', N'{6}', '{7}', N'{8}', N'{9}', N'{10}', N'{11}', '{12}', '{13}')",
                                         applicant, title, category, type, r3id, request, reason, start, filePath, approver, cmApprover, itApprover, DateTime.Today.ToString("yyyy/MM/dd"), chaseno);

            DataService.GetInstance().ExecuteNonQuery(query);

            string from = AdUtil.GetEmailByUserId(AdUtil.GetUserIdByUsername(GlobalService.User, "kmhk.local"), "kmhk.local");

            string to = AdUtil.GetEmailByUserId(AdUtil.GetUserIdByUsername(approver, "kmhk.local"), "kmhk.local");

            string text = "IT Application Approval required. Please click <a href=\"\\\\kdthk-dm1\\project\\it system\\MyCloud Beta\\KDTHK-DM-SP.application\">HERE</a> to approval process.";
            string body = "<p><span style=\"font-family: Calibri;\">" + text + "</span></p>";

            EformUtil.SendApprovalEmail(chaseno, GlobalService.User, from, to, body, title);

            DialogResult = DialogResult.OK;
        }
示例#2
0
        private void SaveData()
        {
            string staffId = AdUtil.GetUserIdByUsername(GlobalService.User, "kmhk.local").Replace("hk", "");

            string datetime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            string originalPwd = GetOriginalPassword(staffId);

            string insertText = string.Format("insert into TB_HR_PWD_LOG (pl_datetime, pl_staff, pl_old, pl_new) values ('{0}', N'{1}', '{2}', '{3}')", datetime, GlobalService.User, originalPwd, txtPassword.Text);

            DataServiceHR.GetInstance().ExecuteNonQuery(insertText);

            string updateText = string.Format("update TB_HR_PWD set p_password = '******' where p_staffid = '{1}'", txtPassword.Text, staffId);

            DataServiceHR.GetInstance().ExecuteNonQuery(updateText);

            DialogResult = DialogResult.OK;
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string createdby = txtUser.Text.Trim();
            string created   = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            string department = txtDepartment.Text.Trim();

            string china    = ckbChina.Checked ? "Yes" : "No";
            string taiwan   = ckbTaiwan.Checked ? "Yes" : "No";
            string india    = ckbIndia.Checked ? "Yes" : "No";
            string czech    = ckbCzech.Checked ? "Yes" : "No";
            string usa      = ckbUsa.Checked ? "Yes" : "No";
            string vietnam1 = ckbVietnam1.Checked ? "Yes" : "No";
            string vietnam2 = ckbVietnam2.Checked ? "Yes" : "No";
            string others   = txtOthers.Text.Trim();

            string date   = dtpDate.Value.ToString("yyyy/MM/dd");
            string reason = txtReason.Text.Trim();

            string sectHead = UserUtil.GetSectionHead(UserUtil.GetSect(GlobalService.User));
            string divHead  = UserUtil.GetDivisionHead(UserUtil.GetDivision(GlobalService.User));

            string adm1st = "Sammy Chow Chi To (周志滔)";
            string adm2nd = "Sammy Chow Chi To (周志滔)";

            string query = string.Format("insert into TB_ADM_FORM_VISA (av_createdby, av_created, av_department, av_china, av_taiwan, av_india, av_czech" +
                                         ", av_usa, av_vietnam1, av_vietnam2, av_others, av_indate, av_reason, av_sect, av_div, av_adm1st, av_adm2nd) values (N'{0}', '{1}', N'{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', N'{10}', '{11}', N'{12}', N'{13}', N'{14}', N'{15}', N'{16}')",
                                         createdby, created, department, china, taiwan, india, czech, usa, vietnam1, vietnam2, others, date, reason, sectHead, divHead, adm1st, adm2nd);

            DataServiceCM.GetInstance().ExecuteNonQuery(query);

            string from = AdUtil.GetEmailByUserId(AdUtil.GetUserIdByUsername(GlobalService.User, "kmhk.local"), "kmhk.local");

            string to = AdUtil.GetEmailByUserId(AdUtil.GetUserIdByUsername(sectHead, "kmhk.local"), "kmhk.local");

            string text = "Application Approval required. Please click <a href=\"\\\\kdthk-dm1\\project\\it system\\MyCloud Beta\\KDTHK-DM-SP.application\">HERE</a> to approval process.";
            string body = "<p><span style=\"font-family: Calibri;\">" + text + "</span></p>";

            EformUtil.SendApprovalEmail("", GlobalService.User, from, to, body, "Approval Required - 簽証申請");

            MessageBox.Show("Record has been saved.");

            DialogResult = DialogResult.OK;
        }
示例#4
0
        private void finishedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dgvTotal.SelectedRows)
            {
                string status = row.Cells[4].Value.ToString().Trim();

                if (status != "Processing")
                {
                    continue;
                }

                string requester = row.Cells[1].Value.ToString().Trim();
                string tableName = "TB_" + AdUtil.GetUserIdByUsername(requester, "kmhk.local");
                string path      = row.Cells[3].Value.ToString().Trim();
                string pathCopy  = row.Cells[6].Value.ToString().Trim();

                string newPath = path.Contains("'") ? path.Replace("'", "''") : path;

                using (var impersonation = new ImpersonatedUser("itadmin", "kmhk.local", "Ed@a*9kj"))
                {
                    if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                    if (File.Exists(pathCopy))
                    {
                        File.Delete(pathCopy);
                    }
                }

                string query = string.Format("update TB_DISC_REQUEST set d_status = 'Finished', d_finished = 'True', d_finishdatetime = '{1}', d_finishedby = N'{2}' where d_path = N'{0}'", newPath, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), GlobalService.User);
                DataService.GetInstance().ExecuteNonQuery(query);

                string text = string.Format("update " + tableName + " set r_disc = 'True' where r_path = N'{0}'", newPath);
                DataService.GetInstance().ExecuteNonQuery(text);
            }

            MessageBox.Show("Record has been saved.");

            LoadData(txtFilename.Text, txtUser.Text, cbStatus.SelectedItem.ToString());
        }
示例#5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string sectHead = UserUtil.GetSectionHead(UserUtil.GetSect(GlobalService.User));
            string divHead  = UserUtil.GetDivisionHead(UserUtil.GetDivision(GlobalService.User));
            //string deptHead = "Ho Kin Hang(何健恒,Ken)";// UserUtil.GetDepartmentHead(UserUtil.GetDept(GlobalService.User));

            string adm1st = "Sammy Chow Chi To (周志滔)";
            string adm2nd = "Sammy Chow Chi To (周志滔)";
            //string adm3rd = "Ho Kin Hang(何健恒,Ken)";//"Sammy Chow Chi To (周志滔)";

            string createdby = txtUser.Text.Trim();
            string created   = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            string department = txtDepartment.Text.Trim();

            string fee = txtFee.Text.Trim();

            string deptShared1 = txtDeptShared1.Text.Trim();
            string deptShared2 = txtDeptShared2.Text.Trim();

            string content = rtbContent.Text.Trim();

            string query = string.Format("insert into TB_ADM_FORM_REPAIR (ar_created, ar_createdby, ar_department, ar_fee, ar_deptshared1, ar_deptshared2" +
                                         ", ar_content, ar_sect, ar_div, ar_adm1st, ar_adm2nd) values ('{0}', N'{1}', N'{2}', '{3}', N'{4}', N'{5}', N'{6}', N'{7}', N'{8}', N'{9}', N'{10}')", created, createdby, department, fee,
                                         deptShared1, deptShared2, content, sectHead, divHead, adm1st, adm2nd);

            DataServiceCM.GetInstance().ExecuteNonQuery(query);

            string from = AdUtil.GetEmailByUserId(AdUtil.GetUserIdByUsername(GlobalService.User, "kmhk.local"), "kmhk.local");

            string to = AdUtil.GetEmailByUserId(AdUtil.GetUserIdByUsername(sectHead, "kmhk.local"), "kmhk.local");

            string text = "Application Approval required. Please click <a href=\"\\\\kdthk-dm1\\project\\it system\\MyCloud Beta\\KDTHK-DM-SP.application\">HERE</a> to approval process.";
            string body = "<p><span style=\"font-family: Calibri;\">" + text + "</span></p>";

            EformUtil.SendApprovalEmail("", GlobalService.User, from, to, body, "Approval Required - 業務/修理依賴");

            MessageBox.Show("Record has been saved.");

            DialogResult = DialogResult.OK;
        }