Example #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.Sys.Tb_Sys_Organ GetModel(string OrganCode)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrganCode", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = OrganCode;

            MobileSoft.Model.Sys.Tb_Sys_Organ model = new MobileSoft.Model.Sys.Tb_Sys_Organ();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Sys_Organ_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.OrganCode = ds.Tables[0].Rows[0]["OrganCode"].ToString();
                model.OrganName = ds.Tables[0].Rows[0]["OrganName"].ToString();
                if (ds.Tables[0].Rows[0]["IsDelete"].ToString() != "")
                {
                    model.IsDelete = int.Parse(ds.Tables[0].Rows[0]["IsDelete"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsComp"].ToString() != "")
                {
                    model.IsComp = int.Parse(ds.Tables[0].Rows[0]["IsComp"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Num"].ToString() != "")
                {
                    model.Num = int.Parse(ds.Tables[0].Rows[0]["Num"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MobileSoft.Model.Sys.Tb_Sys_Organ model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@OrganCode", SqlDbType.NVarChar, 20),
                new SqlParameter("@OrganName", SqlDbType.NVarChar, 50),
                new SqlParameter("@IsDelete",  SqlDbType.SmallInt,  2),
                new SqlParameter("@IsComp",    SqlDbType.SmallInt,  2),
                new SqlParameter("@Num",       SqlDbType.SmallInt, 2)
            };
            parameters[0].Value = model.OrganCode;
            parameters[1].Value = model.OrganName;
            parameters[2].Value = model.IsDelete;
            parameters[3].Value = model.IsComp;
            parameters[4].Value = model.Num;

            DbHelperSQL.RunProcedure("Proc_Tb_Sys_Organ_Update", parameters, out rowsAffected);
        }