Example #1
0
 private void LoadTreeDDL()
 {
     try
     {
         Data  objdata = new Data(Global.ConnectionSql);
         Types obj     = new Types();
         obj.DataObject = objdata;
         ddlTypes.Items.Clear();
         TypesCollection col = obj.Getlist(string.Empty);
         if (col == null)
         {
             return;
         }
         ddlTypes.DataSource     = col;
         ddlTypes.DataTextField  = "TypeName";
         ddlTypes.DataValueField = "TypeID";
         ddlTypes.DataBind();
     }
     catch (Exception ex)
     {
         Global.WriteLogError("Load DDLTYpe () " + ex);
         lblmessage.Text = "Lỗi xảy ra trong quá trình lưu dữ liệu. Liên hệ với người quản trị để khắc phục";
         mdPopup.Show();
     }
 }
Example #2
0
        public void AddGroup()
        {
            TypesCollection Types = new TypesCollection();

            Types.Add(new SignedType("Int1"), new SignedType("Int2"));
            Assert.AreEqual(2, Types.Count);
        }
Example #3
0
 private void BindingData()
 {
     try
     {
         TypesCollection col = null;
         col = this.LoadData(string.Empty);
         if (col == null)
         {
             col                = new TypesCollection();
             lblCount.Text      = "Có 0" + " record";
             rptData.DataSource = col;
             rptData.DataBind();
         }
         else
         {
             lblCount.Text          = "Có " + col.Count.ToString() + " record";
             lblCount.ForeColor     = System.Drawing.Color.Blue;
             anpPager.RecordCount   = col.Count;
             anpPager.PageSize      = Convert.ToInt32(ddlPageSize.SelectedValue);
             anpPager.ShowFirstLast = false;
             col = this.GetSubData(col, anpPager.StartRecordIndex - 1, anpPager.EndRecordIndex);
             rptData.DataSource = col;
             rptData.DataBind();
         }
     }
     catch (Exception ex)
     {
         Global.WriteLogError("BindingData()" + ex);
     }
 }
 public void Delete()
 {
     if (SelectedType == null)
     {
         return;
     }
     TypeRepository.Delete(SelectedType);
     TypesCollection.Remove(TypesCollection.First(o => o.Id == SelectedType.Id));
 }
Example #5
0
        public void Add()
        {
            TypesCollection Types = new TypesCollection(new SignedType("Integer"));

            Assert.AreEqual(1, Types.Count);
            Types.Add(new FloatType("Float", 8));
            Assert.AreEqual(2, Types.Count);
            Types.Add(new FloatType("Float", 8, 0.0, 8.0));             // This should join, not add
            Assert.AreEqual(2, Types.Count);
        }
Example #6
0
        public BindingsObjectProvider(List <KeyValuePair <Type, BindingDescription> > source)
        {
            var sourceDictionary = new Dictionary <Type, BindingDescriptionOrdered>();

            for (int i = 0; i < source.Count; i++)
            {
                sourceDictionary.Add(source[i].Key, new BindingDescriptionOrdered(source[i].Value, i));
            }
            _typesCollection = new TypesCollection(sourceDictionary);
        }
Example #7
0
        public void Indexer()
        {
            SignedType      Integer = new SignedType("Integer");
            ModularType     Modular = new ModularType("Modular", 2 ^ 32);
            TypesCollection Types   = new TypesCollection(Integer, Modular);

            Assert.AreEqual(Integer, Types["Integer"]);
            Assert.AreEqual(Modular, Types["Modular"]);
            Types.Add(new FloatType("Float", 8));
            Assert.AreEqual(new FloatType("Float", 8), Types["Float"]);
            Types.Add(new FloatType("Float", 8, 0.0, 8.0));             // This should join, not add
            Assert.AreNotEqual(new FloatType("Float", 8), Types["Float"]);
            Assert.AreEqual(new FloatType("Float", 8, 0.0, 8.0), Types["Float"]);
        }
        public void Add()
        {
            if (string.IsNullOrEmpty(NewType))
            {
                return;
            }
            var etvm = new EquipmentTypeViewModel()
            {
                Name = NewType
            };

            TypeRepository.Add(etvm);
            TypesCollection.Add(TypeRepository.GetAll().First(o => o.Name == etvm.Name));
        }
Example #9
0
    private TypesCollection GetSubData(TypesCollection Source, int start, int end)
    {
        int             iTotalRecord = Source.Count;
        TypesCollection subSource    = new TypesCollection();

        if (Source != null)
        {
            for (int i = start; i < end; i++)
            {
                subSource.Add(Source[i]);
            }
        }
        return(subSource);
    }
Example #10
0
        public void Combine()
        {
            TypesCollection Types1        = new TypesCollection(new SignedType("Int1"), new SignedType("Int2"));
            TypesCollection Types2        = new TypesCollection(new ModularType("Mod1"), new ModularType("Mod2"));
            TypesCollection CombinedTypes = new TypesCollection();

            Assert.AreEqual(0, CombinedTypes.Count);
            CombinedTypes.Add(Types1);
            Assert.AreEqual(2, CombinedTypes.Count);
            CombinedTypes.Add(Types2);
            Assert.AreEqual(4, CombinedTypes.Count);
            CombinedTypes.Add();
            Assert.AreEqual(4, CombinedTypes.Count);
            CombinedTypes.Add(new TypesCollection());
            Assert.AreEqual(4, CombinedTypes.Count);
        }
Example #11
0
    private TypesCollection LoadData(string stextsearch)
    {
        TypesCollection col = null;

        try
        {
            Data  objdata = new Data(Global.ConnectionSql);
            Types obj     = new Types();
            obj.DataObject = objdata;
            col            = obj.Getlist(stextsearch);
        }
        catch (Exception ex)
        {
            Global.WriteLogError("LoadCategory()" + ex);
        }
        return(col);
    }
Example #12
0
        public void Constructor()
        {
            TypesCollection Types = new TypesCollection(new SignedType("Integer"));

            Assert.AreEqual(1, Types.Count);
        }