public static bool  AddNewDepartment(string name, string content = "")
        {
            QcDepartment d   = new QcDepartment(name, content);
            bool         ret = d.Update();

            return(ret);
        }
Exemple #2
0
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            //return base.ConvertTo(context, culture, value, destinationType);
            QcDepartment d = QcDepartment.GetDepartmentFromCode(value.ToString());

            return((d == null) ? "" : d.Name);
        }
        static private void InitDepartment()
        {
            lstDepartment = new List <QcDepartment>();
            var Departments = DbHelper.Query("select * from QC_USE_Department");

            foreach (var v in Departments)
            {
                var qp = new QcDepartment(v);
                lstDepartment.Add(qp);
            }
        }
        public override bool Update(QcDbTransaction trans = null)
        {
            if (IsNew())
            {
                this.Code = QcDepartment.GetNextCode();
            }
            bool ret = base.Update(trans);

            if (ret == false && IsNew())
            {
                this.Code = "";
            }
            if (!Departments.Contains(this))
            {
                Departments.Add(this);
            }
            return(ret);
        }
Exemple #5
0
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            QcDepartment d = QcDepartment.GetDepartmentFromName(value.ToString());

            return((d == null) ? "" : d.Code);
        }