예제 #1
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (txt_name.Text.Trim() == "")
            {
                CustomControls.Alert.show("name", "enter name", 1500);
                return;
            }
            if (txt_address.Text.Trim() == "")
            {
                CustomControls.Alert.show("address", "enter address", 1500);
                return;
            }
            if (txt_phone.Text.Trim() == "")
            {
                CustomControls.Alert.show("phone", "enter phone", 1500);
                return;
            }

            try
            {
                var i = db.finances.Where(o => o.id == id).First();
                i.name            = txt_name.Text;
                i.address         = txt_address.Text;
                i.phone           = txt_phone.Text;
                i.email           = txt_email.Text;
                i.updated_at      = DateTime.Now;
                db.Entry(i).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                CustomControls.Alert.show("Data", "Error Data", 1500);
            }
        }
예제 #2
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (txt_title.Text.Trim() == "")
            {
                CustomControls.Alert.show("title", "Enter Title", 1500);
            }

            try
            {
                var i = new tax()
                {
                    taxcate_id = (comboBox1.SelectedItem as Model.taxcategory).id,
                    title      = txt_title.Text,
                    created_at = DateTime.Now,
                    updated_at = DateTime.Now
                };
                db.taxes.Add(i);
                db.SaveChanges();
                add?.Invoke(i);
                this.Close();
            }
            catch (Exception ex)
            {
                CustomControls.Alert.show("Erroe", "Error Data", 1500);
            }
        }
예제 #3
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (txt_name.Text.Trim() == "")
            {
                CustomControls.Alert.show("name", "Enter Name", 1500);
                return;
            }
            if (txt_address.Text.Trim() == "")
            {
                CustomControls.Alert.show("address", "Enter Address", 1500);
                return;
            }
            if (txt_phone.Text.Trim() == "")
            {
                CustomControls.Alert.show("phone", "Enter phone", 1500);
                return;
            }
            if (txt_salary.Text.Trim() == "")
            {
                CustomControls.Alert.show("salary", "Enter Salary", 1500);
                return;
            }
            if (txt_post.Text.Trim() == "")
            {
                CustomControls.Alert.show("post", "Enter post", 1500);
                return;
            }


            try
            {
                var i = new staff()
                {
                    name    = txt_name.Text,
                    address = txt_address.Text,
                    phone   = txt_phone.Text,
                    salary  = txt_salary.decVal,
                    post    = txt_post.Text,
                    //photo = txt_photo.Text,
                    description = txt_description.Text,
                    startdate   = nepaliCalender1.Datestamp,
                    created_at  = DateTime.Now,
                    updated_at  = DateTime.Now
                };
                db.staffs.Add(i);
                db.SaveChanges();
                add?.Invoke(i);
                this.Close();
            }
            catch (Exception ex)
            {
                CustomControls.Alert.show("Data", "Error Data", 1500);
            }
        }
예제 #4
0
        private void materialButton1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you wnt to delete?", "Delete record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                CustomControls.Alert.show("Advance", "data deleted", 1500);

                var i = db.taxes.Where(o => o.id == this.id).First();
                db.Entry(i).State = System.Data.Entity.EntityState.Deleted;
                db.SaveChanges();
                this.Parent.Controls.Remove(this);
            }
        }
예제 #5
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (txt_title.Text.Trim() == "")
            {
                CustomControls.Alert.show("title", "Enter Title", 1500);
            }

            try
            {
                var editdata = db.taxes.Where(o => o.id == id).First();
                editdata.taxcate_id      = (comboBox1.SelectedItem as Model.taxcategory).id;
                editdata.title           = txt_title.Text;
                editdata.updated_at      = DateTime.Now;
                db.Entry(editdata).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                CustomControls.Alert.show("Error", "Error Data", 1500);
            }
        }
예제 #6
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (txt_name.Text.Trim() == "")
            {
                CustomControls.Alert.show("name", "enter name", 1500);
                return;
            }
            if (txt_address.Text.Trim() == "")
            {
                CustomControls.Alert.show("address", "enter address", 1500);
                return;
            }
            if (txt_phone.Text.Trim() == "")
            {
                CustomControls.Alert.show("phone", "enter phone", 1500);
                return;
            }

            try
            {
                var i = new finance()
                {
                    name       = txt_name.Text,
                    address    = txt_address.Text,
                    phone      = txt_phone.Text,
                    email      = txt_email.Text,
                    created_at = DateTime.Now,
                    updated_at = DateTime.Now,
                };
                db.finances.Add(i);
                db.SaveChanges();
                add?.Invoke(i);
                this.Close();
            }
            catch (Exception ex)
            {
                CustomControls.Alert.show("Data", "Error Data", 1500);
            }
        }