Exemplo n.º 1
0
        public void SetNewSysCodeByCode(string tableName, object code)
        {
            string text      = code.ToString();
            string keyvalues = this.ReturnSyscodeName(tableName);

            using (SingleEntityDAO ydao = new SingleEntityDAO("SysCode"))
            {
                EntityData entity = ydao.SelectbyPrimaryKey(keyvalues);
                if (!entity.HasRecord())
                {
                    SystemManageDAO.GetNewSysCode(keyvalues);
                }
                else
                {
                    string text3 = entity.GetString("CodeRule");
                    if ((text3.Length > 0) & !code.Equals(0))
                    {
                        int count = text3.Split("+".ToCharArray())[0].Length;
                        text = text.Remove(0, count).Trim().ToString();
                    }
                }
                int num2 = Convert.ToInt32(text);
                if (num2 <= 0)
                {
                    DataRow newRecord = entity.GetNewRecord();
                    num2 = 0x186a1;
                    entity.CurrentRow["CodeValue"] = num2;
                }
                else if (num2 > ((int)entity.CurrentRow["CodeValue"]))
                {
                    entity.CurrentRow["CodeValue"] = num2;
                }
                SystemManageDAO.UpdateSysCode(entity);
                entity.Dispose();
            }
        }