Beispiel #1
0
        public string GetNextCode(string pCode)
        {
            string result = "001";

            pCode = string.IsNullOrEmpty(pCode) ? string.Empty : pCode;
            object obj = new DictionaryDA().GetMaxCode(pCode);

            if (obj == null)
            {
                return(result);
            }

            if (string.IsNullOrEmpty(pCode))
            {
                result = (int.Parse(obj.ToString().Substring(0, 3)) + 1).ToString("000");
            }
            else
            {
                string strTemp = obj.ToString();
                strTemp = string.IsNullOrEmpty(strTemp) ? "000" : strTemp;
                result  = pCode + (int.Parse(strTemp.Substring(strTemp.Length - 3)) + 1).ToString("000");
            }

            return(result);
        }
Beispiel #2
0
        public bool Add(DictionaryModel model, Guid userID, DateTime dt)
        {
            int iCount = new DictionaryDA().Add(model.DicCode, model.EN_Name, model.CHS_Name, model.CHT_Name
                                                , model.ParentCode, model.Remark, model.Index
                                                , model.IsDisable, userID, dt
                                                , model.Extend1, model.Extend2, model.Extend3, model.Extend4);

            return(iCount > 0 ? true : false);
        }
Beispiel #3
0
        public DictionaryModel GetByID(string code)
        {
            DictionaryModel model = new DictionaryModel();

            code = string.IsNullOrEmpty(code) ? string.Empty : code;
            DataSet ds = new DictionaryDA().Get(code);

            model = ds.ToList <DictionaryModel>().FirstOrDefault();
            return(model);
        }
Beispiel #4
0
        public IList <DictionaryVM> GetList(string pCode, bool?isDisable, string localization)
        {
            IList <DictionaryVM> list = new List <DictionaryVM>();

            pCode = string.IsNullOrEmpty(pCode) ? string.Empty : pCode;
            DataSet ds = new DictionaryDA().GetByParent(pCode, isDisable, localization);

            list = ds.ToList <DictionaryVM>();

            return(list);
        }
Beispiel #5
0
        public IList <DictionaryModel> GetList(string pCode)
        {
            IList <DictionaryModel> list = new List <DictionaryModel>();

            pCode = string.IsNullOrEmpty(pCode) ? string.Empty : pCode;
            DataSet ds = new DictionaryDA().GetByParent(pCode);

            list = ds.ToList <DictionaryModel>();

            return(list);
        }
Beispiel #6
0
        public bool Update(DictionaryModel model, Guid userID, DateTime dt)
        {
            if (model == null || string.IsNullOrEmpty(model.DicCode))
            {
                return(false);
            }
            bool result = new DictionaryDA().Update(model.DicCode, model.EN_Name, model.CHS_Name, model.CHT_Name
                                                    , model.ParentCode, model.Remark, model.Index
                                                    , model.IsDisable, userID, DateTime.Now
                                                    , model.Extend1, model.Extend2, model.Extend3, model.Extend4);

            return(result);
        }
Beispiel #7
0
        public static List <Dictionary> GetList(string where)
        {
            List <Dictionary> dictionaryList = new List <Dictionary>();

            foreach (DictionaryDA dictionaryDA in DictionaryDA.FindAll(where))
            {
                Dictionary dictionary = new Dictionary(dictionaryDA);

                dictionaryList.Add(dictionary);
            }

            dictionaryList.Sort();

            return(dictionaryList);
        }
Beispiel #8
0
        public bool Delete()
        {
            try
            {
                foreach (DictionaryDA dictionaryDA in DictionaryDA.FindAll(string.Format("where [ParentID]={0}", ID)))
                {
                    dictionaryDA.Delete();
                    dictionaryDA.Save();
                }

                m_DictionaryDA.Delete();
                m_DictionaryDA.Save();
                return(true);
            }
            catch (Exception exception)
            {
                Loger.Instance.WriteErrorLog(exception.Message);
                return(false);
            }
        }
Beispiel #9
0
        public bool Delete(string code)
        {
            int iCount = new DictionaryDA().Delete(code);

            return(iCount > 0 ? true : false);
        }
Beispiel #10
0
 public void Retrieve(int id)
 {
     m_DictionaryDA = DictionaryDA.Get(id);
 }
Beispiel #11
0
 private Dictionary(DictionaryDA dictionaryDA)
 {
     m_DictionaryDA = dictionaryDA;
 }
Beispiel #12
0
 public Dictionary()
 {
     m_DictionaryDA = new DictionaryDA();
 }