コード例 #1
0
 public DBExporterGeneral()
 {
     if (!Directory.Exists(GlobalVariables.DBExportPath))
     {
         Directory.CreateDirectory(GlobalVariables.DBExportPath);
     }
     _dbRelated = new DBRelated();
 }
コード例 #2
0
        protected void createButton_Click(object sender, EventArgs e)
        {
            try
            {
                CultureInfo provider = CultureInfo.InvariantCulture;
                string      drop     = DropDownList2.SelectedValue;
                string      id       = empIdText.Text;
                long        sss      = Convert.ToInt64(sssText.Text);
                long        tin      = Convert.ToInt64(tinText.Text);

                string dateEmp  = DateTime.ParseExact(dateEmployedText.Text, "MM/dd/yyyy", provider).ToShortDateString();
                string from     = DateTime.ParseExact(fromText.Text, "MM/dd/yyyy", provider).ToShortDateString();
                string to       = DateTime.ParseExact(toText.Text, "MM/dd/yyyy", provider).ToShortDateString();
                string fName    = firstNameText.Text;
                string MName    = middleNameText.Text;
                string lName    = lastNameText.Text;
                string bdate    = DateTime.ParseExact(birthdayText.Text, "MM/dd/yyyy", provider).ToShortDateString();
                string name     = emergencyName.Text;
                long   contact  = Convert.ToInt64(emergencyContact.Text);
                string address  = emergencyAddress.Text;
                string Uname    = userNameText.Text;
                string email    = emailText.Text;
                string password = passwordText.Text;
                string confirm  = confirmPassText.Text;
                if (password != confirm)
                {
                    MessageBox.Show("Passwords not match.");
                }
                DBRelated db = new DBRelated();
                db.DbInsert(id, fName, MName, lName, bdate, name, address, contact, drop, sss,
                            tin, dateEmp, from, to, 0, Uname, email, password, 0);
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred." + ex.Message);
                Response.Redirect("/Information.aspx");
            }
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record Inserted Successfully')", true);
            Response.Redirect("/Maintenance.aspx");
        }