Exemplo n.º 1
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.ValidateChildren())
                {
                    if (status == "edit")
                    {
                        var supp = Point_Of_SalesEntities.PSuppliers.Where(x => x.Supplier_id == index).First();
                        supp.supplier_name        = txt_suppliername.Text;
                        supp.supplier_address     = txt_alamat.Text;
                        supp.phone_number         = txt_phno.Text;
                        supp.email_address        = txt_email.Text;
                        supp.contact_Person       = txt_cp.Text;
                        supp.contact_person_email = txt_cpemail.Text;
                        supp.Contact_person_phone = txt_cpphno.Text;
                        supp.modified_by          = Properties.Settings.Default._userID;
                        supp.modified_on          = DateTime.Today;
                        affectedrows = Point_Of_SalesEntities.SaveChanges();

                        if (affectedrows > 0)
                        {
                            MessageBox.Show("Edit Data Berhasil", "info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        var user = Point_Of_SalesEntities.Set <PSupplier>();
                        user.Add(new PSupplier
                        {
                            supplier_name        = txt_suppliername.Text,
                            supplier_address     = txt_alamat.Text,
                            phone_number         = txt_alamat.Text,
                            email_address        = txt_phno.Text,
                            contact_Person       = txt_cp.Text,
                            contact_person_email = txt_cpemail.Text,
                            Contact_person_phone = txt_cpphno.Text,
                            created_by           = Properties.Settings.Default._userID,
                            created_date         = DateTime.Now,
                            is_deleted           = false
                        });

                        affectedrows = Point_Of_SalesEntities.SaveChanges();
                        if (affectedrows > 0)
                        {
                            MessageBox.Show("Tambah Data Berhasil", "info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Util.ClearTextBoxes(this.Controls);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Data Not Complete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception z)
            {
                MessageBox.Show(z.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.ValidateChildren())
                {
                    if (status == "edit")
                    {
                        var color = Point_Of_SalesEntities.P_Colour.Where(x => x.clor_id == index).First();
                        color.Description = txt_ColourName.Text;
                        color.modified_by = Properties.Settings.Default._userID;
                        color.modified_on = DateTime.Today;

                        affectedrows = Point_Of_SalesEntities.SaveChanges();
                        if (affectedrows > 0)
                        {
                            MessageBox.Show("Edit Data Berhasil", "info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        var user = Point_Of_SalesEntities.Set <P_Colour>();
                        user.Add(new P_Colour
                        {
                            Description = txt_ColourName.Text,

                            created_by   = Properties.Settings.Default._userID,
                            created_date = DateTime.Now,
                            is_deleted   = false
                        });

                        affectedrows = Point_Of_SalesEntities.SaveChanges();
                        if (affectedrows > 0)
                        {
                            MessageBox.Show("Tambah Data Berhasil", "info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Util.ClearTextBoxes(this.Controls);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Data Not Complete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception z)
            {
                MessageBox.Show(z.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
 private void btnresetsearch_Click(object sender, EventArgs e)
 {
     Stat = 0;
     Util.ClearTextBoxes(this.Controls);
     Load_DataColour();
 }