Example #1
0
        public bool SaveData(T_System model, ref string ErrMsg)
        {
            try
            {
                string strSql = String.Empty;

                if (model.id == 0)
                {
                    int id = GetID();
                    strSql = "insert into T_System (id, filepath, companyname,remark, remark1, remark2, remark3, remark4, remark5, remark6, remark7, remark8, remark9)" +
                             "values ('" + id + "', '"
                             + model.filepath + "','"
                             + model.companyname + "','"
                             + model.remark + "','"
                             + model.remark1 + "','"
                             + model.remark2 + "','"
                             + model.remark3 + "','"
                             + model.remark4 + "','"
                             + model.remark5 + "','"
                             + model.remark6 + "','"
                             + model.remark7 + "','"
                             + model.remark8 + "','"
                             + model.remark9 + "' )";
                }
                else
                {
                    strSql = "update T_System a set a.filepath = '" + model.filepath + "',a.companyname =  '" + model.companyname + "',a.remark= '" + model.remark + "',a.remark1= '" + model.remark1
                             + "',a.remark2= '" + model.remark2 + "',a.remark3= '" + model.remark3 + "',a.remark4= '" + model.remark4 + "',a.remark5= '" + model.remark5
                             + "',a.remark6= '" + model.remark6 + "',a.remark7 = '" + model.remark7 + "' ,a.remark8 = '" + model.remark8 + "' ,a.remark9= '" + model.remark9 + "' where a.Id = '" + model.id + "'";
                }

                int i = dbFactory.ExecuteNonQuery(System.Data.CommandType.Text, strSql);
                if (i == -2)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                ErrMsg = ex.Message;
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 将获取的单条数据转封装成对象返回
        /// </summary>
        private T_System ToModel(IDataReader reader)
        {
            T_System model = new T_System();

            model.id          = dbFactory.ToModelValue(reader, "ID").ToInt32();
            model.filepath    = dbFactory.ToModelValue(reader, "filepath").ToDBString();
            model.companyname = dbFactory.ToModelValue(reader, "companyname").ToDBString();
            model.remark      = dbFactory.ToModelValue(reader, "remark").ToDBString();
            model.remark1     = dbFactory.ToModelValue(reader, "remark1").ToDBString();
            model.remark2     = dbFactory.ToModelValue(reader, "remark2").ToDBString();
            model.remark3     = dbFactory.ToModelValue(reader, "remark3").ToDBString();
            model.remark4     = dbFactory.ToModelValue(reader, "remark4").ToDBString();
            model.remark5     = dbFactory.ToModelValue(reader, "remark5").ToDBString();
            model.remark6     = dbFactory.ToModelValue(reader, "remark6").ToDBString();
            model.remark7     = dbFactory.ToModelValue(reader, "remark7").ToDBString();
            model.remark8     = dbFactory.ToModelValue(reader, "remark8").ToDBString();
            model.remark9     = dbFactory.ToModelValue(reader, "remark9").ToDBString();
            return(model);
        }
Example #3
0
        public bool SaveData(T_System model, ref string strError)
        {
            T_System_DB db = new T_System_DB();

            return(db.SaveData(model, ref strError));
        }