public override void SetModel(M_Base modelBase)
        {
            M_Department modelEntity = modelBase as M_Department;

            _model         = modelEntity;
            Id             = modelEntity.Id;
            DepartmentName = modelEntity.DepartmentName;
            Director       = modelEntity.Director;
            Employers      = modelEntity.Employee;
        }
        public override void SetModel(M_Base modelBase)
        {
            M_CalendarDate modelEntity = modelBase as M_CalendarDate;

            _model       = modelEntity;
            Id           = modelEntity.Id;
            Start        = modelEntity.Start;
            End          = modelEntity.End;
            NameEmployer = GetName(modelEntity.Employee?.PersonInfo);
            TypeDate     = modelEntity.TypeDate;
            _employer    = modelEntity?.Employee;
        }
Beispiel #3
0
        public static int Insert(M_Base data, SqlBase db)
        {
            SqlModel model = new SqlModel()
            {
                cmd = SqlCmd.Insert, tbName = data.TbName, pk = data.PK
            };

            model.AddSpToList(data.GetParameters());
            model.fields = DB.GetFields(data);
            model.values = DB.GetParams(data);
            PreSPList(model);
            return(db.InsertID(model));
        }
Beispiel #4
0
        /// <summary>
        /// 获取字段=参数(Update)
        /// </summary>
        public static string GetFieldAndPara(M_Base model)
        {
            string str = string.Empty, PK = model.PK.ToLower();

            string[,] strArr = model.FieldList();
            for (int i = 0; i < strArr.GetLength(0); i++)
            {
                if (strArr[i, 0].ToLower() != PK)
                {
                    str += "[" + strArr[i, 0] + "]=@" + strArr[i, 0] + ",";
                }
            }
            return(str.Substring(0, str.Length - 1));
        }
Beispiel #5
0
        public override string GetParams(M_Base model)
        {
            string str = string.Empty, PK = model.PK.ToLower();

            string[,] strArr = model.FieldList();
            for (int i = 0; i < strArr.GetLength(0); i++)
            {
                if (strArr[i, 0].ToLower() != PK)
                {
                    str += "@" + strArr[i, 0] + ",";//:
                }
            }
            return(str.Substring(0, str.Length - 1));
        }
Beispiel #6
0
        public static bool UpdateByID(M_Base data, int id)
        {
            SqlModel model = new SqlModel()
            {
                cmd    = SqlCmd.Update,
                tbName = data.TbName,
                pk     = data.PK
            };

            model.AddSpToList(data.GetParameters());
            model.sql = "UPDATE " + data.TbName + " SET " + DB.GetFieldAndParam(data) + " WHERE " + data.PK + "=" + id;
            PreSPList(model);
            DB.ExecuteNonQuery(model);
            return(true);
        }
Beispiel #7
0
 public override void SetModel(M_Base model)
 {
     throw new NotImplementedException();
 }
Beispiel #8
0
 public static int Insert(M_Base data)
 {
     return(Insert(data, DBCenter.DB));
 }
Beispiel #9
0
 public abstract string GetFieldAndParam(M_Base model);
Beispiel #10
0
 public abstract string GetParams(M_Base model);
Beispiel #11
0
 public abstract string GetFields(M_Base model);
Beispiel #12
0
 public abstract void SetModel(M_Base model);
Beispiel #13
0
 public ViewModel(M_Base model)
 {
     SetModel(model);
 }