示例#1
0
        /// <summary>
        /// Adds the Asset, returns the inserted assetname's Id
        /// and gets the required info of that asset
        /// </summary>
        /// <param name="aavm">AddAssetViewModel</param>
        /// <returns>AssetViewModel avmobj as a single row object</returns>
        public AssetViewModel AddAssetReturn(AddAssetViewModel aavm)
        {
            long assetCategoryId = Int64.Parse(aavm.AssetCategoryName);
            var  assetName       = aavm.AssetName;
            var  modelNo         = aavm.ModelNo;
            var  manufacturer    = aavm.Manufacturer;
            var  configInfo      = aavm.ConfigurationInfo;
            var  status          = aavm.Status;

            var assetId = (Int64)ado.ExecScalar(
                String.Format(
                    @"  INSERT INTO {0} (AssetCategoryId, Name, Model, Manufacturer, ConfigurationInfo, Status) 
                    OUTPUT Inserted.ID, Inserted.Name 
                    VALUES ({1}, '{2}', '{3}', '{4}', '{5}', {6})",
                    TableConstant.TBL_ASSET,
                    assetCategoryId,
                    assetName,
                    modelNo,
                    manufacturer,
                    configInfo,
                    status
                    ));

            var avmobj = (AssetViewModel)this.GetAssetInfo().Select(
                x => new AssetViewModel
            {
                Id                = x.Id,
                AssetName         = x.AssetName,
                AssetCategoryName = x.AssetCategoryName
            }).Where(x => x.Id == assetId).SingleOrDefault();

            return(avmobj);
        }
示例#2
0
        public int GetCountListNguoiDung(JQueryDataTableParamModel param)
        {
            const string query = @"st_getCountListNguoiDung";

            using (var conn = new AdoHelper())
            {
                SqlParameter[] objectParam = new SqlParameter[] {
                    new SqlParameter("@Search", param.sSearch == null? (object)DBNull.Value:param.sSearch)
                };
                return(int.Parse(conn.ExecScalar(query, objectParam).ToString()));
            }
        }