Ejemplo n.º 1
0
        public void SetTrungTamHTSS(TrungTamHTSS tthtss)
        {
            dtb_profile tt = new dtb_profile();

            tt.name    = tthtss.TenTrungTam;
            tt.email   = tthtss.Email;
            tt.address = tthtss.DiaChi;
            tt.phone   = tthtss.SoDienThoai;
            tt.website = tthtss.Website;
            tt.code    = tthtss.MaTTHTSS;

            db.dtb_profiles.InsertOnSubmit(tt);
            db.SubmitChanges();
        }
Ejemplo n.º 2
0
        public void EditTrungTamHTSS(int id, TrungTamHTSS tthtss)
        {
            List <dtb_profile> listTTs = (from s in db.dtb_profiles select s).ToList();

            foreach (var tt in listTTs)
            {
                if (tt.id == id)
                {
                    tt.name    = tthtss.TenTrungTam;
                    tt.email   = tthtss.Email;
                    tt.address = tthtss.DiaChi;
                    tt.phone   = tthtss.SoDienThoai;
                    tt.website = tthtss.Website;
                    tt.code    = tthtss.MaTTHTSS;

                    db.SubmitChanges();
                }
            }
        }
Ejemplo n.º 3
0
        public void LoadData()
        {
            TrungTamHTSS tthtss = app.GetTrungTamHTSS();

            if (tthtss != null)
            {
                IdTrungTam                  = tthtss.Id;
                txtMaTrungTam.Text          = tthtss.MaTTHTSS;
                txtTenTrungTam.Text         = tthtss.TenTrungTam;
                txtEmailTrungTam.Text       = tthtss.Email;
                txtDiaChiTrungTam.Text      = tthtss.DiaChi;
                txtSoDienThoaiTrungTam.Text = tthtss.SoDienThoai;
                txtWebsiteTrungTam.Text     = tthtss.Website;
            }
            else
            {
                IdTrungTam  = -1;
                btnSua.Text = "Tạo mới";
            }
        }
Ejemplo n.º 4
0
        public TrungTamHTSS GetTrungTamHTSS()
        {
            if (db.dtb_profiles.Any())
            {
                dtb_profile  tt     = (from s in db.dtb_profiles select s).ToList()[0];
                TrungTamHTSS tthtss = new TrungTamHTSS();
                tthtss.Id          = tt.id;
                tthtss.TenTrungTam = tt.name;
                tthtss.Email       = tt.email;
                tthtss.DiaChi      = tt.address;
                tthtss.SoDienThoai = tt.phone;
                tthtss.Website     = tt.website;
                tthtss.MaTTHTSS    = tt.code;

                return(tthtss);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        private bool BeginInit(string userName)
        {
            bool check = true;

            listDMDanTocs = danhmucDB.GetDMDanToc();
            if (listDMDanTocs.Count == 0)
            {
                check = false;
            }

            listDMThanhPhos = danhmucDB.GetDMThanhPho();
            if (listDMThanhPhos.Count == 0)
            {
                check = false;
            }

            listDMTinhThanhs = danhmucDB.GetDMTinhThanh();
            if (listDMTinhThanhs.Count == 0)
            {
                check = false;
            }

            listDMTrinhDoHocVans = danhmucDB.GetDMTrinhDoHocVan();
            if (listDMTrinhDoHocVans.Count == 0)
            {
                check = false;
            }

            tthtss = danhmucDB.GetTrungTamHTSS();
            if (tthtss == null)
            {
                check = false;
            }

            listPermiss = userDB.GetPermissionByUser(userName);

            return(check);
        }
Ejemplo n.º 6
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            Regex phoneNumpattern = new Regex(@"^-*[0-9,\.?\-?\(?\)?\ ]+$");

            if (!phoneNumpattern.IsMatch(txtSoDienThoaiTrungTam.Text))
            {
                MessageBox.Show("Bạn chưa nhập đúng số điện thoại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (IdTrungTam != -1)
            {
                TrungTamHTSS tthtss = new TrungTamHTSS();
                tthtss.MaTTHTSS    = txtMaTrungTam.Text;
                tthtss.TenTrungTam = txtTenTrungTam.Text;
                tthtss.Email       = txtEmailTrungTam.Text;
                tthtss.DiaChi      = txtDiaChiTrungTam.Text;
                tthtss.SoDienThoai = txtSoDienThoaiTrungTam.Text;
                tthtss.Website     = txtWebsiteTrungTam.Text;

                dbCM.EditTrungTamHTSS(IdTrungTam, tthtss);
            }
            else
            {
                TrungTamHTSS tthtss = new TrungTamHTSS();
                tthtss.MaTTHTSS    = txtMaTrungTam.Text;
                tthtss.TenTrungTam = txtTenTrungTam.Text;
                tthtss.Email       = txtEmailTrungTam.Text;
                tthtss.DiaChi      = txtDiaChiTrungTam.Text;
                tthtss.SoDienThoai = txtSoDienThoaiTrungTam.Text;
                tthtss.Website     = txtWebsiteTrungTam.Text;

                dbCM.SetTrungTamHTSS(tthtss);
            }

            MessageBox.Show("Bạn cần restart lại ứng dụng khi sửa thông tin của trung tâm hỗ trợ sinh sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }