Ejemplo n.º 1
0
        /// <summary>
        /// page load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ColumnAddOrEdit_Load(object sender, EventArgs e)
        {
            #region variable define
            DataSet dataDsBack = new DataSet(); //dataset to receive result of adding new category info
            DataSet dataDsFrom = new DataSet(); //dataset to pass to remoting method
            #endregion

            //set group name and status
            this.tbType.Enabled = false;
            this.tbType.Text    = categoryKey;

            //if edit the data change the title of window
            if (deal == "edit")
            {
                //set title when edit the column
                this.Text = StringParser.Parse("${res:FanHai.Hemera.Addins.BasicData.BasicSettingsDetail.GroupControlText}");
                //initial data which need to be changed
                //get data from db
                DataSet dataDS = new DataSet(); //dataset to receive category information
                //set attribute_key of entity
                baseAttributeEntity.AttributeKey = attributeId;
                try
                {
                    //get data
                    dataDS = baseAttributeEntity.GetColumnInfoByAttributeKey();
                    //check result
                    if (baseAttributeEntity.ErrorMsg == "")
                    {
                        //insert data to controls
                        this.tbColumnKey.Text = baseAttributeEntity.AttributeKey;                              //Column Key
                        this.tbName.Text      = dataDS.Tables[0].Rows[0]["ATTRIBUTE_NAME"].ToString();         //column name
                        //this.cbbDataType.SelectedText = GetDataType(dataDS.Tables[0].Rows[0]["DATA_TYPE"].ToString());//DATA_TYPE name
                        this.cbbDataType.Text = GetDataType(dataDS.Tables[0].Rows[0]["DATA_TYPE"].ToString()); //DATA_TYPE name
                        this.tbDesc.Text      = dataDS.Tables[0].Rows[0]["DESCRIPTION"].ToString();            //add by vicky
                    }
                    else
                    {
                        MessageService.ShowError(baseAttributeEntity.ErrorMsg);
                        this.Close();
                    }
                }
                catch (Exception ee)
                {
                    MessageService.ShowError(ee.Message);
                    this.Close();
                }
            }
        }