Ejemplo n.º 1
0
 public bool SuaThongTinNo(eNhatKyGhiNo diary)
 {
     try
     {
         NhatKyGhiNo olddiary = db.NhatKyGhiNos.Where(x => x.IDKhachHang == diary.IDKhachHang).FirstOrDefault();
         olddiary.SoTienNo = diary.SoTienNo;
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
        public bool ThemThongTinNo(eNhatKyGhiNo diary)
        {
            NhatKyGhiNo nhatKy = db.NhatKyGhiNos.Where(x => x.IDKhachHang == diary.IDKhachHang).FirstOrDefault();

            if (nhatKy.SoTienNo >= 0)
            {
                nhatKy.SoTienNo += diary.SoTienNo;
            }
            else if (nhatKy == null)
            {
                NhatKyGhiNo nhatKyGhiNo = new NhatKyGhiNo();
                nhatKyGhiNo.IDDia       = diary.IDDia;
                nhatKyGhiNo.IDKhachHang = diary.IDKhachHang;
                nhatKyGhiNo.SoTienNo    = diary.SoTienNo;
                db.NhatKyGhiNos.InsertOnSubmit(nhatKyGhiNo);
                db.SubmitChanges();
                return(true);
            }
            return(false);
        }
        private void btnluudulieu_Click(object sender, EventArgs e)
        {
            if (rdgood.Checked == true)
            {
                diadll.CapNhatTinhTrangDia((int)dataGridView1.CurrentRow.Cells[1].Value, "Good");
            }
            if (rdnotgood.Checked == true)
            {
                diadll.CapNhatTinhTrangDia((int)dataGridView1.CurrentRow.Cells[1].Value, "Not good");
            }

            nhatkythuediadll.ChinhTrangThaiThueDia((int)dataGridView1.CurrentRow.Cells[1].Value, "Available");
            madia = (int)dataGridView1.CurrentRow.Cells[1].Value;
            matua = dataGridView1.CurrentRow.Cells[4].Value.ToString();
            nhatkythuediadll.TangSoLuong(dataGridView1.CurrentRow.Cells[4].Value.ToString());
            nhatkythuediadll.ChinhSuaTinhTrangTraDia((int)dataGridView1.CurrentRow.Cells[0].Value, "Da tra");

            decimal sotienkhongcophitre = ConvertStringToDecimal(lbltongtienquykhachphaitra.Text);
            decimal sotiencophitre      = (((decimal)0.1 * (decimal)dataGridView1.CurrentRow.Cells[6].Value) + ((decimal)0.2 * ConvertStringToDecimal(lbltiendatcoc.Text)));

            if (DateTime.Now > (DateTime)dataGridView1.CurrentRow.Cells[8].Value && sotiencophitre > sotienkhongcophitre)
            {
                nhatkythuediadll.ThemPhiNoTre(dataGridView1.CurrentRow.Cells[2].Value.ToString(), (decimal)0.1 * (decimal)dataGridView1.CurrentRow.Cells[6].Value);
                eNhatKyGhiNo no = new eNhatKyGhiNo();
                no.IDDia       = (int)dataGridView1.CurrentRow.Cells[1].Value;
                no.IDKhachHang = dataGridView1.CurrentRow.Cells[2].Value.ToString();
                no.SoTienNo    = (decimal)0.1 * (decimal)dataGridView1.CurrentRow.Cells[6].Value;
                nhatkyghinodll.ThemThongTinNo(no);
            }
            if (tuadedll.SoLuongDiaCuaTuaDe(dataGridView1.CurrentRow.Cells[4].Value.ToString()) > 0)
            {
                grbgiucho.Visible = true;
                Load_Basic_Customer_Inf();
            }
            dataGridView1.DataSource = nhatkythuediadll.GetList();
        }