Click here to Skip to main content
15,890,185 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow SSRS handle large data Pin
Tridip Bhattacharjee12-Apr-17 22:31
professionalTridip Bhattacharjee12-Apr-17 22:31 
QuestionMVC, my views can't see or reference the namespace MvcApplication in Global.asax Pin
jkirkerx12-Apr-17 8:50
professionaljkirkerx12-Apr-17 8:50 
AnswerRe: MVC, my views can't see or reference the namespace MvcApplication in Global.asax Pin
Afzaal Ahmad Zeeshan12-Apr-17 9:17
professionalAfzaal Ahmad Zeeshan12-Apr-17 9:17 
GeneralRe: MVC, my views can't see or reference the namespace MvcApplication in Global.asax Pin
jkirkerx12-Apr-17 10:17
professionaljkirkerx12-Apr-17 10:17 
QuestionIs there a control that displays a PDF and submits the pdf back to the server? Pin
Michael Clinton11-Apr-17 9:18
Michael Clinton11-Apr-17 9:18 
AnswerRe: Is there a control that displays a PDF and submits the pdf back to the server? Pin
ChetanAhire17-Apr-17 1:29
ChetanAhire17-Apr-17 1:29 
QuestionWriting multiple records to a binary file, reading the file records so I can add a record and write Pin
jkirkerx10-Apr-17 10:41
professionaljkirkerx10-Apr-17 10:41 
AnswerRe: Writing multiple records to a binary file, reading the file records so I can add a record and write Pin
jkirkerx10-Apr-17 11:38
professionaljkirkerx10-Apr-17 11:38 
Well I got this to work, but not sure it it's clean and efficient.
But it reads and creates a List<>, adds a record, and writes the list again.
public static Task<bool> contactUs_database_write(model_contactus_request p)
{<br />
    try
    {
        string folderPath = HostingEnvironment.MapPath("~/App_Data/Database");
        if (Directory.Exists(folderPath) == false)
            Directory.CreateDirectory(folderPath);

        string binaryPath = folderPath += "\\contactUs_messages.bin";                
        if (File.Exists(binaryPath))
        {
            using (var fs = new FileStream(binaryPath, FileMode.Open))
            {
                while (fs.Position < fs.Length)
                {
                    var bf = new BinaryFormatter();
                    List<serialized_contactUs> contacts = (List<serialized_contactUs>)bf.Deserialize(fs);
                    contacts.Add(new serialized_contactUs()
                    {
                        ID = contacts.Count,
                        Name = p.Name,
                        CompanyName = p.CompanyName,
                        EmailAddress = p.EmailAddress,
                        Phone_Number = p.Phone_Number,
                        Phone_Ext = p.Phone_Ext,
                        Phone_Mobile = p.Phone_Mobile,
                        MessageContent = p.MessageContent,
                        Time_Stamp = p.Time_Stamp,
                        Time_Zone = p.Time_Zone,
                        RememberMe = p.RememberMe,
                        MailingList = p.MailingList
                    });
                    // Write the new record to the file
                    fs.Position = 0;
                    BinaryFormatter formatter = new BinaryFormatter();
                    formatter.Serialize(fs, contacts);
                }
            }
        }
        else
        {
            using (var fs = new FileStream(binaryPath, FileMode.CreateNew))
            {
                // Append the Record to the generic collection
                List<serialized_contactUs> data = new List<serialized_contactUs>();
                data.Add(new serialized_contactUs()
                {
                    ID = 0,
                    Name = p.Name,
                    CompanyName = p.CompanyName,
                    EmailAddress = p.EmailAddress,
                    Phone_Number = p.Phone_Number,
                    Phone_Ext = p.Phone_Ext,
                    Phone_Mobile = p.Phone_Mobile,
                    MessageContent = p.MessageContent,
                    Time_Stamp = p.Time_Stamp,
                    Time_Zone = p.Time_Zone,
                    RememberMe = p.RememberMe,
                    MailingList = p.MailingList
                });
                // Write the new record to the file
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(fs, data);                        
            }
        }           
    }
    catch (IOException e)
    {
        if (e.Source != null)
            Task.FromResult(false);
    }
    catch (SerializationException e)
    {
        if (e.Source != null)
            Task.FromResult(false);
    }
    return Task.FromResult(true);
}
If it ain't broke don't fix it

QuestionXPagedList, StaticPageList, View, looping items with foreach, loops all the items and not the paginated ones Pin
jkirkerx10-Apr-17 9:17
professionaljkirkerx10-Apr-17 9:17 
AnswerRe: XPagedList, StaticPageList, View, looping items with foreach, loops all the items and not the paginated ones [solved] Pin
jkirkerx10-Apr-17 9:26
professionaljkirkerx10-Apr-17 9:26 
QuestionChange a color of single data labels in graph using crystal reports Pin
Member 1145200410-Apr-17 0:19
Member 1145200410-Apr-17 0:19 
QuestionWebhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 6:39
cotsjdixon31-Mar-17 6:39 
AnswerRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 7:41
mveRichard Deeming31-Mar-17 7:41 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 7:44
cotsjdixon31-Mar-17 7:44 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 7:47
mveRichard Deeming31-Mar-17 7:47 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 7:53
cotsjdixon31-Mar-17 7:53 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 8:26
mveRichard Deeming31-Mar-17 8:26 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 8:29
mveRichard Deeming31-Mar-17 8:29 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 8:44
cotsjdixon31-Mar-17 8:44 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 8:47
mveRichard Deeming31-Mar-17 8:47 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 9:03
cotsjdixon31-Mar-17 9:03 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 9:07
mveRichard Deeming31-Mar-17 9:07 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon6-Apr-17 8:09
cotsjdixon6-Apr-17 8:09 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming6-Apr-17 8:15
mveRichard Deeming6-Apr-17 8:15 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon6-Apr-17 8:35
cotsjdixon6-Apr-17 8:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.