Ejemplo n.º 1
0
        private void btn_AddUser_Click(object sender, EventArgs e)
        {
            MyUser myUser = new MyUser();
            bool   ok     = true;

            errP.Clear();

            try
            {
                myUser.UserID = Convert.ToInt32(lbl_UserNoText.Text.Trim());
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(lbl_UserNoText, MyEx.tostring());
            }

            try
            {
                myUser.Username = txt_Username.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_Username, MyEx.tostring());
            }

            try
            {
                myUser.UserForename = txt_UserForename.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_UserForename, MyEx.tostring());
            }

            try
            {
                myUser.UserSurname = txt_UserSurname.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_UserSurname, MyEx.tostring());
            }

            try
            {
                myUser.UserLevel = txt_UserLevel.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_UserLevel, MyEx.tostring());
            }

            try
            {
                myUser.UserPassword = txt_UserPass.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_UserPass, MyEx.tostring());
            }

            try
            {
                myUser.UserEmail = txt_UserEmail.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_UserEmail, MyEx.tostring());
            }

            try
            {
                if (chk_Super.Checked)
                {
                    myUser.Super = "Y";
                }
                else
                {
                    myUser.Super = "N";
                }
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(chk_Super, MyEx.tostring());
            }

            try
            {
                if (ok)
                {
                    drUser                 = dsNWRC_HairBeauty.Tables["UserLogin"].NewRow();
                    drUser["UserID"]       = myUser.UserID;
                    drUser["Username"]     = myUser.Username;
                    drUser["UserSurname"]  = myUser.UserSurname;
                    drUser["UserForename"] = myUser.UserForename;
                    drUser["UserEmail"]    = myUser.UserEmail;
                    drUser["UserLevel"]    = myUser.UserLevel;
                    drUser["Passkey"]      = myUser.UserPassword;
                    drUser["Super"]        = myUser.Super;


                    dsNWRC_HairBeauty.Tables["UserLogin"].Rows.Add(drUser);
                    daUser.Update(dsNWRC_HairBeauty, "UserLogin");

                    MessageBox.Show("New User " + lbl_UserNoText.Text + " added !!!");

                    if (MessageBox.Show("Do you wish to add another User?", "Add User", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        clearAddForm();
                        getNumber(dsNWRC_HairBeauty.Tables["UserLogin"].Rows.Count);
                    }
                    else
                    {
                        tab_User.SelectedIndex = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.TargetSite + "" + ex.Message, "Error!", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void btn_Multibook_Click(object sender, EventArgs e)
        {
            if (lbl_ClientNoTextBook.Text != "")
            {
                drclient = dsNWRC_HairBeauty.Tables["Client"].Rows.Find(lbl_ClientNoTextBook.Text);

                if (btn_Multibook.Text == "Edit Client")
                {
                    //enable Form Entries
                    formEnable(true);
                    btn_CancelBook.Visible = true;
                    btn_Multibook.Text     = "Save Client";
                }
                else
                {
                    MyClient myClient = new MyClient();
                    bool     ok       = true;
                    errP.Clear();

                    try
                    { myClient.ClientNo = Convert.ToInt32(lbl_ClientNoTextBook.Text.Trim()); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(lbl_ClientNoTextBook, MyEx.ToString());
                    }

                    try
                    { myClient.Title = cmb_TitleBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(cmb_TitleBook, MyEx.tostring());
                    }

                    try
                    { myClient.Surname = txt_SurnameBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(txt_SurnameBook, MyEx.tostring());
                    }

                    try
                    { myClient.Forename = txt_ForenameBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(txt_ForenameBook, MyEx.tostring());
                    }

                    try
                    { myClient.Street = rt_StreetBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(rt_StreetBook, MyEx.tostring());
                    }

                    try
                    { myClient.Town = txt_TownBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(txt_TownBook, MyEx.tostring());
                    }

                    try
                    { myClient.County = txt_CountyBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(txt_CountyBook, MyEx.tostring());
                    }

                    try
                    { myClient.Postcode = txt_PostcodeBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(txt_PostcodeBook, MyEx.tostring());
                    }

                    try
                    { myClient.Country = txt_CountryBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(txt_CountryBook, MyEx.tostring());
                    }

                    try
                    { myClient.TelNo = txt_TelephoneBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(txt_TelephoneBook, MyEx.tostring());
                    }

                    try
                    { myClient.Email = txt_EmailBook.Text.Trim(); }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(txt_EmailBook, MyEx.tostring());
                    }

                    try
                    {
                        if (chk_SkinBook.Checked)
                        {
                            myClient.SkinTest = "Yes";
                        }
                        else
                        {
                            myClient.SkinTest = "No";
                        }
                    }
                    catch (MyException MyEx)
                    {
                        ok = false;
                        errP.SetError(chk_SkinBook, MyEx.tostring());
                    }
                    if (newClient)
                    {
                        drclient             = dsNWRC_HairBeauty.Tables["Client"].NewRow();
                        drclient["ClientNo"] = myClient.ClientNo;
                        drclient["Title"]    = myClient.Title;
                        drclient["Surname"]  = myClient.Surname;
                        drclient["Forename"] = myClient.Forename;
                        drclient["Street"]   = myClient.Street;
                        drclient["Town"]     = myClient.Town;
                        drclient["County"]   = myClient.County;
                        drclient["PostCode"] = myClient.Postcode;
                        drclient["Country"]  = myClient.Country;
                        drclient["TelNo"]    = myClient.TelNo;
                        drclient["Email"]    = myClient.Email;
                        drclient["SkinTest"] = myClient.SkinTest;

                        dsNWRC_HairBeauty.Tables["Client"].Rows.Add(drclient);
                        daClient.Update(dsNWRC_HairBeauty, "Client");

                        MessageBox.Show("New Customer " + lbl_ClientNoTextBook.Text + " added !!!");
                    }
                    else
                    {
                        try
                        {
                            if (ok)
                            {
                                drclient.BeginEdit();
                                drclient["Title"]    = myClient.Title;
                                drclient["Surname"]  = myClient.Surname;
                                drclient["Forename"] = myClient.Forename;
                                drclient["Street"]   = myClient.Street;
                                drclient["Town"]     = myClient.Town;
                                drclient["County"]   = myClient.County;
                                drclient["PostCode"] = myClient.Postcode;
                                drclient["Country"]  = myClient.Country;
                                drclient["TelNo"]    = myClient.TelNo;
                                drclient["Email"]    = myClient.Email;
                                drclient["SkinTest"] = myClient.SkinTest;

                                drclient.EndEdit();
                                daClient.Update(dsNWRC_HairBeauty, "Client");

                                MessageBox.Show("Customer " + lbl_ClientNoTextBook.Text + " Details have been Updated !!!");
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("" + ex.TargetSite + "" + ex.Message, "Error!", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
                        }
                    }
                    //Disable Form entries
                    formEnable(false);
                    btn_CancelBook.Visible = false;
                    btn_Multibook.Text     = "Edit Client";
                }
            }
        }
Ejemplo n.º 3
0
        private void btn_AddClient_Click(object sender, EventArgs e)
        {
            MyClient myClient = new MyClient();
            bool     ok       = true;

            errP.Clear();

            try
            {
                myClient.ClientNo = Convert.ToInt32(lbl_ClientNoText.Text.Trim());
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(lbl_ClientNoText, MyEx.tostring());
            }

            try
            {
                myClient.Title = cmb_Title.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(cmb_Title, MyEx.tostring());
            }

            try
            {
                myClient.Surname = txt_Surname.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_Surname, MyEx.tostring());
            }

            try
            {
                myClient.Forename = txt_Forename.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_Forename, MyEx.tostring());
            }

            try
            {
                myClient.Street = richTxt_Street.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(richTxt_Street, MyEx.tostring());
            }

            try
            {
                myClient.Town = txt_Town.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_Town, MyEx.tostring());
            }

            try
            {
                myClient.County = txt_County.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_County, MyEx.tostring());
            }

            try
            {
                myClient.Postcode = txt_Postcode.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_Postcode, MyEx.tostring());
            }

            try
            {
                myClient.Country = txt_Country.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_Country, MyEx.tostring());
            }

            try
            {
                myClient.TelNo = txt_Telephone.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_Telephone, MyEx.tostring());
            }

            try
            {
                myClient.Email = txt_Email.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_Email, MyEx.tostring());
            }

            try
            {
                if (chk_Skin.Checked)
                {
                    myClient.SkinTest = "Yes";
                }
                else
                {
                    myClient.SkinTest = "No";
                }
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(chk_Skin, MyEx.tostring());
            }

            try
            {
                if (ok)
                {
                    drclient             = dsNWRC_HairBeauty.Tables["Client"].NewRow();
                    drclient["ClientNo"] = myClient.ClientNo;
                    drclient["Title"]    = myClient.Title;
                    drclient["Surname"]  = myClient.Surname;
                    drclient["Forename"] = myClient.Forename;
                    drclient["Street"]   = myClient.Street;
                    drclient["Town"]     = myClient.Town;
                    drclient["County"]   = myClient.County;
                    drclient["PostCode"] = myClient.Postcode;
                    drclient["Country"]  = myClient.Country;
                    drclient["TelNo"]    = myClient.TelNo;
                    drclient["Email"]    = myClient.Email;
                    drclient["SkinTest"] = myClient.SkinTest;

                    dsNWRC_HairBeauty.Tables["Client"].Rows.Add(drclient);
                    daClient.Update(dsNWRC_HairBeauty, "Client");

                    MessageBox.Show("New Customer " + lbl_ClientNoText.Text + " added !!!");

                    if (MessageBox.Show("Do you wish to add another Client?", "Add Client", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        clearAddForm();
                        getNumber(dsNWRC_HairBeauty.Tables["Client"].Rows.Count);
                    }
                    else
                    {
                        tab_Client.SelectedIndex = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.TargetSite + "" + ex.Message, "Error!", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        private void btn_AddTreat_Click(object sender, EventArgs e)
        {
            MyTreatment myTreat = new MyTreatment();
            bool        ok      = true;

            errP.Clear();

            try
            {
                myTreat.TreatmentNo = Convert.ToInt32(lbl_TreatNoText.Text.Trim());
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(lbl_TreatNoText, MyEx.tostring());
            }

            try
            {
                myTreat.TreatGroup = cb_TreatGroup.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(cb_TreatGroup, MyEx.tostring());
            }

            try
            {
                myTreat.TreatName = txt_TreatName.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_TreatName, MyEx.tostring());
            }

            try
            {
                myTreat.TreatType = cb_TreatType.Text.Trim();
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(cb_TreatType, MyEx.tostring());
            }

            try
            {
                myTreat.TreatPrice = Convert.ToDecimal(txt_TreatPrice.Text.Trim());
            }
            catch (MyException MyEx)
            {
                ok = false;
                errP.SetError(txt_TreatPrice, MyEx.tostring());
            }

            try
            {
                if (ok)
                {
                    drTreat = dsNWRC_HairBeauty.Tables["Treatments"].NewRow();
                    drTreat["TreatmentNo"] = myTreat.TreatmentNo;
                    drTreat["TreatGroup"]  = myTreat.TreatGroup;
                    drTreat["TreatName"]   = myTreat.TreatName;
                    drTreat["TreatType"]   = myTreat.TreatType;
                    drTreat["Price"]       = myTreat.TreatPrice;

                    dsNWRC_HairBeauty.Tables["Treatments"].Rows.Add(drTreat);
                    daTreat.Update(dsNWRC_HairBeauty, "Treatments");

                    MessageBox.Show("New User " + lbl_TreatNoText.Text + " added !!!");

                    if (MessageBox.Show("Do you wish to add another Treatment?", "Add Treatment", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        clearAddForm();
                        getNumber(dsNWRC_HairBeauty.Tables["Treatments"].Rows.Count);
                    }
                    else
                    {
                        tab_Treatments.SelectedIndex = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.TargetSite + "" + ex.Message, "Error!", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 5
0
        private void btn_EditClient_Click(object sender, EventArgs e)
        {
            if (btn_EditClient.Text == "Edit Client")
            {
                cmb_Title_Edit.Enabled    = true;
                txt_Forename_Edit.Enabled = true;
                txt_Surname_Edit.Enabled  = true;
                rt_Street_Edit.Enabled    = true;
                txt_Town_Edit.Enabled     = true;
                txt_County_Edit.Enabled   = true;
                txt_Postcode_Edit.Enabled = true;
                txt_Country_Edit.Enabled  = true;
                txt_TelNo_Edit.Enabled    = true;
                txt_Email_Edit.Enabled    = true;
                chk_Skin_Edit.Enabled     = true;

                btn_EditClient.Text = "Save Client";
            }
            else
            {
                MyClient myClient = new MyClient();
                bool     ok       = true;
                errP.Clear();


                try
                {
                    myClient.ClientNo = Convert.ToInt32(lbl_ClientNo_EditText.Text.Trim());
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(lbl_ClientNo_EditText, MyEx.ToString());
                }
                try
                {
                    myClient.Title = cmb_Title_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(cmb_Title_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.Surname = txt_Surname_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(txt_Surname_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.Forename = txt_Forename_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(txt_Forename_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.Street = rt_Street_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(rt_Street_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.Town = txt_Town_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(txt_Town_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.County = txt_County_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(txt_County_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.Postcode = txt_Postcode_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(txt_Postcode_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.Country = txt_Country_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(txt_Country_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.TelNo = txt_TelNo_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(txt_TelNo_Edit, MyEx.tostring());
                }

                try
                {
                    myClient.Email = txt_Email_Edit.Text.Trim();
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(txt_Email_Edit, MyEx.tostring());
                }

                try
                {
                    if (chk_Skin_Edit.Checked)
                    {
                        myClient.SkinTest = "Yes";
                    }
                    else
                    {
                        myClient.SkinTest = "No";
                    }
                }
                catch (MyException MyEx)
                {
                    ok = false;
                    errP.SetError(chk_Skin_Edit, MyEx.tostring());
                }
                try
                {
                    if (ok)
                    {
                        drclient.BeginEdit();

                        // drclient["ClientNo"] = myClient.ClientNo;
                        drclient["Title"]    = myClient.Title;
                        drclient["Surname"]  = myClient.Surname;
                        drclient["Forename"] = myClient.Forename;
                        drclient["Street"]   = myClient.Street;
                        drclient["Town"]     = myClient.Town;
                        drclient["County"]   = myClient.County;
                        drclient["PostCode"] = myClient.Postcode;
                        drclient["Country"]  = myClient.Country;
                        drclient["TelNo"]    = myClient.TelNo;
                        drclient["Email"]    = myClient.Email;
                        drclient["SkinTest"] = myClient.SkinTest;

                        drclient.EndEdit();
                        daClient.Update(dsNWRC_HairBeauty, "Client");

                        MessageBox.Show("Customer " + lbl_ClientNo_EditText.Text + " Details have been Updated !!!");

                        cmb_Title_Edit.Enabled    = false;
                        txt_Forename_Edit.Enabled = false;
                        txt_Surname_Edit.Enabled  = false;
                        rt_Street_Edit.Enabled    = false;
                        txt_Town_Edit.Enabled     = false;
                        txt_County_Edit.Enabled   = false;
                        txt_Postcode_Edit.Enabled = false;
                        txt_Country_Edit.Enabled  = false;
                        txt_TelNo_Edit.Enabled    = false;
                        txt_Email_Edit.Enabled    = false;
                        chk_Skin_Edit.Enabled     = false;

                        btn_EditClient.Text      = "Edit Client";
                        tab_Client.SelectedIndex = 0;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("" + ex.TargetSite + "" + ex.Message, "Error!", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
                }
            }
        }