Beispiel #1
0
        private void btSubmit_Click(object sender, EventArgs e)
        {
            DBlayer dba = new GIM.DBlayer();

            try
            {
                string  DateMonth = cbDate.Text.Split(' ')[1].ToString();
                int     DateDay   = Convert.ToInt32(cbDate.Text.Split(' ')[0]);
                DataSet dsReport  = dba.GetDailyReport(UserID, DateMonth, DateDay);

                DialogResult dResult = MessageBox.Show("Daily report is complete and I want to submit it!", "Are you sure", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);

                if (dResult == DialogResult.Yes)
                {
                    if (dsReport.Tables.Count == 0 || dsReport.Tables[0].Rows.Count == 0)
                    {
                        dba.InsertDailyReport(UserID, tbReportText.Text.Replace("'", "''"), tbReportStat.Text.Replace("'", "''"), DateMonth, DateDay, 1);
                    }
                    else
                    {
                        dba.UpdateDailyReport(UserID, tbReportText.Text.Replace("'", "''"), tbReportStat.Text.Replace("'", "''"), DateMonth, DateDay, 1);
                    }

                    this.Close();
                }
            }
            catch
            {
            }
        }
Beispiel #2
0
        private void btSave_Click(object sender, EventArgs e)
        {
            DBlayer dba = new GIM.DBlayer();

            try
            {
                string  DateMonth = cbDate.Text.Split(' ')[1].ToString();
                int     DateDay   = Convert.ToInt32(cbDate.Text.Split(' ')[0]);
                DataSet dsReport  = dba.GetDailyReport(UserID, DateMonth, DateDay);

                if (dsReport.Tables.Count == 0 || dsReport.Tables[0].Rows.Count == 0)
                {
                    dba.InsertDailyReport(UserID, tbReportText.Text.Replace("'", "''"), tbReportStat.Text.Replace("'", "''"), DateMonth, DateDay, 0);
                }
                else
                {
                    dba.UpdateDailyReport(UserID, tbReportText.Text.Replace("'", "''"), tbReportStat.Text.Replace("'", "''"), DateMonth, DateDay, 0);
                }
            }
            catch
            {
            }
        }