Exemplo n.º 1
0
        public int delete(int id)
        {
            BasicInfoEntity entity   = new BasicInfoEntity();
            string          delQuery = "delete from " + entity.TableName + " where " + entity.IndexFieldName + "=" + provider.getSQLString(id);

            return(provider.delete(delQuery));
        }
Exemplo n.º 2
0
        public int getId(string englishName)
        {
            BasicInfoEntity entity = new BasicInfoEntity();
            string          cond   = BasicInfoEntity.FIELD_ENGLISHNAME + "=" + RMX_TOOLS.data.Config.provider.getSQLString(englishName);

            load(entity, cond);
            return(int.Parse(entity.Tables[entity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_ID].ToString()));
        }
Exemplo n.º 3
0
 public BasicInfoList()
 {
     InitializeComponent();
     _basicInfoEntity = new BasicInfoEntity();
     _basicInfoBl     = new BasicInfoBL();
     _gridTools       = new GridTools();
     fillGrid();
 }
Exemplo n.º 4
0
        public BasicInfoEntity getRoots()
        {
            BasicInfoEntity entity = new BasicInfoEntity();
            string          cond   = BasicInfoEntity.FIELD_PARENT_ID + " is null AND ID > 0";

            load(entity, cond);
            return(entity);
        }
Exemplo n.º 5
0
        public BasicInfoEntity getByEnglishName(string englishName)
        {
            BasicInfoEntity entity = new BasicInfoEntity();
            string          cond   = BasicInfoEntity.FIELD_ENGLISHNAME + "=" + data.Config.provider.getSQLString(englishName);

            load(entity, cond);
            return(entity);
        }
Exemplo n.º 6
0
        public string getCustomData(string englishName)
        {
            BasicInfoEntity entity = new BasicInfoEntity();
            string          cond   = BasicInfoEntity.FIELD_ENGLISHNAME + "=" + RMX_TOOLS.data.Config.provider.getSQLString(englishName);

            load(entity, cond);
            return(entity.Tables[entity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_CUSTOMFIELD].ToString());
        }
Exemplo n.º 7
0
        public BasicInfoEntity get()
        {
            BasicInfoEntity entity = new BasicInfoEntity();

            // string cond = "ACTIVE = 1";
            load(entity);
            return(entity);
        }
Exemplo n.º 8
0
        public int updateCustomData(int id, string customData)
        {
            BasicInfoEntity entity = new BasicInfoEntity();
            string          q      = "UPDATE " + entity.TableName + " SET " +
                                     BasicInfoEntity.FIELD_CUSTOMFIELD + "=" + dp.getSQLString(customData) + " WHERE " +
                                     BasicInfoEntity.FIELD_ID + "=" + dp.getSQLString(id);

            return(provider.executeNonQuery(q));
        }
Exemplo n.º 9
0
        public BasicInfoEntity get(int id)
        {
            BasicInfoEntity entity = new BasicInfoEntity();
            string          cond   = BasicInfoEntity.FIELD_ID + "=" + RMX_TOOLS.data.Config.provider.getSQLString(id);

            load(entity, cond);

            return(entity);
        }
Exemplo n.º 10
0
        public BasicInfoEntity getByParentId(int parentId, bool showInactives)
        {
            BasicInfoEntity entity = new BasicInfoEntity();
            string          cond   = BasicInfoEntity.FIELD_PARENT_ID + "=" + data.Config.provider.getSQLString(parentId);

            if (!showInactives)
            {
                cond += " AND " + BasicInfoEntity.FIELD_ACTIVE + " = " + 1;
            }
            load(entity, cond);
            return(entity);
        }
Exemplo n.º 11
0
        private void fillGrid(int parentId)
        {
            System.Collections.Hashtable hash = new Hashtable();
            //hash.Add("colorField", InsuranceTypeData.INSURANCETYPECOLOR_FIELD);
            if (parentId < 0)
            {
                _basicInfoEntity = _basicInfoBl.getRoots();
            }
            else
            {
                _basicInfoEntity = _basicInfoBl.getByParentId(parentId, true);
            }

            _gridTools.bindDataToGrid(dataGridView1, _basicInfoEntity, new GridTools.changingRow(_gridTools.changeColor), hash);
        }
Exemplo n.º 12
0
 public void intiForm()
 {
     if (Constants.DELETE_MODE.Equals(Mode))
     {
         pnlContainer.Visible = false;
         btnSave.Visible      = false;
         if (Id < 0)
         {
             return;
         }
         _entity = _basicInfoBL.get(_id);
         string s = _entity.get(BasicInfoEntity.FIELD_USERCANCHANGE).ToString();
         bool   b = false;
         if (s != null && s.Length > 0)
         {
             b = Boolean.Parse(s);
         }
         if (b)
         {
             lblMsg.ForeColor = Color.Red;
             lblMsg.Text      = "امکان حذف این مورد وجود ندارد";
             return;
         }
         doDelete();
         return;
     }
     if (_entity != null)
     {
         _id   = int.Parse(_entity.get(BasicInfoEntity.FIELD_ID).ToString());
         _mode = RMX_TOOLS.global.Constants.EDIT_MODE;
     }
     else if (_id > 0)
     {
         _mode   = RMX_TOOLS.global.Constants.EDIT_MODE;
         _entity = _basicInfoBL.get(_id);
         loadForm();
     }
     else
     {
         _mode   = RMX_TOOLS.global.Constants.ADD_MODE;
         _entity = new BasicInfoEntity();
     }
 }
Exemplo n.º 13
0
        public void load()
        {
            int             biId   = _basicInfoBL.getId(_engName);
            BasicInfoEntity entity = _basicInfoBL.getByParentId(biId);
            CheckBox        cb;

            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                string desc = entity.get(i, BasicInfoEntity.FIELD_DESCRIPTION).ToString();
                int    id   = int.Parse(entity.get(i, BasicInfoEntity.FIELD_ID).ToString());

                cb         = new CheckBox();
                cb.Checked = false;
                cb.Tag     = id;
                cb.Text    = desc;
                cb.Height  = 20;
                cb.Width   = flowLayoutPanel1.Width - 5;
                flowLayoutPanel1.Controls.Add(cb);
            }
        }
Exemplo n.º 14
0
        public static void fillCheckBoxList(CheckedListBox cmb, string englishName, int defaultItemId)
        {
            BasicInfoEntity entity = _basicInfoBL.getByEnglishName(englishName);

            fillCheckBoxList(cmb, int.Parse(entity.get(BasicInfoEntity.FIELD_ID).ToString()), defaultItemId);
        }
Exemplo n.º 15
0
 /*public BasicInfoEntity get(int id)
  * {
  *  BasicInfoEntity entity = new BasicInfoEntity();
  *  string cond = BasicInfoEntity.FIELD_ID + "=" + dp.getSQLString(id);
  *  dp.loadToDataSet(BasicInfoEntity.TABLE, entity, "");
  *  return entity;
  * }
  */
 public int add(BasicInfoEntity basicInfoEntity)
 {
     return(dp.add(basicInfoEntity));
 }
Exemplo n.º 16
0
 public int add(BasicInfoEntity entity)
 {
     return(_basicInfoDA.add(entity));
 }
Exemplo n.º 17
0
 public int update(BasicInfoEntity entity)
 {
     return(_basicInfoDA.update(entity));
 }
Exemplo n.º 18
0
        public static void fillComboBox(ComboBox cmb, int parentId, int defaultItemId)
        {
            BasicInfoEntity parentEntity    = _basicInfoBL.get(parentId);
            Boolean         containsUnknown = false;
            string          c = parentEntity.get(BasicInfoEntity.FIELD_CONTAINUNKNOWN).ToString();

            if (c != null && c.Trim().Length > 0)
            {
                containsUnknown = Boolean.Parse(c);
            }

            BasicInfoEntity entity     = _basicInfoBL.getByParentId(parentId);
            var             dataSource = new List <ComboBoxItem>();

            try
            {
                cmb.Items.Clear();
            }
            catch (Exception ex) { }
            if (containsUnknown == true)
            {
                AddUnKnown(dataSource);
            }

            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                string id         = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_ID].ToString();
                string desc       = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_DESCRIPTION].ToString();
                string customData = "";
                if (entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_CUSTOMFIELD] != null)
                {
                    customData = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_CUSTOMFIELD].ToString();
                }

                dataSource.Add(new ComboBoxItem(desc, id, customData));
            }

            // is inActive? or not
            BasicInfoEntity niEntity = _basicInfoBL.get(defaultItemId);

            if (niEntity.Tables[niEntity.FilledTableName].Rows.Count > 0)
            {
                bool isActive = bool.Parse(niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_ACTIVE].ToString());;
                if (isActive == false)
                {
                    string id         = niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_ID].ToString();
                    string desc       = niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_DESCRIPTION].ToString();
                    string customData = "";
                    if (niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_CUSTOMFIELD] != null)
                    {
                        customData = niEntity.Tables[entity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_CUSTOMFIELD].ToString();
                    }

                    dataSource.Add(new ComboBoxItem(desc, id, customData));
                }
            }
            cmb.DataSource    = dataSource;
            cmb.DisplayMember = "Text";
            cmb.ValueMember   = "Value";

            for (int i = 0; i < cmb.Items.Count; i++)
            {
                if (((ComboBoxItem)cmb.Items[i]).Value.Equals(defaultItemId.ToString()))
                {
                    cmb.SelectedIndex = i;
                    break;
                }
            }
        }
Exemplo n.º 19
0
        public static int getId(string englishName)
        {
            BasicInfoEntity entity = _basicInfoBL.getByEnglishName(englishName);

            return(int.Parse(entity.Tables[entity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_ID].ToString()));
        }