protected override void ExecuteAction(ActionArgs args, ActionResult result) { if (args.CommandName.Equals("Custom") && args.CommandArgument.Equals("Execute")) { using (SqlProcedure sp = new SqlProcedure("sp_TYM_Order_Execute")) { sp.AddParameter("@Username", Context.User.Identity.Name); if (sp.ExecuteScalar().ToString().Equals("0")) { result.ShowAlert("Invalid Material Number"); result.Refresh(); } else { result.ShowAlert("Execute OK"); result.Refresh(); } } } else if (args.CommandName.Equals("Custom") && args.CommandArgument.Equals("ClearData")) { using (SqlProcedure sp = new SqlProcedure("sp_TYM_Order_ClearData")) { sp.ExecuteNonQuery(); result.Refresh(); } } }
public void r100Implementation(SystemMenuModel instance) { using (XmlReader reader = XmlReader.Create(HttpContext.Current.Server.MapPath("~/web.sitemap"))) { string title = string.Empty; while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name) { case "siteMapNode": string name = reader["title"]; string description = reader["description"]; string url = reader["url"]; string roles = reader["roles"] == null?string.Empty:reader["roles"]; if (!name.Contains('^')) //if (title != null && description != null && url != null && roles != null && !name.Contains('^')) { using (SqlProcedure sp = new SqlProcedure("sp_ConfigSystemMenu")) { if (description != string.Empty) { //sp.AddParameter("@title", title); sp.AddParameter("@name", name); sp.AddParameter("@description", description); sp.AddParameter("@url", url); sp.AddParameter("@roles", roles); sp.AddParameter("@username", Context.User.Identity.Name); sp.ExecuteScalar(); } } //if (description == string.Empty) //{ // title = reader["title"]; //} //else if (title != string.Empty) //{ // using (SqlProcedure sp = new SqlProcedure("sp_ConfigSystemMenu")) // { // sp.AddParameter("@title", title); // sp.AddParameter("@name", name); // sp.AddParameter("@description", description); // sp.AddParameter("@url", url); // sp.AddParameter("@roles", roles); // sp.AddParameter("@username", Context.User.Identity.Name); // sp.ExecuteScalar(); // } //} } break; } } } } }
internal static byte[] ReadRandom(BlobStorageContext context, long offset, int count) { byte[] result; using (var cmd = new SqlProcedure { CommandText = LoadBinaryFragmentFilestreamScript }) { cmd.Parameters.Add("@FileId", SqlDbType.Int).Value = context.FileId; cmd.Parameters.Add("@Position", SqlDbType.BigInt).Value = offset + 1; cmd.Parameters.Add("@Count", SqlDbType.Int).Value = count; cmd.CommandType = CommandType.Text; result = (byte[])cmd.ExecuteScalar(); } return(result); }
public static string getMaterial(string CustMatCode, string OrderBy, string pc, string lc) { CustMatCode = CustMatCode.Replace(" ", ""); using (SqlProcedure sp = new SqlProcedure("sp_GetMaterial")) { sp.AddParameter("@CustomerItemNumber", CustMatCode); sp.AddParameter("@OrderBy", OrderBy); sp.AddParameter("@pc", pc); sp.AddParameter("@lc", lc); object sc = sp.ExecuteScalar(); if (sc == null) { return(string.Empty); } else { return(sc.ToString()); } } }
/// <summary> /// Inserts a new binary record into the metadata database containing an already exising file id, /// removing the previous record if the content is not new. /// </summary> /// <param name="value">Binary data to insert.</param> /// <param name="versionId">Content version id.</param> /// <param name="propertyTypeId">Binary property type id.</param> /// <param name="isNewNode">Whether this value belongs to a new or an existing node.</param> public void InsertBinaryPropertyWithFileId(BinaryDataValue value, int versionId, int propertyTypeId, bool isNewNode) { SqlProcedure cmd = null; int id; try { cmd = new SqlProcedure { CommandText = isNewNode ? InsertBinaryPropertyWithKnownFileIdScript : DeleteAndInsertBinaryPropertyWithKnownFileId, CommandType = CommandType.Text }; cmd.Parameters.Add("@VersionId", SqlDbType.Int).Value = versionId != 0 ? (object)versionId : DBNull.Value; cmd.Parameters.Add("@PropertyTypeId", SqlDbType.Int).Value = propertyTypeId != 0 ? (object)propertyTypeId : DBNull.Value; cmd.Parameters.Add("@FileId", SqlDbType.Int).Value = value.FileId; id = (int)cmd.ExecuteScalar(); } finally { cmd?.Dispose(); } value.Id = id; }