Ejemplo n.º 1
0
 public static void CancelBienNhan(string IDBienNhan)
 {
     Model.camdochieuduongEntities camdochieuduongEntity = new Model.camdochieuduongEntities();
     //Update Giao Dich Table
     Model.GiaoDich GD = camdochieuduongEntity.GiaoDiches.Find(IDBienNhan);
     if (GD.LoaiGiaoDich == Constants.CamDo)
     {
         GD.Canceled = "X";
         camdochieuduongEntity.SaveChanges();
     }
     else if (GD.LoaiGiaoDich == Constants.ThayGiay)
     {
         GD.Canceled = "X";
         camdochieuduongEntity.SaveChanges();
         //reverse thông tin đơn cũ
         Model.GiaoDich GD1 = camdochieuduongEntity.GiaoDiches.Find(GD.ThayTheCho);
         GD1.ThayTheBang = null; //reset thông tin thay giấy
         GD.TienLai      = 0;    //reset thông tin lãi
         camdochieuduongEntity.SaveChanges();
     }
     else
     {
         MessageBox.Show("Không thể Huỷ");
     }
     //camdochieuduongEntity.Entry(camdochieuduongEntity).Reload();
 }
Ejemplo n.º 2
0
        public static string CreateIDBienNhan()
        {
            Model.camdochieuduongEntities camdochieuduongEntity = new Model.camdochieuduongEntities();
            Model.NumberRange             nr = camdochieuduongEntity.NumberRanges.Single();
            var currYear  = DateTime.Now.Year.ToString();
            var currYear2 = currYear.Substring(currYear.Length - 2);
            var currMonth = DateTime.Now.Month.ToString();
            var nrID      = Convert.ToInt32(nr.ID);

            if ((currYear2 == nr.Year.Trim()) && (currMonth == nr.Month.Trim()))
            {
                nrID++;
                nr.ID = nrID.ToString();
            }
            else
            {
                nr.Year  = currYear2;
                nr.Month = currMonth;
                nr.ID    = "1";
            }
            camdochieuduongEntity.SaveChanges();
            var IDBienNhan = nr.ID + '-' + currMonth + currYear2;

            return(IDBienNhan);
        }
Ejemplo n.º 3
0
        public static void CreateGiaoDich(string I_IDBienNhan,
                                          string I_NgayCam,
                                          string I_KhachHang,
                                          string I_DienThoai,
                                          string I_MoTa,
                                          string I_GiaTri,
                                          string I_TienCam,
                                          string I_TruHotCon,
                                          string I_ThayTheCho,
                                          string I_DonGoc,
                                          string I_LoaiGiaoDich,
                                          string I_TienLai)

        {
            //Save data
            Model.camdochieuduongEntities camdochieuduongEntity = new Model.camdochieuduongEntities();
            Model.GiaoDich giaodich = new Model.GiaoDich();
            giaodich.IDBienNhan   = I_IDBienNhan;
            giaodich.NgayCam      = DateTime.Parse(I_NgayCam);
            giaodich.KhachHang    = I_KhachHang;
            giaodich.MoTa         = I_MoTa;
            giaodich.DienThoai    = I_DienThoai;
            giaodich.GiaTri       = Convert.ToInt64(I_GiaTri.Replace(",", ""));  //replace , with blank;
            giaodich.TienCam      = Convert.ToInt64(I_TienCam.Replace(",", "")); //replace , with blank;
            giaodich.TruHotCon    = I_TruHotCon;
            giaodich.ThayTheCho   = I_ThayTheCho;
            giaodich.DonGoc       = I_DonGoc;
            giaodich.LoaiGiaoDich = I_LoaiGiaoDich;
            giaodich.InBienNhan   = 1;
            giaodich.TienLai      = Convert.ToInt64(I_TienLai.Replace(",", ""));
            camdochieuduongEntity.GiaoDiches.Add(giaodich);
            camdochieuduongEntity.SaveChanges();
        }