/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The object whose index value is being set.</param> /// <param name="index">The index position to set the value</param> /// <param name="val">The value to set at the index</param> /// <returns></returns> public override void SetByNumericIndex(LObject target, int index, LObject val) { if (target == null) return; var list = target.GetValue() as IList; if (list == null || list.Count == 0) return; if (index < 0 || index >= list.Count) throw new IndexOutOfRangeException("Index : " + index); list[index] = val; }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="index"></param> /// <returns></returns> public override object GetByNumericIndex(LObject target, int index) { if (target == null) return LObjects.Null; var list = target.GetValue() as IList; if (list == null || list.Count == 0) return LObjects.Null; if (index < 0 || index >= list.Count) throw new IndexOutOfRangeException("Index : " + index); return list[index]; }
public LFunction(BHeader header, int[] code, LLocal[] locals, LObject[] constants, LUpvalue[] upvalues, LFunction[] functions, int maximumStackSize, int numUpValues, int numParams, int vararg) { this.header = header; this.code = code; this.locals = locals; this.constants = constants; this.upvalues = upvalues; this.functions = functions; this.maximumStackSize = maximumStackSize; this.numUpvalues = numUpValues; this.numParams = numParams; this.vararg = vararg; }
/// <summary> /// Joins two or more arrays, and returns a copy of the joined arrays /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="item">The item to search for</param> /// <param name="start">The starting position of the search.</param> /// <returns>A copy of joined array</returns> public int LastIndexOf(LObject target, object item, int start) { var list = target.GetValue() as IList; var foundPos = -1; var total = list.Count; for (var ndx = start; ndx < total; ndx++) { var itemAt = list[ndx] as LObject; if (itemAt != null && itemAt.GetValue() == item) { foundPos = ndx; } } return(foundPos); }
public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem) { Binding newBinding = CreateValueBinding(); if (LObject.IsNullOrEmpty(newBinding.Source)) { newBinding.Source = dataItem; } this.SetBinding(ColumnsMaskDateTime.ValueProperty, newBinding); TextBlock txt = new TextBlock(); if (!LObject.IsNullOrEmpty(Value)) { txt.Text = LDateTime.StringToDate(Value, ApplicationConstant.defaultDateTimeFormat).ToString(Mask); } return(txt); }
/// <summary> /// Khởi tạo các combobox /// </summary> private void LoadCombobox() { // khởi tạo combobox AutoComboBox auto = new AutoComboBox(); // Khởi tạo điều kiện gọi danh mục List <string> lstDieuKien = new List <string>(); // khởi tạo combobox Chi nhanh, PGD auto = new AutoComboBox(); auto.GenAutoComboBox(ref lstSourceChiNhanh, ref cmbChiNhanh, DatabaseConstant.DanhSachTruyVan.COMBOBOX_CNHANH.getValue(), null, ClientInformation.MaDonVi); auto.GenAutoComboBox(ref lstSourcePhongGD, ref cmbPhongGD, DatabaseConstant.DanhSachTruyVan.COMBOBOX_PHONG_GD.getValue()); LoadComboboxPhongGD(); // khởi tạo Khu Vuc var process = new TruyVanProcess(); DanhSachResponse response = process.getDanhSachInformation(DatabaseConstant.DanhSachTruyVan.COMBOBOX_KHUVUC_ALL.getValue(), lstDieuKien); if (!LObject.IsNullOrEmpty(response.DataSetSource) && response.DataSetSource.Tables[0].Rows.Count > 0) { dtSourceKhuVuc = response.DataSetSource.Tables[0]; LoadComboboxKhuVuc(); } lstDieuKien = new List <string>(); lstDieuKien.Add(DatabaseConstant.DanhMuc.LY_DO_VAO_RA.getValue()); // khởi tạo combobox auto = new AutoComboBox(); lstDieuKien = new List <string>(); lstDieuKien.Add(DatabaseConstant.DanhMuc.NGON_NGU.getValue()); // khởi tạo combobox auto = new AutoComboBox(); auto.GenAutoComboBox(ref lstSourceNgonNgu, ref cmbNgonNgu, DatabaseConstant.DanhSachTruyVan.COMBOBOX_DMUC.getValue(), lstDieuKien, ApplicationConstant.LoaiNgonNguBaoCao.vi_VN.layGiaTri()); cmbNgonNgu.IsEnabled = false; lstDieuKien.Clear(); lstDieuKien.Add(DatabaseConstant.DanhMuc.DINH_DANG_BAO_CAO.getValue()); // khởi tạo combobox auto = new AutoComboBox(); auto.GenAutoComboBox(ref lstSourceDinhDang, ref cmbDinhDang, DatabaseConstant.DanhSachTruyVan.COMBOBOX_DMUC.getValue(), lstDieuKien, ApplicationConstant.LoaiDinhDangBaoCao.EXCEL.layGiaTri()); cmbDinhDang.IsEnabled = false; cmbChiNhanh.SelectionChanged += cmbChiNhanh_SelectionChanged; cmbPhongGD.SelectionChanged += cmbPhongGD_SelectionChanged; IsLoadForm = true; }
void BeforeRefuse() { try { if (!tlbDelete.IsEnabled) { return; } Cursor = Cursors.Wait; lstId = new List <int>(); if (grDSTaiSan.SelectedItems.Count > 0) { if (LMessage.ShowMessage("M.DungChung.HoiTuChoiDuyet", LMessage.MessageBoxType.Question) == MessageBoxResult.Yes) { if (LObject.IsNullOrEmpty(objHDTC)) { objHDTC = new TDTD_HOP_DONG_TCHAP(); } foreach (DataRowView dr in grDSTaiSan.SelectedItems) { lstId.Add(Convert.ToInt32(dr["ID"])); } objHDTC.DSACH_ID_XOA = lstId.ToArray(); UtilitiesProcess process = new UtilitiesProcess(); bool retLockData = process.LockData(DatabaseConstant.Module.TDTD, DatabaseConstant.Function.TDTD_HDTC_DS, DatabaseConstant.Table.TDTD_HDTC, DatabaseConstant.Action.TU_CHOI_DUYET, lstId); OnRefuse(); } } } catch (System.Exception ex) { // Yêu cầu UnLock dữ liệu UtilitiesProcess process = new UtilitiesProcess(); bool retLockData = process.UnlockData(DatabaseConstant.Module.TDTD, DatabaseConstant.Function.TDTD_HDTC_DS, DatabaseConstant.Table.TDTD_HDTC, DatabaseConstant.Action.TU_CHOI_DUYET, lstId); Cursor = Cursors.Arrow; } }
private void LoadThongTinBoSung() { try { if (isLoad && !LObject.IsNullOrEmpty(lstSourceNhom) && lstSourceNhom.Count > 0) { txtCanBoQuanLy.Text = lstSourceNhom.ElementAt(cmbNhom.SelectedIndex).KeywordStrings[6]; } else { txtCanBoQuanLy.Text = ""; } } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="member">The name of the map key/property to set</param> /// <param name="value">The vlaue to set</param> /// <returns></returns> public override void SetByStringMember(LObject obj, string member, LObject val) { if (obj == null) { return; } var map = obj.GetValue() as IDictionary; if (map == null) { return; } if (string.IsNullOrEmpty(member)) { throw new IndexOutOfRangeException("Property does not exist : " + member); } map[member] = val; }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="member">The name of the map key/property to get</param> /// <returns></returns> public override object GetByStringMember(LObject target, string member) { if (target == null) { return(LObjects.Null); } var map = target.GetValue() as IDictionary; if (map == null || map.Count == 0) { return(LObjects.Null); } if (string.IsNullOrEmpty(member)) { throw new IndexOutOfRangeException("Property does not exist : " + member); } return(map[member]); }
private void LoadDuLieuKHang() { if (cmbNhom.SelectedIndex < 0) { return; } AutoCompleteEntry au = lstSourceNhom.ElementAt(cmbNhom.SelectedIndex); DataSet ds = new BaoCaoProcess().GetKhachHangTheoNhom(au.KeywordStrings[0]); if (!LObject.IsNullOrEmpty(ds) && ds.Tables.Count > 0) { grSoTienGuiDS.ItemsSource = ds.Tables[0].DefaultView; } else { grSoTienGuiDS.ItemsSource = null; } }
private void GetFormData() { string maChiNhanh = string.Empty; string tenChiNhanh = string.Empty; maChiNhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.First(); tenChiNhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).DisplayName; lstMaPhongGiaoDich = new List <string>(); foreach (AutoCompleteCheckBox PhongGD in lstSourcePhongGD.Where(e => e.CheckedMember == true)) { lstMaPhongGiaoDich.Add(PhongGD.ValueMember.FirstOrDefault()); } DateTime thang = new DateTime(); if (raddtThang.Value is DateTime) { thang = (DateTime)raddtThang.Value; } DateTime ngayBaoCao = new DateTime(); if (raddtNgayBaoCao.Value is DateTime) { ngayBaoCao = (DateTime)raddtNgayBaoCao.Value; } string maNgonNgu = lstSourceNgonNgu.ElementAt(cmbNgonNgu.SelectedIndex).KeywordStrings.First(); string maDinhDang = lstSourceDinhDang.ElementAt(cmbDinhDang.SelectedIndex).KeywordStrings.First(); // Gán dữ liệu từ form vào các biến truyền cho báo cáo MaChiNhanh = maChiNhanh; TenChiNhanh = tenChiNhanh; TuNgay = (raddtThang.Value is DateTime) ? thang.ToString("yyyyMM") + "01" : ""; DenNgay = (raddtThang.Value is DateTime) ? thang.ToString("yyyyMM") + LDateTime.GetLastDateOfMonth(thang).ToString("dd") : ""; TuThoiHan = (!LObject.IsNullOrEmpty(nudTuThang.Value)) ? LNumber.StringToInt32(nudTuThang.Value.ToString()).ToString() : ""; DenThoiHan = (!LObject.IsNullOrEmpty(nudDenThang.Value)) ? LNumber.StringToInt32(nudDenThang.Value.ToString()).ToString() : ""; NgayBaoCao = (raddtNgayBaoCao.Value is DateTime) ? ngayBaoCao.ToString("yyyyMMdd") : ""; MaNguoiLap = ClientInformation.TenDangNhap; TenNguoiLap = ClientInformation.HoTen; MaNgonNgu = maNgonNgu; MaDinhDang = maDinhDang; }
void btnThemTyGia_Click(object sender, RoutedEventArgs e) { AutoCompleteEntry auLoaiTyGia = lstSourceLoaiTyGia.ElementAt(cbbLoaiTyGia.SelectedIndex); AutoCompleteEntry auHinhThucTyGia = lstSourceHinhThucNiemYet.ElementAt(cbbHinhThucNiemYet.SelectedIndex); AutoCompleteEntry auLoaiTien = lstSourceLoaiTien.ElementAt(cbbMaTienTe.SelectedIndex); DANH_SACH_TY_GIA_CT objTyGiaCT = new DANH_SACH_TY_GIA_CT(); List <DANH_SACH_TY_GIA_CT> lstTyGiaCT = new List <DANH_SACH_TY_GIA_CT>(); objTyGiaCT.ID_TY_GIA_CT = 0; objTyGiaCT.LOAI_TY_GIA = auLoaiTyGia.KeywordStrings.FirstOrDefault(); objTyGiaCT.HINH_THUC_NIEM_YET = auHinhThucTyGia.KeywordStrings.FirstOrDefault(); objTyGiaCT.MA_DVI_QLY = ClientInformation.MaDonViQuanLy; objTyGiaCT.MA_DVI_TAO = ClientInformation.MaDonViGiaoDich; objTyGiaCT.MA_LOAI_TIEN = auLoaiTien.KeywordStrings.FirstOrDefault(); objTyGiaCT.NGAY_AP_DUNG = LDateTime.DateToString(raddtNgayApDung.Value.GetValueOrDefault(), ApplicationConstant.defaultDateTimeFormat); objTyGiaCT.NGAY_NHAP = ClientInformation.NgayLamViecHienTai; objTyGiaCT.NGUOI_NHAP = ClientInformation.TenDangNhap; objTyGiaCT.TEN_LOAI_TIEN = auLoaiTien.DisplayName; objTyGiaCT.TTHAI_DL = "T"; objTyGiaCT.TY_GIA_BAN = (decimal)txtTyGiaBan.Value.GetValueOrDefault(); objTyGiaCT.TY_GIA_BQUAN = (decimal)txtTyGiaBinhQuan.Value.GetValueOrDefault(); objTyGiaCT.TY_GIA_MUA = (decimal)txtTyGiaMua.Value.GetValueOrDefault(); objTyGiaCT.TRANG_THAI_BAN_GHI = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri(); objTyGiaCT.TRANG_THAI_NGHIEP_VU = BusinessConstant.TrangThaiNghiepVu.CHO_DUYET.layGiaTri(); if (LObject.IsNullOrEmpty(raddgrDSTyGia.ItemsSource)) { lstTyGiaCT.Add(objTyGiaCT); } else { lstTyGiaCT = raddgrDSTyGia.ItemsSource as List <DANH_SACH_TY_GIA_CT>; int icount = lstTyGiaCT.Where(f => f.HINH_THUC_NIEM_YET == objTyGiaCT.HINH_THUC_NIEM_YET && !f.TRANG_THAI_NGHIEP_VU.Equals(BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri())).Count(); if (icount > 0) { return; } else { lstTyGiaCT.Add(objTyGiaCT); } } raddgrDSTyGia.ItemsSource = lstTyGiaCT; raddgrDSTyGia.Rebind(); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (LObject.IsNullOrEmpty(value)) { return(null); } else { if (LDateTime.IsDate(value.ToString(), ApplicationConstant.defaultDateTimeFormat)) { return(LDateTime.StringToDate(value.ToString(), ApplicationConstant.defaultDateTimeFormat)); } else { return(null); } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (LObject.IsNullOrEmpty(value)) { return(null); } else { if (!value.Equals(0)) { return("{}{0:N0}"); } else { return(null); } } }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (LObject.IsNullOrEmpty(value)) { return(null); } else { if (typeof(DateTime).Equals(value.GetType())) { return(LDateTime.DateToString(System.Convert.ToDateTime(value), ApplicationConstant.defaultDateTimeFormat)); } else { return(null); } } }
private void cmbDonVi_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (!LObject.IsNullOrEmpty(lstSourceDonVi) && cmbDonVi.SelectedIndex > -1) { maDonVi = lstSourceDonVi.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings.ElementAt(0); if (maDonVi.Equals(DatabaseConstant.MA_HSO)) { maDonVi = "%"; } LoadDuLieu(); } } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The object whose index value is being set.</param> /// <param name="index">The index position to set the value</param> /// <param name="val">The value to set at the index</param> /// <returns></returns> public override void SetByNumericIndex(LObject target, int index, LObject val) { if (target == null) { return; } var list = target.GetValue() as IList; if (list == null || list.Count == 0) { return; } if (index < 0 || index >= list.Count) { throw new IndexOutOfRangeException("Index : " + index); } list[index] = val; }
/// <summary> /// Adds new elements to the beginning of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add.</param> /// <returns>The new length</returns> public int UnShift(LObject target, params object[] elements) { var list = target.GetValue() as IList; if (list == null) { return(0); } if (elements == null || elements.Length == 0) { return(list.Count); } for (var ndx = 0; ndx < elements.Length; ndx++) { object val = elements[ndx]; list.Insert(0, val); } return(list.Count); }
private bool Validation() { if (lstSourceChiNhanh.Where(e => e.CheckedMember == true).ToList().Count < 1) { return(false); } if (lstSourcePhongGD.Where(e => e.CheckedMember == true).ToList().Count < 1) { return(false); } if (LObject.IsNullOrEmpty(grSoTienGuiDS.ItemsSource)) { return(false); } if (grSoTienGuiDS.SelectedItems.Count < 1) { return(false); } return(true); }
public override sealed IObject Construct(IEnvironment environment, IArgs args) { if (args.Count > 0) { var arg = args[0]; switch (arg.TypeCode) { case LanguageTypeCode.Boolean: case LanguageTypeCode.String: case LanguageTypeCode.Number: case LanguageTypeCode.Object: return arg.ConvertToObject(); } } var obj = new LObject(environment); obj.Class = "Object"; obj.Extensible = true; obj.Prototype = environment.ObjectPrototype; return obj; }
/// <summary> /// Joins two or more arrays, and returns a copy of the joined arrays /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="arrays">Array of arrays to add</param> /// <returns>A copy of joined array</returns> public LObject Concat(LObject target, params object[] arrays) { if (arrays == null || arrays.Length == 0) { return(target); } var list = target.GetValue() as IList; var copy = new List <object>(); AddRange(copy, list); for (var ndx = 0; ndx < arrays.Length; ndx++) { object item = arrays[ndx]; IList array = (IList)item; AddRange(copy, array); } return(new LArray(copy)); }
public void GenAutoComboBox(DataTable dt, ref RadComboBox comboBox) { ListCheckBoxCombo lstSource = new ListCheckBoxCombo(); if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { return; } if (!LObject.IsNullOrEmpty(dt) && dt.Rows.Count > 0) { AutoCompleteCheckBox autocom = new AutoCompleteCheckBox(); int icount = 0; lstSource.Add(new AutoCompleteCheckBox()); foreach (DataRow row in dt.Rows) { icount++; string[] value = new string[row.Table.Columns.Count - 1]; if (row.Table.Columns.Count > 3) { value[0] = row[1].ToString(); value[1] = row[0].ToString(); for (int i = 3; i < row.Table.Columns.Count; i++) { value[i - 1] = row[i].ToString(); } autocom.ValueMember = value; } else { value[0] = row[1].ToString(); value[1] = row[0].ToString(); autocom.ValueMember = value; } lstSource.Add(new AutoCompleteCheckBox(LLanguage.SearchResourceByKey(row[2].ToString()), value, true, icount)); } comboBox.ItemsSource = lstSource; comboBox.SelectedIndex = 0; } }
public sealed override IObject Construct(IEnvironment environment, IArgs args) { if (args.Count > 0) { var arg = args[0]; switch (arg.TypeCode) { case LanguageTypeCode.Boolean: case LanguageTypeCode.String: case LanguageTypeCode.Number: case LanguageTypeCode.Object: return(arg.ConvertToObject()); } } var obj = new LObject(environment); obj.Class = "Object"; obj.Extensible = true; obj.Prototype = environment.ObjectPrototype; return(obj); }
private void LoadGridViewKhuVuc() { if (cmbPhongGD.SelectedIndex >= 0) { string maPhongGiaoDich = lstSourcePhongGD_Select.ElementAt(cmbPhongGD.SelectedIndex).KeywordStrings.First(); string idPhongGiaoDich = lstSourcePhongGD_Select.ElementAt(cmbPhongGD.SelectedIndex).KeywordStrings[3]; var results = dtSourceKhuVuc.AsEnumerable().Select(x => x).Where(x => x.Field <int>("ID_DVI").Equals(LNumber.StringToInt32(idPhongGiaoDich))).ToList(); if (!LObject.IsNullOrEmpty(results) && results.Count() > 0) { dtSourceKhuVuc_Select = results.CopyToDataTable(); grKhuVuc.ItemsSource = dtSourceKhuVuc_Select; } else { grKhuVuc.ItemsSource = null; } } grCum.ItemsSource = null; }
public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem) { TextBlock txtBlock = new TextBlock(); try { if (LObject.IsNullOrEmpty(DataMemberBinding)) { DataMemberBinding = new Binding(); } if (LObject.IsNullOrEmpty(DataMemberBinding.Source)) { DataMemberBinding.Source = dataItem; } if (LObject.IsNullOrEmpty(DieuKienDataBinding)) { DieuKienDataBinding = new Binding(); } if (LObject.IsNullOrEmpty(DieuKienDataBinding.Source)) { DieuKienDataBinding.Source = dataItem; } this.SetBinding(ColumnsComboBoxv3.DieuKienProperty, DieuKienDataBinding); this.SetBinding(ColumnsComboBoxv3.GiaTriProperty, DataMemberBinding); if (!LObject.IsNullOrEmpty(TruyVan)) { } if (!LObject.IsNullOrEmpty(DieuKien)) { } if (!LObject.IsNullOrEmpty(GiaTri)) { txtBlock.Text = GiaTri; } } catch (Exception ex) { } return(txtBlock); }
private bool Validation(ref string msgResult) { bool bResult = true; if (MaChiNhanh.Equals("")) { bResult = false; msgResult = "Chọn chi nhánh"; cmbChiNhanh.Focus(); return(bResult); } if (TuNgay.Equals("")) { bResult = false; msgResult = "Nhập từ ngày"; raddtTuNgay.Focus(); return(bResult); } if (DenNgay.Equals("")) { bResult = false; msgResult = "Nhập đến ngày"; raddtDenNgay.Focus(); return(bResult); } if (SoTienTu.Equals("")) { bResult = false; msgResult = "Nhập số tiền"; numSoTienTu.Focus(); return(bResult); } if (SoTienDen.Equals("")) { bResult = false; msgResult = "Nhập số tiền"; numSoTienDen.Focus(); return(bResult); } if (NgayBaoCao.Equals("")) { bResult = false; msgResult = "Nhập ngày báo cáo"; raddtNgayBaoCao.Focus(); return(bResult); } if (LObject.IsNullOrEmpty(lstMaPhongGiaoDich) || lstMaPhongGiaoDich.Count <= 0) { bResult = false; msgResult = "Chọn phòng giao dịch"; raddtNgayBaoCao.Focus(); return(bResult); } if (LObject.IsNullOrEmpty(lstMaSanPhamTinDung) || lstMaSanPhamTinDung.Count <= 0) { bResult = false; msgResult = "Chọn sản phẩm tín dụng"; raddtNgayBaoCao.Focus(); return(bResult); } return(bResult); }
private void BuildFormDieuKien() { Mouse.OverrideCursor = Cursors.Wait; try { if (grDSBaoCao.SelectedItems.Count > 0) { // Lấy báo cáo được chọn từ grid DataRowView dr = (DataRowView)grDSBaoCao.SelectedItem; int idBaoCao = int.Parse(dr[0].ToString()); int idBaoCaoCha = int.Parse(dr[4].ToString()); string maBaoCao = dr[2].ToString(); // Lấy thông tin báo cáo và tham số if (idBaoCaoCha != 0) { KhaiThacDuLieuProcess process = new KhaiThacDuLieuProcess(); ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG; List <HT_BAOCAO_TSO> lstBaoCaoTso = new List <HT_BAOCAO_TSO>(); DatabaseConstant.Action action = DatabaseConstant.Action.TRUY_VAN; string responseMessage = ""; process.DuLieuChiTieu(action, idBaoCao, ref htBaoCao, ref lstBaoCaoTso, ref responseMessage); string uriBaoCaoDieuKien = "/" + htBaoCao.NHOM_DIEUKIEN + ";component/" + htBaoCao.FILE_DIEUKIEN; uc = (UserControl)System.Windows.Application.LoadComponent(new Uri(uriBaoCaoDieuKien, System.UriKind.RelativeOrAbsolute)); if (!LObject.IsNullOrEmpty(uc.GetType().GetProperty("MaBaoCao"))) { uc.GetType().GetProperty("MaBaoCao").SetValue(uc, maBaoCao, null); } frFormInput.Content = uc; } } } catch (System.Exception ex) { CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } Mouse.OverrideCursor = Cursors.Arrow; }
/// <summary> /// Adds new elements to the end of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add</param> /// <returns>The new length</returns> public int Push(LObject target, params object[] elements) { if (elements == null || elements.Length == 0) { return(0); } // Add var list = target.GetValue() as IList; if (list == null) { return(0); } foreach (object elem in elements) { if (list.GetType().IsGenericType) { var gt = list.GetType().GetGenericArguments()[0]; if (gt != null && gt.FullName.StartsWith("ComLib.Lang")) { var langVal = LangTypeHelper.ConvertToLangValue(elem); list.Add(langVal); } else { list.Add(elem); } } else { var langType = LangTypeHelper.ConvertToLangValue(elem); list.Add(langType); } } return(list.Count); }
private static int RunSelect(Dictionary <int, LObject> lObjects) { int spSeqNo = 0; Dictionary <int, int> seq2id = new Dictionary <int, int>(); foreach (var lObject in lObjects) { Console.WriteLine(spSeqNo + "." + lObject.Value.Name); seq2id.Add(spSeqNo, lObject.Key); spSeqNo++; } int index = 0; bool isValid = false; while (!isValid) { Console.Write("Номер ответа: "); string output = Console.ReadLine(); if (int.TryParse(output, out index)) { if (index >= 0 && index < lObjects.Count()) { isValid = true; } } } LObject sItem = lObjects[seq2id[index]]; if (sItem.Data == null) { return(sItem.Id); } else { return(RunSelect(sItem.Data)); } }
public Constant(LObject constant) { if (constant is LNil) { type = 0; @bool = false; number = null; @string = null; } else if (constant is LBoolean) { type = 1; @bool = constant == LBoolean.LTRUE; number = null; @string = null; } else if (constant is LNumber) { type = 2; @bool = false; number = (LNumber)constant; @string = null; } else if (constant is LString) { type = 3; @bool = false; number = null; @string = ((LString)constant).deref(); } else if (constant == null) { throw new Exception("Constant is null!"); } else { throw new Exception("Illegal constant type: " + constant.ToString()); } }
private bool Validation() { try { if (cmbChiNhanh.SelectedIndex == -1) { LMessage.ShowMessage("M.ResponseMessage.BaoCao.ChuaChonChiNhanh", LMessage.MessageBoxType.Warning); cmbChiNhanh.Focus(); return(false); } if (cmbNhom.SelectedIndex == -1) { LMessage.ShowMessage("M.ResponseMessage.BaoCao.ChuaChonNhom", LMessage.MessageBoxType.Warning); cmbNhom.Focus(); return(false); } if (LObject.IsNullOrEmpty(ngaybaocao) || ngaybaocao.Equals("")) { LMessage.ShowMessage("M.ResponseMessage.BaoCao.ChuaChonNgayBaoCao", LMessage.MessageBoxType.Warning); raddtNgayBaoCao.Focus(); return(false); } if (grdDXVV.SelectedItems.Count < 1) { LMessage.ShowMessage("M.ResponseMessage.BaoCao.ChuaChonDXVV", LMessage.MessageBoxType.Warning); grdDXVV.Focus(); return(false); } } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); return(false); } return(true); }
public void SetDataForm(int id) { try { idKhuVuc = id; DM_KHU_VUC obj = new DanhMucProcess().getKhuVucById(idKhuVuc); if (!LObject.IsNullOrEmpty(obj)) { tthaiNVu = obj.TTHAI_NVU; txtMaKhuVuc.Text = obj.MA_KVUC; txtTenKhuVuc.Text = obj.TEN_KVUC; txtTenTat.Text = obj.TEN_TAT; lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(tthaiNVu); cmbDonVi.SelectedIndex = lstSourcePGD.IndexOf(lstSourcePGD.FirstOrDefault(e => e.KeywordStrings.First().Equals(obj.MA_DVI))); txtNguoiLap.Text = obj.NGUOI_NHAP; txtNgayLap.Value = LDateTime.StringToDate(obj.NGAY_NHAP, ApplicationConstant.defaultDateTimeFormat); txtNguoiDuyet.Text = obj.NGUOI_CNHAT; if (!obj.NGAY_CNHAT.IsNullOrEmptyOrSpace()) { txtNgayDuyet.Value = LDateTime.StringToDate(obj.NGAY_CNHAT, ApplicationConstant.defaultDateTimeFormat); } txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI); if (action.Equals(DatabaseConstant.Action.SUA)) { SetEnabledAllControls(true); } else { SetEnabledAllControls(false); } CommonFunction.RefreshButton(Toolbar, action, tthaiNVu, mnuMain, DatabaseConstant.Function.DC_DM_KHU_VUC); } } catch (System.Exception ex) { LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error); LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } }
private void grvDanhSachHDV_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { Mouse.OverrideCursor = Cursors.Wait; DataRowView drv = (DataRowView)grvDanhSachHDV.SelectedItem; DataSet ds = new KhaiThacDuLieuProcess().GetThongTinGiaoDichTietKiem(Convert.ToInt32(drv["ID"]), drv["SO_SO_TG"].ToString()); if (!LObject.IsNullOrEmpty(ds.Tables) && ds.Tables.Count > 0) { grvHuyDongGD.ItemsSource = ds.Tables["DANHSACH.GIAODICH"].DefaultView; } } catch (System.Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error); } finally { Mouse.OverrideCursor = Cursors.Arrow; } }
/// <summary> /// Adds new elements to the end of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add</param> /// <returns>The new length</returns> public int Push(LObject target, params object[] elements) { if (elements == null || elements.Length == 0) return 0; // Add var list = target.GetValue() as IList; if (list == null) return 0; foreach (var item in elements) { if (item == null) list.Add(LObjects.Null); else list.Add(item); } return list.Count; }
/// <summary> /// Joins all elements of an array into a string /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="separator">The separator to use for joining the elements.</param> /// <returns></returns> public string Join(LObject target, string separator = ",") { var list = target.GetValue() as IList; if (list == null || list.Count == 0) return string.Empty; var buffer = new StringBuilder(); var total = list.Count; var lobj = list[0] as LObject; if (lobj != null) buffer.Append(lobj.GetValue()); if (total > 1) { for (int ndx = 1; ndx < list.Count; ndx++) { lobj = list[ndx] as LObject; buffer.Append(separator + lobj.GetValue()); } } string result = buffer.ToString(); return result; }
/// <summary> /// Selects a part of an array, and returns the new array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="index">The index to remove</param> /// <returns>The object</returns> public LObject RemoveAt(LObject target, int index) { var list = target.GetValue() as IList; if (list == null || list.Count == 0) return LObjects.Null; var result = list[index]; list.RemoveAt(index); return result as LObject; }
public virtual void TopOn(LObject o) { LObject.TopOn(o, GetWidth(), GetHeight()); }
public virtual void BottomOn(LObject o) { LObject.BottomOn(o, GetWidth(), GetHeight()); }
/// <summary> /// Removes the last element of an array, and returns that element /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns>The removed element</returns> public object Pop(LObject target) { return this.RemoveLast(target); }
/// <summary> /// Removes the last element of an array, and returns that element /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns>The removed element</returns> public object Pop(LObject target) { var list = target.GetValue() as IList; var index = list.Count - 1; object toRemove = list[index]; list.RemoveAt(index); return toRemove; }
/// <summary> /// Selects a part of an array, and returns the new array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="start">The start of the selection</param> /// <param name="end">The end of the selection, if not supplied, selects all elements from start to end of the array</param> /// <returns>A new array</returns> public LObject Slice(LObject target, int start, int end) { var list = target.GetValue() as IList; var items = new List<object>(); if (end == -1) end = list.Count; for (var ndx = start; ndx < end; ndx++) items.Add(list[ndx]); return new LArray(items); }
/// <summary> /// Adds/Removes elements from an array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="index">The index position to add/remove</param> /// <param name="howmany">How many elements to remove, if 0 no elements are removed</param> /// <param name="elements">Optional: The elements to add</param> /// <returns></returns> public LObject Splice(LObject target, int index, int howmany, params object[] elements) { var list = target.GetValue() as IList; List<object> removed = null; if (howmany > 0) { removed = new List<object>(); for (int ndxRemove = index; ndxRemove < (index + howmany); ndxRemove++) { removed.Add(list[ndxRemove]); } RemoveRange(list, index, howmany); } if (elements != null && elements.Length > 0 ) { var lastIndex = index; for (var ndx = 0; ndx < elements.Length; ndx++) { object objToAdd = elements[ndx]; list.Insert(lastIndex, objToAdd); lastIndex++; } } return new LArray(removed); }
/// <summary> /// Removes the first element of an array, and returns that element /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns>The first element</returns> public object Shift(LObject target) { var list = target.GetValue() as IList; if (list.Count == 0) return null; object item = list[0]; list.RemoveAt(0); return item; }
/// <summary> /// Reverses the order of the elements in an array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns></returns> public LObject Reverse(LObject target) { var list = target.GetValue() as IList; int length = list.Count; if (length == 0 || length == 1) return null; // 2 or more. int highIndex = length - 1; int stopIndex = length / 2; if (length % 2 == 0) stopIndex--; for (int lowIndex = 0; lowIndex <= stopIndex; lowIndex++) { object tmp = list[lowIndex]; list[lowIndex] = list[highIndex]; list[highIndex] = tmp; highIndex--; } return target; }
/// <summary> /// Adds new elements to the end of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add</param> /// <returns>The new length</returns> public int Push(LObject target, params object[] elements) { if (elements == null || elements.Length == 0) return 0; // Add var list = target.GetValue() as IList; if (list == null) return 0; foreach (object elem in elements) { if(list.GetType().IsGenericType) { var gt = list.GetType().GetGenericArguments()[0]; if(gt != null && gt.FullName.StartsWith("ComLib.Lang")) { var langVal = LangTypeHelper.ConvertToLangValue(elem); list.Add(langVal); } else { list.Add(elem); } } else { var langType = LangTypeHelper.ConvertToLangValue(elem); list.Add(langType); } } return list.Count; }
/// <summary> /// Adds new elements to the end of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add</param> /// <returns>The new length</returns> public int Add(LObject target, params object[] elements) { if (elements == null || elements.Length == 0) return 0; // Add var list = target.GetValue() as IList; if (list == null) return 0; var table = target as LTable; var map = new LMap(new Dictionary<string, object>()); var ndx = 0; foreach(var field in table.Fields) { var val = elements[ndx]; map.Value[field] = val; ndx++; } list.Add(map); return list.Count; }
/// <summary> /// Lenght of the array. /// </summary> /// <param name="target">The target list to apply this method on.</param> public object First(LObject target) { var list = target.GetValue() as IList; if(list == null || list.Count == 0 ) return LObjects.Null; return list[0]; }
/// <summary> /// Adds new elements to the beginning of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add.</param> /// <returns>The new length</returns> public int UnShift(LObject target, params object[] elements) { var list = target.GetValue() as IList; if (list == null) return 0; if (elements == null || elements.Length == 0) return list.Count; for (var ndx = 0; ndx < elements.Length; ndx++) { object val = elements[ndx]; list.Insert(0, val); } return list.Count; }
/// <summary> /// Joins two or more arrays, and returns a copy of the joined arrays /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="item">The item to search for</param> /// <param name="start">The starting position of the search.</param> /// <returns>A copy of joined array</returns> public int LastIndexOf(LObject target, object item, int start) { var list = target.GetValue() as IList; var foundPos = -1; var total = list.Count; for(var ndx = start; ndx < total; ndx++) { var itemAt = list[ndx] as LObject; if (itemAt != null && itemAt.GetValue() == item) { foundPos = ndx; } } return foundPos; }
/// <summary> /// Lenght of the array. /// </summary> /// <param name="target">The target list to apply this method on.</param> public object Last(LObject target) { var list = target.GetValue() as IList; if (list == null || list.Count == 0) return LObjects.Null; var last = list.Count - 1; return list[last]; }
/// <summary> /// Selects a part of an array, and returns the new array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns>The object</returns> public LObject RemoveAll(LObject target) { var list = target.GetValue() as IList; if (list == null || list.Count == 0) return LObjects.Null; list.Clear(); return LObjects.Null; }
public virtual void CenterOn(LObject o) { LObject.CenterOn(o, GetWidth(), GetHeight()); }
/// <summary> /// Selects a part of an array, and returns the new array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns>The object</returns> public LObject RemoveLast(LObject target) { var list = target.GetValue() as IList; if (list == null || list.Count == 0) return LObjects.Null; var last = list.Count - 1; var result = list[last]; list.RemoveAt(last); return result as LObject; }
public virtual void RightOn(LObject o) { LObject.RightOn(o, GetWidth(), GetHeight()); }
/// <summary> /// Lenght of the array. /// </summary> /// <param name="target">The target list to apply this method on.</param> public int Length(LObject target) { var list = target.GetValue() as IList; return list.Count; }
public virtual void AddTouchLimit(LObject c) { if (c != null) { limits.Add(c.GetCollisionArea()); } }
/// <summary> /// Joins two or more arrays, and returns a copy of the joined arrays /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="arrays">Array of arrays to add</param> /// <returns>A copy of joined array</returns> public LObject Concat(LObject target, params object[] arrays) { if (arrays == null || arrays.Length == 0) return target; var list = target.GetValue() as IList; var copy = new List<object>(); AddRange(copy, list); for (var ndx = 0; ndx < arrays.Length; ndx++) { object item = arrays[ndx]; IList array = (IList)item; AddRange(copy, array); } return new LArray(copy); }
public virtual IObject Construct(IEnvironment environment, IArgs args) { var obj = new LObject(environment); obj.Class = "Object"; obj.Extensible = true; var proto = Get("prototype"); if (proto.TypeCode == LanguageTypeCode.Object) { obj.Prototype = (IObject)proto; } else { obj.Prototype = environment.ObjectPrototype; } var result = ((ICallable)this).Call(environment, obj, args); if (result.TypeCode == LanguageTypeCode.Object) { return (IObject)result; } return obj; }
public SLexicalEnvironment NewObjectEnvironment(LObject o) { Debug.Assert(o != null); return new SLexicalEnvironment(_environment, new SDeclarativeEnvironmentRecord(_environment), this); }