Пример #1
0
        /// <summary>Đặt tình trạng duyệt của Phiếu vào Control
        /// </summary>
        public void SetDuyet(DOPhieu dophieu)
        {
            ////Dùng Property

            //Dùng thuộc tính
            try
            {
                //Cách mới
                if (this.IsChoDuyet)
                    imageComboBoxEdit1.SelectedIndex = HelpNumber.ParseInt32(dophieu.GetType().GetField("DUYET").GetValue(dophieu).ToString()) - 1;
                else
                    imageComboBoxEdit1.SelectedIndex = HelpNumber.ParseInt32(dophieu.GetType().GetField("DUYET").GetValue(dophieu).ToString()) - 2;

            }
            catch
            {
                if (this.IsChoDuyet)
                    imageComboBoxEdit1.SelectedIndex = HelpNumber.ParseInt32(dophieu.GetType().GetProperty("DUYET").GetValue(dophieu, null).ToString()) - 1;
                else
                    imageComboBoxEdit1.SelectedIndex = HelpNumber.ParseInt32(dophieu.GetType().GetProperty("DUYET").GetValue(dophieu, null).ToString()) - 2;
            }
        }
Пример #2
0
 /// <summary>Đặt thông tin tình trạng duyệt của phiếu vào doPhieu
 /// 
 /// </summary>
 public void GetDuyet(DOPhieu dophieu)
 {
     string []tempDuyet = new string[] { "DUYET", "NGAY_DUYET", "NGUOI_DUYET" };
     string id = imageComboBoxEdit1.EditValue.ToString();
     //set DUYET
     try
     {
         dophieu.GetType().GetField(tempDuyet[0]).SetValue(dophieu, imageComboBoxEdit1.EditValue.ToString());
         //set NGAY_DUYET
         //set NGUOI_DUYET
         if (id == "1") // chờ duyệt
         {
             dophieu.GetType().GetField(tempDuyet[1]).SetValue(dophieu, (new RepositoryItemDateEdit()).NullDate);
             dophieu.GetType().GetField(tempDuyet[2]).SetValue(dophieu, -1);
         }
         if (id == "2" || id == "3") //duyệt, không duyệt
         {
             dophieu.GetType().GetField(tempDuyet[1]).SetValue(dophieu, DABase.getDatabase().GetSystemCurrentDateTime());
             dophieu.GetType().GetField(tempDuyet[2]).SetValue(dophieu, FrameworkParams.currentUser.employee_id);
         }
     }
     catch
     {
         dophieu.GetType().GetProperty(tempDuyet[0]).SetValue(dophieu, imageComboBoxEdit1.EditValue.ToString(), null);
         //set NGAY_DUYET
         //set NGUOI_DUYET
         if (id == "1") // chờ duyệt
         {
             dophieu.GetType().GetProperty(tempDuyet[1]).SetValue(dophieu, (new RepositoryItemDateEdit()).NullDate, null);
             dophieu.GetType().GetProperty(tempDuyet[2]).SetValue(dophieu,-1 , null);
         }
         if (id == "2" || id == "3") //duyệt, không duyệt
         {
             dophieu.GetType().GetProperty(tempDuyet[1]).SetValue(dophieu, DABase.getDatabase().GetSystemCurrentDateTime(), null);
             dophieu.GetType().GetProperty(tempDuyet[2]).SetValue(dophieu, FrameworkParams.currentUser.employee_id, null);
         }
     }
 }
Пример #3
0
 public static void InitDuyetInfoExt(PLInfoBox Info, PLDuyetCombobox DuyetCtrl, DOPhieu Phieu)
 {
     try
     {
         string Duyet = "4";
         try
         {
             Duyet = Phieu.GetType().GetProperty("DUYET").GetValue(Phieu, null).ToString().Trim();
             DuyetCtrl.SetDuyet(Phieu);
         }
         catch { }
         string NguoiCapNhat = DMFWNhanVien.GetFullName(Phieu.GetType().GetProperty("NGUOI_CAP_NHAT").GetValue(Phieu, null));
         string NgayCapNhat = Phieu.GetType().GetProperty("NGAY_CAP_NHAT").GetValue(Phieu, null).ToString();
         if (Duyet == "2" || Duyet == "3")
         {
             Info._init(NguoiCapNhat, NgayCapNhat,
               DMFWNhanVien.GetFullName(Phieu.GetType().GetProperty("NGUOI_DUYET").GetValue(Phieu, null)),
               Phieu.GetType().GetProperty("NGAY_DUYET").GetValue(Phieu, null).ToString());
         }
         else
         {
             Info._init(NguoiCapNhat, NgayCapNhat);
         }
         DuyetCtrl.Enabled = false;
     }
     catch { }
 }