Example #1
0
        private void LoadUser()
        {
            UserHeadForm form = new UserHeadForm("user");

            if (form.ShowDialog() == DialogResult.OK)
            {
                txtUser.Text = GlobalService.SelectedUserHead;
            }
        }
Example #2
0
        private void changeApproverToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UserHeadForm form = new UserHeadForm("user");

            if (form.ShowDialog() == DialogResult.OK)
            {
                switch (MessageBox.Show("Are you sure to change the approver to " + GlobalService.SelectedUserHead + "?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                case DialogResult.Yes:
                    foreach (DataGridViewRow row in dgvForm.SelectedRows)
                    {
                        string status = row.Cells[0].Value.ToString().Trim();
                        string refno  = row.Cells[6].Value.ToString().Trim();

                        string query = status == "係責承認中" ? string.Format("update TB_ACC_OUTSTANDING set o_sect = N'{0}' where o_invoice = '{1}'", GlobalService.SelectedUserHead, refno)
                                : status == "科責承認中" ? string.Format("update TB_ACC_OUTSTANDING set o_div = N'{0}' where o_invoice = '{1}'", GlobalService.SelectedUserHead, refno)
                                : status == "部責承認中" ? string.Format("update TB_ACC_OUTSTANDING set o_dept = N'{0}' where o_invoice = '{1}'", GlobalService.SelectedUserHead, refno) : "";

                        if (query != "")
                        {
                            DataServiceCM.GetInstance().ExecuteNonQuery(query);

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

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

                            string text = "Outstanding Slip 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(refno, GlobalService.User, from, to, body, "Outstanding Slip");
                        }
                    }

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

                    LoadData();
                    break;

                case DialogResult.No:
                    break;
                }
            }
        }