protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if ((bool)HttpContext.Current.Session["_isEdit"] == false) // Add
                {
                    //Controls Visibility
                    cmbPARENT.Visible = true;
                    txtParent.Visible = false;
                    txtMACODE.ReadOnly = false;

                    ParentIdDataSourceComboBoxCollection parent = new ParentIdDataSourceComboBoxCollection();
                    parent.LoadAll();
                    //Parent
                    cmbPARENT.Items.Clear();
                    cmbPARENT.SelectedValue = null;
                    cmbPARENT.DataSource = parent;
                    cmbPARENT.DataTextField = "KaCode";
                    cmbPARENT.DataValueField = "KaName";
                    //Group MA
                    GroupMACollection gm = new GroupMACollection();
                    gm.LoadAll();
                    cmbGROUP.DataSource = gm;
                    cmbGROUP.DataTextField = "GtCode";
                    cmbGROUP.DataValueField = "GtCode";
                    //Level
                    LevelMACollection lma = new LevelMACollection();
                    lma.LoadAll();
                    cmbLEVEL.DataSource = lma;
                    cmbLEVEL.DataTextField = "Level";
                    cmbLEVEL.DataValueField = "Id";
                    //Type
                    DebitKreditCollection dK = new DebitKreditCollection();
                    dK.LoadAll();
                    cmbTYPE.DataSource = dK;
                    cmbTYPE.DataTextField = "Type";
                    cmbTYPE.DataValueField = "Type";
                }
                else // Edit
                {
                    //Controls Visibility
                    cmbPARENT.Visible = false;
                    txtParent.Visible = true;
                    txtMACODE.ReadOnly = true;
                    //Group MA
                    GroupMACollection gm = new GroupMACollection();
                    gm.LoadAll();
                    cmbGROUP.DataSource = gm;
                    cmbGROUP.DataTextField = "GtCode";
                    cmbGROUP.DataValueField = "GtCode";
                    //Level
                    LevelMACollection lma = new LevelMACollection();
                    lma.LoadAll();
                    cmbLEVEL.DataSource = lma;
                    cmbLEVEL.DataTextField = "Level";
                    cmbLEVEL.DataValueField = "Id";
                    //Type
                    DebitKreditCollection dK = new DebitKreditCollection();
                    dK.LoadAll();
                    cmbTYPE.DataSource = dK;
                    cmbTYPE.DataTextField = "Type";
                    cmbTYPE.DataValueField = "Type";
                }
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }
Exemple #2
0
 virtual public void Combine(ParentIdDataSourceComboBoxCollection collection)
 {
     base.Combine(collection);
 }