Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 65

SYNOPSIS

The application is developed on Asp.Net platform. It has different user functionalities like Master Admin and Admin. The master admin has the ability to add, manage and delete N number of websites. The admin who is under the website has the ability to create, manage and delete N number agents. The agents have the ability to chat with the end customer or users. Features of XMPP Chat Application This application developed by using Visual Studio .Net Technologies 2010 at framework version 4.0 When master admin creates the website it will react to all the admin page We can set any number of users to the agents When the session ends the transcript email will sends automatically all the agents The admin can set the priority to every agent. This chat clients application supported to the Mac, Windows and Windows mobile Application, iPad and Android tablets also.

INTRODUCTION
OVERVIEW OF THE PROJECT
The objective of the project is to design and develop a web application to automate the live chat application with customer API and management settings for all users. The major functionalities of the administrator included in this application are listed below. Manage Agents Add New Agent Update Agent Detail

Account Settings Chat Widget title Live chat Title Chat Greetings Away Message Offline Message

Customize Agent Information. Background Color of the Chat Window. Text Color of the Chat Window. Profile photo (unloadable thumbnail) for the Chat Window.

Embed Wizard Transcripts

THE ORGGANIZATION PROFILE


Majestic People InfoTech (P) Ltd.
Majestic People InfoTech (MPI), founded in 2001 is a rapidly growing software development company specialized in Web Application development, Enterprise solutions, SCM Methodology and RFID with its headquarters in Jacksonville, Florida. MPI has a wide range of website design, development and programming services ranging from simple HTML based website design to complex AJAX based web development and programming, multimedia and secure e-commerce web applications. We work with your company to define objectives and develop graphic design for your website and interactive tools to achieve them. The benefits with MPI are Access to new technology, Accelerate cost savings, Improved focus on core responsibilities, Flexibility, Rapid implementation , Reduced risk , Achieving the highest quality standards, Reduce operational expenses , Maximize return on existing eprocurement assets, Provide total spend visibility. Corporations worldwide are looking towards high quality and reduced cost of IT services. We, in our mission to offer Quality solutions at a competitive price, have our state-of-the-art, SEI CMMI level 5 assessed Offshore Development Centre (ODC) located in Coimbatore, India. MPI is currently aligning its processes to SEI CMMI Level 5. Here's what makes us your ideal offshore partner: ODC your ideal offshore partner Using our unique minimum-code technology we can build your software application two to three times quicker than any other traditional offshore development company and can reduce your total cost of ownership of IT assets by up to 40%. We specialize in developing applications using any software platforms and make sure the applications built confirm to software industry standards. We work as your extended development arm. In addition, we bring all the traditional offshore advantages including cost, 24X7 support, quality process,

state-of-art infrastructure including VPN and VOIP support, domain, technical and project management expertise. SGS has implemented many software development projects across geographies including USA, Europe, Singapore and India. SGS Offshore development Centre (ODC) is strategically located at Coimbatore, India and provides organizations access to its state-of-the-art facility giving considerable savings on cost and time. Our offshore development model is depicted in figure below.
Project Management Project Management
Requirement Study Functional Specificatio n Interfacing with Legacy Apps Deployment

Onsite

System Test

User Accept. Testing

Prototyp e Support Offshore

Detail Design

Construction & Unit Testing

Integration Testing

Post Implementation Support

ConstructionManagement

Go Live

SYSTEM CONFIGURATION
HARDWARE CONFIGURATION
PROCESSOR MEMORY SIZE CLOCK SPEED KEYBOARD : : : : PENTIUM III 128 MB SD RAM 800 MHZ Samsung 104 KEYS

SOFTWARE CONFIGURATION
OPERATING SYSTEM FRONT - END BACK END SERVER BROWSER : : : : : WINDOWS 7, Apple, Android. ASP.NET 3.5, C# SQL SERVER 2008. WEB SERVER, IIS 5+, EJabberd Server1.28 IE 7+, Firefox5.0+, Chrome, Safari.

SOFTWARE DESCRIPTION
ASP.NET
ASP.NET is a server-side technology for developing Web applications based on the Microsoft .NET Framework.ASP.NET is server-side; i.e., it runs on the Web server. Most Websites contain client-side technologies like HTML, JavaScript, and Cascading Style Sheets (CSS). When a Web browser requests a Web page created with client-side technologies, the Web server simply grabs the files that the browser (the client) requests and sends them down the line. The client is entirely responsible for reading the code in the files and interpreting it to display the page on the screen. Server-side technologies, like ASP.NET, are different. Instead of being interpreted by the client, the code (for example, the code in an ASP.NET page) is interpreted by the Web server. In the case of ASP.NET, the code in the page is read by the server and used dynamically to generate standard HTML/JavaScript/CSS that is then sent to the browser. As all processing of ASP.NET code occurs on the server, it is called a server-side technology. The user (client) only sees the HTML, JavaScript, and CSS within the browser. The server (and serverside technology) is entirely responsible for processing the dynamic portions of the page. ASP.NET is based on the Microsoft .NET Framework. The .NET Framework collects all the technologies needed for building Windows applications, Web applications, and Web Services into a single package with a set of more than twenty programming languages. To develop Websites with ASP.NET, the .NET Framework Software Development Kit, is very essential. ASP.NET lets the developer use their favorite programming language, or at least one thats really close to it. The .NET Framework currently supports over twenty languages, four of which may be used to build ASP.NET Websites. ASP.NET pages are compiled, not interpreted. Instead of reading and interpreting the code every time a dynamic page is requested, ASP.NET compiles dynamic pages into efficient binary files that the server can execute very quickly. This represents a big jump in performance when compared with the technologys interpreted predecessor, ASP. ASP.NET has full access to the functionality of the .NET Framework. Support for XML, Web Services, database interaction, email, regular expressions, and many other technologies are built right into .NET, which saves the developer from having to reinvent the wheel.

ASP.NET allows the developer to separate the server-side code in the pages from the HTML layout. When working with a team composed of programmers and design specialists, this separation is a great help, as it lets programmers modify the server-side code without stepping on the designers carefully crafted HTMLand vice versa.

SQL SERVER
One of the most outstanding Database systems today in market is Microsoft SQL Server. SQL Server is a database management system developed and marketed by Microsoft. The most important aspects of SQL Server 2005: SQL Server is easy to use. SQL Server scales from a mobile laptop to symmetric multiprocessor system.

SQL Server is a Relational Database Management System. The SQL Server relational language is called Transact-SQL. SQL is a set oriented language. This means that SQL can query many rows from one or more tables using just one statement. This feature allows the use of this language at a logically higher level than procedural language. SQL Server is relatively easy to manage through the use of graphical computing environment for almost every task of the system and database administration. SQL Server uses services of Windows NT to offer new or extended database capabilities, such as sending and receiving messages and managing login security. The SQL Server users primary tool for interacting with the system is Management Studio. The Management Studio has two main purposes: Administration of the database server and Management of database objects. SQL Server Query Analyzer provides a graphical presentation of the execution plan of a query and an automatic component that suggests which index should be used for a selected query.

SYSTEM STUDY
EXISTING SYSTEM
The existing system of this application is followed by dropping their queries through telephone or through Email.

Disadvantage
1) Due to this it takes more time (eg: if we are posting some queries in email if some network problem occurs , will not be getting quick response to the end-userss) 2) We will not be getting immediate response. 3) It takes more cost (i.e. by making calls it may charges more and network corruption).

PROPOSED SYSTEM
This above was overcome by implementing this application by providing the provision.

Advantage
1) By using the high end servers the network will not corrupted in any case 2) It supports in any Operating System (E.g. Android, Windows, IPAD etc.) 3) Will get immediate /quick response from the agents. Our customizable chat box stays on your page so that visitors can easily chat and continue activity on your site.

FEASIBILITY STUDY
Before going further into the steps of software development the system analyst has to analyses. Whether the proposed system will be feasible for the organization. The detailed analysis has to be performed to check the technical, economical and operational feasibility of the proposed system.

Economical Feasibility
The economic feasibility is checked based on the criterion of the software availability and the cost of the products which are being used for the development of the specified product, this type is checked as the software which is used must be purchased for the authentication of the tool which is to be developed. If the products are open source then its more feasible then other type of the developing the tool.

Operational Feasibility
Operational feasibility is checked based on the front end designs and the user interfaces which are to be developed for the proper working and within the understandability of the general users who dont have much knowledge about the new product. The persons using the tool must be satisfied with the design, which is made specifically for them.

Technical Feasibility
Technical feasibility is the most important criterion which must be considered as a primary aspect as the technical people i.e. the persons who develop the code must be confident that the mentioned conditions can be met, if there are loopholes in the specifications provided then the product will not be fully efficient. The system analyst has to check the technical feasibility of the proposed system. Taking account of the hardware , which is made for the system development , data storage, processing and output, makes the technical feasibility assessment. The system analyst has to check whether the company or user who is implementing the system has enough resources available for the smooth running of the application. The requirement for this application is satisfied for the firm. So it is technically feasible.

MOUDLE DESCRIPTION
MANAGE AGENTS About Page
Purpose of this module is to Adding agent detail and modifies existing Agent details. There is the environment to add New Agent and view the Existing Agent Details. Admin can create new Agent by giving basic details like User Name, Password, Display Name and Transcript Email.

Process
Manage Agent Page is loaded when admin login into the portal. The Manage Agent page can be also selected by clicking the tab named as Manage Agent. The Main objectives of this module are Add New Agent Update Agent Detail Total agents user names were listed in the drop down list for those agent details are registered already. For updating Agent detail, Admin can select any one of the user name from drop down list and modify his/her details. And Save the modification by click Save Button. For Adding New Agent admin use Add new Agent Button and Give Basic detail of the agent. By clicking save button these details stored into the Database Table. There is the Order list that holds total agent Names. Using this Order List Admin can modify the Agent priority by tracking Agent Position. When click save button, validation process will initiate for required field entry and expression format checking for E-Mail. New agent detail will not store into the database table until validation is Successful. Save Button trigger an insert command when new agent detail is enter likely it trigger update command when we do modification of existing user detail.

ACCOUNT SETTINGS About Page


Account Settings page is the place where an Administrator can edit Agents account details like Chat widget title, Live Chat Title, Chat greetings, etc. The Administrator has the only access to edit these details. The information that an Agent wants to display in his Chat Window can be entered here.

Process
The Account Settings page can be selected by clicking the tab named as Account Settings. The account settings page contains few mandatory fields of Textbox controls to enter our information and to set our account like Chat Widget title Live chat Title Chat Greetings Away Message Offline Message

Chat Widget Title is to set the Main title of the chat widget. Live Chat title is to set a Chat title for current live chat. Chat Greetings is the greetings message for the customers from the agent when he is in available status. Away message is the message for the customers from the agent when he is in away, idle or busy statuses. Offline Message is the absence message for the customers from the agent when he is in offline or unavailable status. Some non mandatory account settings which can be enabled by making the checkbox controls into checked status. They are, When customer visits the website, automatically send text to agent to allow chat invitation. Automatically send transcript to agent at sessions ends. Send new chat to all agents. Only the first agent to respond can continue chat. We have another option to allow no. of visitors (1 - 4 visitors) per agent before showing away messages. It can be chosen by Clicking the Drop down arrow of the drop down list control. After entering all the details and managing our account settings we can save these account settings as our default one. It can be stored in the database by clicking the Save button. So from then whenever an agent visits his account, his chat widget settings will be as he predefined. Predefined data will be retrieved from the database for the respective agent. The Account Settings Page is designed in order to make the users to work easy with the page. Its very user friendly with the help of the Graphical User Interface. This is about the Account Settings Page.

CUSTOMIZE About Page


Customize wizard is the page where the agents can design their Live chat Window via Administrators Accessibility.

Customization
In the customize wizard page Admin can design: Agent Information that agent wants to display in his/her Chat Window. Background Color of the Chat Window. Text Color of the Chat Window. Profile photo (unloadable thumbnail) for the Chat Window.

After designing the Chat Window, he/she can preview the designed Chat Window before saving it as the default Chat Window of respective agent. Once If it is saved, then the Designed details will be stored in Database. All stored data of the agent will be maintained in the database and retrieved from the database. So from then, the agents chat window will look like as designed till it is modified.

Process
Customize Wizard page can be selected by clicking the Customize Wizard tab. In that page administrator can see a DropDownList Control. This DropDownList Control consists of all Agents that are presented in database. By clicking the dropdown arrow administrator can be able to the see the agents names to select anyone from it. And selected agents details like Agent Name, Background Color, Text Color, Profile photo, etc will be automatically loaded to the respective controls. Administrators have access to edit all those details except the Agent name because it is a Read Only property. After editing administrator can preview the Designed Chat Window. Finally it should be stored in the Database if the designed Chat window is satisfied. And by clicking the dropdown arrow of the DropDownList Control, administrator can continue customizing process of other agents if need so.

EMBED WIZARD About Page


Embed widget page helps the administrator to align the chat window in horizontal or vertical manner. It can be modified as per his/her requirement. We have designed this embed widget page in order to make easier the alignment of chat window for user. The alignment can be done in either ways such as pixel or percentage.

Process
The embed widget page can be selected by clicking the tab named as Embed Widget. It contains of an image where we can preview the alignment before we save the alignment as our default one. We have to type of alignment: From Top (Pixel (or) Percentage ) From Edge (Pixel (or) Percentage ) We can choose the alignment method as per our wish from the Radio Button Control, i.e. live chat window to be Horizontal or Vertical position. After selecting any one from the options, we are in need to select the method of measure i.e. the Percentage or Pixel value from the DropDownList control. By clicking the Drop Down arrow of the DropDownList control the administrator can select it. After choosing it we have to give the pixel value or percentage value for Dropdown list value as Pixel or Percentage respectively. We have to enter the value in the Textbox control. For example, 1. From Top Percentage 75, 2. From Edge Percentage 75. Then we can preview the alignment by clicking on the preview button before we storing it in database. Once the alignment that we designed is satisfied then we can store it by clicking the Save button. From then the designed alignment will be our default alignment of our chat window. These aligned values of respective agent will be stored in the database and retrieved whenever there is a need. The Embed Widget Page has designed in basis of Graphical User Interface in order to make the page user friendly. So Administrator can work with the page easily and efficiently. This is about the Embed Widget Page.

SYSTEM DESIGN AND DEVELOPMENT


FORM DESIGN
The major functionalities of the administrator included in this application are listed below. Manage Agents Add New Agent Update Agent Detail

Account Settings Chat Widget title Live chat Title Chat Greetings Away Message Offline Message

Customize Agent Information. Background Color of the Chat Window. Text Color of the Chat Window. Profile photo (unloadable thumbnail) for the Chat Window.

Embed Wizard Transcripts

INPUT DESIGN
The input is that set of values that is provided by the user to the system .The process of input design is the process of converting user input to system understandable form by careful design of the input screens. The input design must enable the user to provide the error free input for the system to process efficiently. Inaccurate input data are the most common cause of error in data processing. Error enterer by data entry operators can be controlled by input design. Input design is the process of converting user-oriented input to a computer-based format. Input data are collected and organized into group of similar data. Appropriate input media are selected for processing. The goal of designing input data is to make data entry as easy, logical and free from error.

OUTPUT DESIGN
The output form of the system is either by screen or by hard copies. Output design aims at communicating the result of the processing to users. The output design takes into account the necessary information that should be displayed and shown depending on the user. The output is in the form of contents, menus and templates in the WebPages.

CODE DESIGN
Code is a group of characters used to identify data .Codes used in the system or essential to improve the process efficiency and to produce correct input and output. The coding method and standards are used in search a way that codes are easily expandable. The code has to be designed with following features. Uniform size and format simplicity meaningfulness. The code should be adequate for present and anticipated data processing for machine and human use.

DATABASE DESIGN
The data in this system has to be stored and retrieved from the database. Designing of database is a part of the system design. Data elements to be sorted have been identified at

analysis stage. They are structured and put together to design the data storage and retrieval system. The redundant data, which may exist in the logical data structure along with the unit keys, needed to data items are identified using a technique called normalization. Relationships are established between the data item and unnecessary data items are removed. Normalization is done to get an internal consistency of data and have minimum redundancy and maximum stability. This ensures minimizing data storage required, minimizing changes of data inconsistency optimizing for updates

TESTING AND IMPLEMENTATION


TESTING METHODOLOGIES
Software testing is an empirical investigation conducted to provide stakeholders with information about the quality of the product or service under test, with respect to the context in which it is intended to operate. This includes the process of executing a program or application with the intent of finding software bugs. The scope of software testing often includes examination of code as well as execution of that code in various environments and conditions as well as examining the aspects of code: does it do what it is supposed to do and do what it needs to do. In the current culture of software development, a testing organization may be separate from the development team. There are various roles for testing team members. Information derived from software testing may be used to correct the process by which software is developed. There are many approaches to software testing. Reviews, walkthroughs or inspections are considered as static testing whereas actually executing programmed code with a given set of test cases is referred to as dynamic testing.

UNIT TESTING
Testing of individual software components or modules. Typically done by the programmer and not by testers, as it requires detailed knowledge of the internal program design and code. May require developing test drive modules or test harnesses.

INTEGRATION TESTING
Testing of integrated modules to verify combined functionality after integration. Modules are typically code modules, individual applications, client and server applications on a

network, etc. This type of testing is especially relevant to client/server and distributed systems. REGRESSION TESTING
Testing the application as a whole for the modification in any module or functionality. Difficult to cover all the system in regression testing so typically automation tools are used for these testing types.

ACCEPTANCE TESTING
Normally this type of testing is done to verify if system meets the customer specified requirements. User or customer performs this testing to determine whether to accept application or not.

End-to-End TESTING
It involves testing of a complete application environment in a situation that mimics realworld use, such as interacting with a database, using network communications, or interacting with other hardware, applications, or systems if appropriate.

CONCLUSION
The existing system of this application is followed by dropping their queries through this it takes more time (i.e. will not be getting quick response to the end-userss). And takes more cost. The proposed solution is to launch the LIVE CHAT WINDOW module in web application publishing Portal of Bart Stone Data motive, Inc using Visual Studio .Net Technologies. This application built on ASP.Net has rich customized functionalities and userfriendly. With the help of the application, Site Administrator can organize the application behavior with the defined rules. It supports in any Operating System (Eg: Android, Windows , IPAD etc.) . The end user get immediate /quick response from the agents.Our customizable chat box stays on your page so that visitors can easily chat and continue activity on your site.

BIBLIOGRAPHY
BOOKS
Jesse Liberty and Dan Hurwitz Programming in ASP.NET Shroff Publishers Ltd. Lee Programming in .NET compact framework McGraw Hill Company. Roger S.Pressman Software Engineering Tata McGraw-Hill, 4th edition

WEBSITES REFERENCES
www.codeproject.com www.sourcecodeonline.com www.asp.net www.microsoft.com www.w3schools.com

www.ASPtutorials.com

APPENDICES
DATA FLOW DIAGRAM
Admin
Admin

Yes
If login

No

Logout

Manage website

Add website

Save website

Check website

Manage Agents
Manage Agents Add New Agents

Save Agents

Account Settings
Account Settings Chat Name Chat Greeting Away Message Offline Message Save

Customize Chat Widgets


Customize Background color Text color Preview

EmbedWidzed
Embed Preview Save

Transcripts
Transcripts Select Date Select Name Select session Chat history

TABLE STRUCTURE
Login
FIELDS Login UName Password TYPE bigint Varchar Varchar DESCRIPTION Login UserName Password

Manage Agents

FIELDS ManageAgent Login User Name Password Display Name Transcript Email Priority AgentPhoto AgentInfo

TYPE bigint bigint varchar varchar varchar varchar int nvarchar nvarchar

DESCRIPTION ManageAgent Login User Name Password Display Name Transcript Email Priority AgentPhoto AgentInfo

Account Settings

FIELDS AccountSetting ChatName Chat Greeting Always Message Offline Message

TYPE bigint varchar varchar varchar varchar

DESCRIPTION AccountSetting ChatName Chat Greeting Always Message Offline Message

Customize Widget

FIELDS CustomizeWidget Background Color TextColor BtmMsg ChatWindowImage ChatWindowAwayImage ChatWindowOffImage SideWidget BottomWidget

TYPE bigint varchar varchar varchar varchar varchar varchar varchar varchar

DESCRIPTION CustomizeWidget Background Color TextColor Bottom Message ChatWindowImage ChatWindowAway ChatWindowOffline SideWidget BottomWidget

Embedded Widget

FIELDS Embed Widget Chat Position Size Format

TYPE bigint Bit Bit

DESCRIPTION Embed Widget Chat Position Size Format

SAMPLE CODING
Login
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Security; public partial class _Default : System.Web.UI.Page { private const string TAG_ERROR_MSG = "<li>{}</li>"; protected void Page_Load(object sender, EventArgs e) { } protected void imgbtnLogin_Click(object sender, ImageClickEventArgs e) { #region try { Common objCommon = new Common(txtUsername.Text, txtPassword.Text); if (txtUsername.Text == string. Empty && txtPassword.Text == string. Empty)

{ lblMessage.Text = TAG_ERROR_MSG.Replace("{}", "Enter UserName Password"); } else if (txtUsername.Text == string. Empty) { lblMessage.Text = TAG_ERROR_MSG.Replace("{}", "Enter UserName"); } else if (txtPassword.Text == string. Empty) { lblMessage.Text = TAG_ERROR_MSG.Replace("{}", "Enter Password"); } else and

{ if (objCommon.CheckLogin()) { Session.Add("userNameSession", txtUsername.Text); Session.Add("loginIDSession", objCommon.LoginID); FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, false); if (objCommon.Typeuser) { Response.Redirect("ManageWeb.aspx"); } else { Response.Redirect("ManageAgents.aspx"); } } else { lblMessage.Text = TAG_ERROR_MSG.Replace("{}", "Invalid UserName Or Password"); txtUsername.Text = string. Empty; txtPassword.Text = string. Empty; } } } catch (Exception ex1) { Response.Write(ex1.Message); } #endregion } }

Manage Website
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; public partial class ManWeb : System.Web.UI.Page { private int tempid; string btmmsg; string tempUsername; Random objRandom = new Random(); string strpathname = "Managewebpage"; bool isaddnew; /// <summary> /// Page load coding /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { #region if (Session["loginIDSession"] == null) { Response.Redirect("Login.aspx"); } lblsession.Text = "Hi " + Convert.ToString(Session["userNameSession"]) + ". . . Welcome"; Session.Add("imgSavepath", strpathname); if (!IsPostBack)

{ ddlWebsite.Items.Insert(0, "-- SELECT WEBSITE --"); Bind(); btnDelete.Visible = false; btnchkuname.Visible = false; eneblefalse(); } #endregion } /// <summary> /// ddlwebsite selectedindex change /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlWebsite_SelectedIndexChanged(object sender, EventArgs e) { #region if (ddlWebsite.SelectedItem.Text == "-- SELECT WEBSITE --") { txtwebsite.Text = string. Empty; txtPassword.Text = string. Empty; txtoffline.Text = string. Empty; btnDelete.Visible = false; btnchkuname.Visible = false; eneblefalse(); } else { ManageWebBL objWeb = new ManageWebBL(); objWeb.SelectWebsite(ddlWebsite.SelectedItem.Value); Hdfusername.Value = ddlWebsite.SelectedItem.Text; txtwebsite.Text = objWeb.Username; txtPassword.Text = objWeb.Password; txtoffline.Text = objWeb.OfflineEmail; txtwebsite.ReadOnly = true; btnDelete.Visible = true; btnchkuname.Visible = false; enabletrue(); }

#endregion } /// <summary> /// To bind data with ddl /// </summary> public void Bind() { #region //ManageWebBL objmanage=new ManageWebBL(); ddlWebsite.DataSource = from p in XMPPHelper.Context.Mas_Logins where (p.UserType == false) select new { p.UserName, p.LoginPK }; ddlWebsite.DataTextField = "UserName"; ddlWebsite.DataValueField = "LoginPK"; ddlWebsite.DataBind(); ddlWebsite.Items.Insert(0, "-- SELECT WEBSITE --"); #endregion } /// <summary> /// Coding for btnsave click. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { #region Hdfusername.Value = txtwebsite.Text; int tempLoginFK = 0; try { if (ddlWebsite.SelectedItem.Text != "-- SELECT WEBSITE --") { var user = XMPPHelper.Context.Mas_Logins.Single(a => a.LoginPK == Convert.ToInt32(ddlWebsite.SelectedValue)); tempLoginFK = Convert.ToInt32(user.LoginPK); } ManageWebBL objWeb = new ManageWebBL(txtwebsite.Text, txtPassword.Text, txtoffline.Text); //string aa= ddlWebsite.SelectedValue.ToString();

if (ddlWebsite.SelectedIndex == 0) { if (objWeb.CheckWebName(txtwebsite.Text)) { tempid = objWeb.SaveManageWebBl(tempLoginFK, Convert.ToInt32(Session["loginIDSession"])); tempUsername = objWeb.Selectusername(tempid); AccountSettingBL objAccount = new AccountSettingBL(tempUsername + " used cars", "Have a question?\nwe are available to chat!", "Ask a question and an\nagent will be with you shortly.", "Sorry, but our operators are\nnot available at the time", false, false, false, 1); objAccount.SaveAccountSetting(tempid); //----------------btmmsg = "Call us at 888-321-8467"; string bgcolor = "A41520"; string txtcolor = "FFFFFF"; imgChatWindow.ImageUrl = "DynamicChatWin.aspx?ImageType=1&BGColor=" + (bgcolor == "" ? "A41520" : bgcolor) + "&TXTColor=" + (txtcolor == "" ? "FFFFFF" : txtcolor) + "&AgentName1=" + tempUsername + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); imgBottomWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=2&BGColor=" + (bgcolor == "" ? "A41520" : bgcolor) + "&TXTColor=" + (txtcolor == "" ? "FFFFFF" : txtcolor) + "&AgentName1=" + tempUsername + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); imgSideWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=3&BGColor=" + (bgcolor == "" ? "A41520" : bgcolor) + "&TXTColor=" + (txtcolor == "" ? "FFFFFF" : txtcolor) + "&AgentName1=" + tempUsername + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); CustomizeWizardBL objCustomize = new CustomizeWizardBL("A41520", "FFFFFF", "Call us at 888-321-8467", tempUsername + "online.jpg", tempUsername + "Away.jpg", tempUsername + "Offline.jpg", tempUsername + "SideWidget.jpg", tempUsername + "BottomWidget.jpg", tempUsername + "onlinePopup.jpg", tempUsername + "OfflinePopup.jpg"); objCustomize.UpdateCustomizeWizard(tempid); //-------------------------EmbedWidgetBL objEmbed = new EmbedWidgetBL(false,false,50); objEmbed.UpdateEmbedWidget(tempid); //--------------------

lblPopUpMessage.Text = "Website Login Created Successfully"; } else { lblPopUpMessage.Text = "That website name is already taken in our system.</br> Please choose a unique user name"; mpeMessage.Show(); } } else { objWeb.SaveManageWebBl(tempLoginFK, Convert.ToInt32(Session["loginIDSession"])); lblPopUpMessage.Text = "Website Login Created Successfully"; } Bind(); mpeMessage.Show(); txtclear(); eneblefalse(); isaddnew = false; } catch (System.Web.HttpRequestValidationException ex) { //ex.Message; } #endregion } /// <summary> /// coding for btndelete click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, ImageClickEventArgs e) { #region ManageWebBL objdel = new ManageWebBL(); var hh = objdel.DeletePhoto(Convert.ToInt64(ddlWebsite.SelectedItem.Value)); foreach (var item1 in hh)

{ File.Delete(Server.MapPath("Uploads/" + item1.AgentPhoto)); File.Delete(Server.MapPath("ChatWindowImages/" + item1.UserName + "info.png")); } objdel.DeleteWebsite(Convert.ToInt64(ddlWebsite.SelectedItem.Value)); objdel.DeleteWebsite_server(ddlWebsite.SelectedItem.Text); string username = ddlWebsite.SelectedItem.Text; File.Delete(Server.MapPath("BottomWidgetImages/") + username + "BottomWidget.jpg"); File.Delete(Server.MapPath("SideWidgetImages/") + username + "SideWidget.jpg"); File.Delete(Server.MapPath("ChatWindowImages/") + username + "Offline.jpg"); File.Delete(Server.MapPath("ChatWindowImages/") + username + "OfflinePopup.jpg"); File.Delete(Server.MapPath("ChatWindowImages/") + username + "Away.jpg"); File.Delete(Server.MapPath("ChatWindowImages/") + username + "online.jpg"); File.Delete(Server.MapPath("ChatWindowImages/") + username + "onlinePopup.jpg"); File.Delete(Server.MapPath("PreviewBottomWidgetImages/") + username + "BottomWidget.jpg"); File.Delete(Server.MapPath("PreviewSideWidgetImages/") + username + "SideWidget.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "Offline.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "OfflinePopup.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "Away.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "online.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "onlinePopup.jpg"); Bind(); lblPopUpMessage.Text = " Website Deleted Successfully"; mpeMessage.Show(); txtclear(); eneblefalse(); btnSave.Visible = false; #endregion } /// <summary> /// coding for btnaddwebsite /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddwebdite_Click(object sender, ImageClickEventArgs e)

{ #region txtclear(); Hdfusername.Value = string. Empty; isaddnew = true; btnchkuname.Visible = true; enabletrue(); #endregion } /// <summary> /// user defined function for clear values in textbox /// </summary> public void txtclear() { #region txtwebsite.Text = ""; txtPassword.Text = ""; txtoffline.Text = ""; ddlWebsite.SelectedIndex = 0; txtwebsite.ReadOnly = false; btnDelete.Visible = false; lbluname.Text = string. Empty; Label2.Text = string. Empty; #endregion } /// <summary> /// coding for check username. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnchkuname_Click(object sender, ImageClickEventArgs e) { #region ManageWebBL objWeb = new ManageWebBL(); if (objWeb.CheckWebName(txtwebsite.Text)) { Label2.Text = string. Empty; lbluname.Text = "</br>" + Hdfusername.Value + " Username is available";

} else { lbluname.Text = string. Empty; Label2.Text = "</br>" + Hdfusername.Value + " Username has been taken already in the system"; eneblefalse(); } #endregion } /// <summary> /// user defined function for enable true. /// </summary> public void enabletrue() { #region txtwebsite.Enabled = true; txtPassword.Enabled = true; txtoffline.Enabled = true; btnSave.Visible = true; #endregion } /// <summary> /// user defined function for enable false /// </summary> public void eneblefalse() { #region txtPassword.Enabled = false; txtwebsite.Enabled = false; txtoffline.Enabled = false; btnSave.Visible = false; btnchkuname.Visible = false; #endregion } /// <summary> /// code for text changed event. /// </summary>

/// <param name="sender"></param> /// <param name="e"></param> protected void txtwebsite_TextChanged(object sender, EventArgs e) { #region Hdfusername.Value = txtwebsite.Text; #endregion } }

Manage Agent
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Collections.ObjectModel; using System.Data.SqlClient; using System.Net; using System.IO; using DAL; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using Image = System.Drawing.Image; using System.Drawing; public partial class ManageAgents : System.Web.UI.Page { bool isAddnew; /// <summary> /// Page Load Coding /// </summary> /// <param name="sender"></param> /// <param name="e"></param>

protected void Page_Load(object sender, EventArgs e) { #region if (Session["loginIDSession"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { HiddenField hdfMaster = (HiddenField)Master.FindControl("hdfActive"); if (hdfMaster != null) { hdfMaster.Value = "Manage"; } ddlEditAgent.Items.Insert(0, "---Select Agent---"); txtvisiblefal(); btndelete.Visible = false; CUName.Visible = false; bind(); } BindLview(); #endregion } //----------------- *End Region-----------/// <summary> /// Binding The Data With DDL and ListView /// </summary> public void bind() { #region ManageAgentBL objManage = new ManageAgentBL(); ddlEditAgent.DataSource objManage.FindItems(Convert.ToInt32(Session["loginIDSession"])); ddlEditAgent.DataTextField = "DisplayName"; ddlEditAgent.DataValueField = "UserName"; ddlEditAgent.DataBind(); ddlEditAgent.Items.Insert(0, "---Select Agent---"); #endregion

} public void BindLview() { #region ManageAgentBL objManage = new ManageAgentBL(); lstVwNews.DataSource = objManage.FindItems (Convert.ToInt32 (Session ["loginID Session"])); lstVwNews.DataBind(); #endregion } //----------------- *End Region-----------/// <summary> /// AsyncFileUpload omplete event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void aflup1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) { #region try { if (aflup1.PostedFile != null) { HttpPostedFile file = aflup1.PostedFile; byte[] data = ReadFile(file); Session[XMPPHelper.STORED_IMAGE] = data; var imgstream = new MemoryStream(data); Image imgPreview = Image.FromStream(imgstream); string count = hdnPhotoCount.Value.ToString(); if ((count != "1" && count != "2") || count != "1") { imgPreview.Save(Server.MapPath(".") + "\\Uploads\\" + hdfTUser.Value + "1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); Session["image"] = @"~\Uploads\" + hdfTUser.Value + "1.jpg"; } else if (count != "2") {

imgPreview.Save(Server.MapPath(".") + "\\Uploads\\" + hdfTUser.Value + "2.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); Session["image"] = @"~\Uploads\" + hdfTUser.Value + "2.jpg"; } imgPreview.Dispose(); } hdfcount.Value = "1"; } catch(Exception ex) { } #endregion } //----------------- *End Region-----------protected void txtUserName_TextChanged(object sender, EventArgs e) { #region hdfTUser.Value = txtUserName.Text; #endregion } /// <summary> /// DDL Selected indexchange /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlAgent_SelectedIndexChanged(object sender, EventArgs e) { #region if (ddlEditAgent != null && ddlEditAgent.SelectedItem.Text == "---Select Agent---") { txtUserName.Text = string. Empty; txtDName.Text = string. Empty; txtPassWord.Text = string. Empty; txtTranscriptEmail.Text = string. Empty; txtUserName.ReadOnly = false; hdf3.Value = "no_photo.jpg"; img.ImageUrl = "Uploads/no_photo.jpg";

hdnPhotoCount.Value=img.ImageUrl.ToString().Substring(img.ImageUrl.ToString(). IndexOf('.') - 1, 1); txtAgentinfo.Text = string. Empty; hdfTUser.Value = txtUserName.Text; lblPhoto.Enabled = false; divAgentInfo.Text = string. Empty; btndelete.Visible = false; txtvisiblefal(); } else { txtvisibletrue (); hdfTUser.Value = ddlEditAgent.SelectedValue; ManageAgentBL objSelect = new ManageAgentBL(ddlEditAgent.SelectedItem.Value); objSelect.SelectAgent(); txtUserName.Text = objSelect.UserName; txtPassWord.Text = objSelect.Password; txtDName.Text = objSelect.DisplayName; txtTranscriptEmail.Text = objSelect.TranscriptEmail; txtUserName.ReadOnly = true; txtAgentinfo.Text = objSelect.AgentInfo; divAgentInfo.Text = objSelect.AgentInfo; hdfTUser.Value = objSelect.UserName; img.ImageUrl = @"~\Uploads\" + objSelect.AgentPhoto + "?x=" + DateTime.Now; hdnPhotoCount.Value=img.ImageUrl.ToString().Substring (img.ImageUrl.ToString().IndexOf('.') - 1, 1); Session["image"] = @"~\Uploads\" + (objSelect.AgentPhoto == "" ? "no_photo.jpg" : objSelect.AgentPhoto); aflup1.Visible = true; aflup1.Enabled = true; lblPhoto.Enabled = true; lblPhoto.Visible = true; txtAgentinfo.Visible = true; txtAgentinfo.Enabled = true; lblAgentinfo.Visible = true; btndelete.Visible = true; CUName.Visible = false; } #endregion }

//----------------- *End Region-----------/// <summary> /// Clearing the text values /// </summary> public void txtClear() { #region txtvisibletrue(); txtDName.Text = string. Empty; txtUserName.Text = string. Empty; txtPassWord.Text = string. Empty; txtTranscriptEmail.Text = string. Empty; txtAgentinfo.Text = string. Empty; divAgentInfo.Text = string.Empty; img.ImageUrl = "Uploads/no_photo.jpg"; ddlEditAgent.SelectedIndex = 0; lblPhoto.Enabled = true; lblPhoto.Visible = true; btndelete.Visible = false; lblAgentinfo.Visible = true; Label2.Text = string. Empty; lbluname.Text = string. Empty; #endregion } //----------------- *End Region-----------/// <summary> /// Btnclick of Addnewagent /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddNew_Click(object sender, EventArgs e) { #region txtUserName.ReadOnly = false; CUName.Visible = true; Session["image"] = ""; txtClear(); isAddnew = true; #endregion }

//----------------- *End Region-----------private byte[] ReadFile(HttpPostedFile file) { #region byte[] data = new Byte[file.ContentLength]; file.InputStream.Read(data, 0, file.ContentLength); return data; #endregion } /// <summary> /// Dynamic Drawing of txtAgentinfo as img. /// </summary> /// private void drawimage() { #region Bitmap bmpAgentInfo = new Bitmap(248, 71); bmpAgentInfo.SetResolution(100, 100); Graphics grpAgentInfo = Graphics.FromImage(bmpAgentInfo); Brush brshChat1; Font fntMain1; string strAgentInfo=txtAgentinfo.Text; string strTXTColor = "#FFFFFF"; brshChat1 = new SolidBrush(System.Drawing.ColorTranslator.FromHtml(strTXTColor)); fntMain1 = new Font("Arial", 10, FontStyle.Bold); grpAgentInfo.DrawString(strAgentInfo, fntMain1, brshChat1, 0, 6); bmpAgentInfo.MakeTransparent(); bmpAgentInfo.Save(MapPath(@"~\ChatWindowImages\") + hdfTUser.Value +"info.png", System.Drawing.Imaging.ImageFormat.Png); #endregion } //----------------- *End Region-----------/// <summary> /// user defined function for save data. /// </summary>

private void SaveData() { #region Response.Cache.SetCacheability(HttpCacheability.NoCache); //txtUserName.Text = hdfTUser.Value; string pictureName = hdfTUser.Value + ".jpg"; string source = img.ImageUrl.ToString(); string split = source.Substring(source.IndexOf('.') - 1, 1); string filext = Path.GetExtension(MapPath(Convert.ToString(Session["image"]))); if (split == "1" || split == "2") { ImageimgTemp=Image.FromFile(Server.MapPath(Convert.ToStringSession["image"]))); System.Drawing.Image thumbnailimage = imgTemp.GetThumbnailImage(70, 70, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero); thumbnailimage.Save(Server.MapPath(@"~\Uploads\" + pictureName)); thumbnailimage.Dispose(); imgTemp.Dispose(); } img.ImageUrl = @"~\Uploads\" + pictureName + "?x=" + DateTime.Now; GC.Collect(); mpeMessage.Show(); File.Delete(Server.MapPath(@"~\Uploads\") + hdfTUser.Value + "2.jpg"); File.Delete(Server.MapPath(@"~\Uploads\") + hdfTUser.Value + "1.jpg"); hdf3.Value = pictureName; string replace = txtAgentinfo.Text.Replace('\r', ' '); string[] splits = replace.Split('\n'); replace = ""; for (int i = 0; i < splits.Length; i++) { replace += splits[i].Trim() + "\\n"; } hdfcount.Value = "0"; bind(); BindLview(); txtClear(); txtvisiblefal(); CUName.Visible = false; lblPopUpMessage.Text = "Agent Saved Successfully"; mpeMessage.Show(); isAddnew = false;

#endregion } //----------------- *End Region-----------/// <summary> /// Btnclick event of SAVE button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// public bool ThumbnailCallback() { return true; } protected void btnSave_Click(object sender, EventArgs e) { #region int tempLoginFK = Convert.ToInt32(Session["loginIDSession"]); //txtUserName.Text = hdfTUser.Value; string pictureName = hdfTUser.Value + ".jpg"; if (ddlEditAgent.SelectedIndex == 0) { ManageAgentBL objManage = new ManageAgentBL(txtUserName.Text, txtPassWord.Text, txtDName.Text, txtTranscriptEmail.Text, pictureName, txtAgentinfo.Text); if(objManage.CheckUserName(txtUserName.Text)) { if (!aflup1.HasFile) { string[] dd = Directory.GetFiles(Server.MapPath("~/Uploads/")); if (dd.Contains(Server.MapPath("~/Uploads/" + pictureName))) { File.Delete(Server.MapPath(@"~\Uploads\") + pictureName); System.IO.File.Copy(Server.MapPath("~/Uploads/no_photo.jpg"), Server.MapPath("~/Uploads/" + pictureName)); Session["image"] = pictureName; } else {

System.IO.File.Copy(Server.MapPath("~/Uploads/no_photo.jpg"), Server.MapPath("~/Uploads/" + pictureName)); Session["image"] = pictureName; } } img.ImageUrl = Convert.ToString(Session["image"]) + "?x=" + DateTime.Now; objManage.InsertAgent(tempLoginFK, -1); drawimage(); SaveData(); } else { File.Delete(Server.MapPath(@"~\Uploads\") + hdfTUser.Value + "2.jpg"); File.Delete(Server.MapPath(@"~\Uploads\") + hdfTUser.Value + "1.jpg"); lblPopUpMessage.Text = "That user name is already taken in our system.</br> Please choose a unique user name"; mpeMessage.Show(); txtClear(); } } else { if (!aflup1.HasFile) { string[] dd = Directory.GetFiles(Server.MapPath("~/Uploads/")); if (!dd.Contains(Server.MapPath("~/Uploads/" + pictureName))) { System.IO.File.Copy(Server.MapPath("~/Uploads/no_photo.jpg"), Server.MapPath("~/Uploads/" + pictureName)); Session["image"] = pictureName; } } img.ImageUrl = Convert.ToString(Session["image"]) + "?x=" + DateTime.Now; ManageAgentBL objManage = new ManageAgentBL(txtUserName.Text, txtPassWord.Text, txtDName.Text, txtTranscriptEmail.Text, pictureName, txtAgentinfo.Text); objManage.InsertAgent(tempLoginFK, Convert.ToInt32(objManage.GetManageAgentID(ddlEditAgent.SelectedItem.Value))); drawimage(); SaveData();

} #endregion } protected void btnShow_Click(object sender, EventArgs e) { #region lblPopUpMessage.Text = txtResult.Text; mpeMessage.Show(); #endregion } //----------------- *End Region-----------/// <summary> /// btnclick event of delete button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btndelete_Click1(object sender, ImageClickEventArgs e) { #region ManageAgentBL objdel = new ManageAgentBL(); bool v1 = objdel.DeleteAgent(ddlEditAgent.SelectedItem.Value); File.Delete(Server.MapPath("Uploads/") + hdfTUser.Value + ".jpg"); File.Delete(Server.MapPath("ChatWindowImages/") + hdfTUser.Value + "info.png"); bind(); BindLview(); lblPopUpMessage.Text = hdfTUser.Value+" Agent Deleted Successfully"; mpeMessage.Show(); txtClear(); txtvisiblefal(); CUName.Visible = false; #endregion } //----------------- *End Region-----------public void txtvisiblefal() { #region txtUserName.Enabled = false;

txtPassWord.Enabled = false; txtDName.Enabled = false; txtTranscriptEmail.Enabled = false; aflup1.Enabled = false; txtAgentinfo.Enabled = false; btnSave.Visible = false; #endregion } public void txtvisibletrue() { #region txtUserName.Enabled = true; txtPassWord.Enabled = true; txtDName.Enabled = true; txtTranscriptEmail.Enabled = true; aflup1.Enabled = true; txtAgentinfo.Enabled = true; btnSave.Visible = true; #endregion } protected void CUName_Click(object sender, ImageClickEventArgs e) { #region ManageAgentBL objManage = new ManageAgentBL(); if (objManage.CheckUserName(txtUserName.Text)) { Label2.Text = string. Empty; lbluname.Text ="</br>"+ hdfTUser.Value + " Username is available"; txtvisibletrue(); } else { lbluname.Text = string. Empty; Label2.Text = "</br>" + hdfTUser.Value + " Username has been taken already in the system"; txtvisiblefal(); } #endregion } }

AccountSetting
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class AccountSettings : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Session["loginIDSession"] == null) { Response.Redirect("Login.aspx"); } HiddenField hdfMaster = (HiddenField)Master.FindControl("hdfActive"); if (hdfMaster != null) { hdfMaster.Value = "Account"; } AccountSettingBL objAccount = new AccountSettingBL(); int tempLoginID = Convert.ToInt32(Session["loginIDSession"]); if (!IsPostBack) { objAccount.SelectAccountSetting(tempLoginID,txtChatName,txtChatGreeting, txtHdnChatGreeting,txtAwayMessage,txtHdnAwayMessage,txtOffMessage, txtHdnOffMessage, chksettings, ddlVisitors); //if (txtChatName.Text == string. Empty) //{ // string username = Session["userNameSession"].ToString(); // txtChatName.Text = username+" used cars"; // txtChatGreeting.Text = "Have a question?\nwe are available to chat!"; // txtAwayMessage.Text = "Ask a question and\nan agent will be\nwith you shortly."; // txtOffMessage.Text = "Sorry, but our operators are\nnot available at the time"; //} } }

protected void imgbtnSave_Click(object sender, ImageClickEventArgs e) { int tempLoginID = Convert.ToInt32(Session["loginIDSession"]); string tempAccountName = Convert.ToString(Session["userNameSession"]); string ChatGreeting = txtHdnChatGreeting.Text.Replace("\r\n||\n\n||\\n||\r", "\n"); string AwayMessage = txtHdnAwayMessage.Text.Replace("\r\n||\n\n||\\n", "\n"); string OffMessage = txtHdnOffMessage.Text.Replace("\r\n||\n\n||\\n", "\n"); string[] strChatGreeting = ChatGreeting.Split('\n'); string[] strAwayMessage = AwayMessage.Split('\n'); string[] strOffMessage = OffMessage.Split('\n'); if (strChatGreeting.Length - 1 >= 5) { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert(' ChatGreeting to be allowed with in 5 lines');", true); //txtChatGreeting.Focus(); } else if(strAwayMessage.Length - 1 >= 5 ) { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('AwayMessage to be allowed with in 5 lines');", true); // txtAwayMessage.Focus(); } else if(strOffMessage.Length - 1 >= 5) { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert(' OfflineMessage to be allowed with in 5 lines');", true); //txtOffMessage.Focus(); } else { AccountSettingBL objAccount = new AccountSettingBL(txtChatName.Text, ChatGreeting, AwayMessage, OffMessage, chksettings.Items[0].Selected, chksettings.Items[1].Selected, chksettings.Items[2].Selected, Convert.ToInt32(ddlVisitors.SelectedItem.Text)); objAccount.SaveAccountSetting(tempLoginID); lblPopUpMessage.Text = "Saved Successfully"; mpeMessage.Show(); } } }

Customize widget
using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.IO; using System.Drawing; using System.Drawing.Drawing2D; using Image = System.Drawing.Image; public partial class CustomizeWizard : System.Web.UI.Page { Random objRandom = new Random(); string username; string btmmsg; //Page_load Coding #region protected void Page_Load(object sender, EventArgs e) { if (Session["loginIDSession"] == null) { Response.Redirect("Login.aspx"); } Session["imgSavepath"] = ""; HiddenField hdfMaster = (HiddenField)Master.FindControl("hdfActive"); if (hdfMaster != null) { hdfMaster.Value = "Customize"; } if (!IsPostBack) { EnabledTrue(); CustomizeWizardBL objcustom = new CustomizeWizardBL(); int tempLoginID = Convert.ToInt32(Session["loginIDSession"]);

objcustom.SelectCustom(tempLoginID, txtBackcolor, txtTextcolor, txtBtmmsg, imgSideWidget, imgBottomWidget, imgChatWindow, hdf1, hdf2); string color = hdf1.Value; imgbtnSave.Style["display"] = "none"; //if (txtBtmmsg.Text == string. Empty) //{ // txtBtmmsg.Text = "Call us at 888-321-8467"; //} username = Session["userNameSession"].ToString(); btmmsg = txtBtmmsg.Text; if (File.Exists(Server.MapPath("~/ChatWindowImages/" + username + "online.jpg"))) { imgChatWindow.ImageUrl = "~/ChatWindowImages/" + username + "online.jpg"; } else { //imgChatWindow.ImageUrl = @"ChatWindowImages\Bell Davidson.jpg"; imgChatWindow.ImageUrl = "DynamicChatWin.aspx?ImageType=1&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + username + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); } if(File.Exists(Server.MapPath("~/BottomWidgetImages/"+username+ "BottomWidget.jpg"))) { imgBottomWidget.ImageUrl = "~/BottomWidgetImages/" + username + "BottomWidget.jpg"; } else { //imgBottomWidget.ImageUrl = @"BottomWidgetImages\BottomWidget.jpg"; imgBottomWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=2&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + username + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); }

if(File.Exists(Server.MapPath("~/SideWidgetImages/" + username + "SideWidgetImages.jpg"))) { imgSideWidget.ImageUrl = "~/SideWidgetImages" + username + "SideWidgetImages.jpg"; } else { //imgSideWidget.ImageUrl = @"SideWidgetImages\SideWidget.jpg"; imgSideWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=3&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + username + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); } #region //imgChatWindow.ImageUrl = "DynamicChatWin.aspx?ImageType=1&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + username + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); // imgBottomWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=2&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + username + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); //imgSideWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=3&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + username + "&btmmsg1=" + btmmsg + "&Random=" + Convert.ToString(objRandom.NextDouble()); ////username = Session["userNameSession"] + ".jpg"; ////imgbtnSave.Style["display"] = "none"; ////imgbtnPreview.Style["display"] = "none"; ////txtBtmmsg.Text = string. Empty; ////txtBackcolor.BackColor = System.Drawing.ColorTranslator.FromHtml("#A41520"); ////txtTextcolor.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); //// = "A41520"; ////hdf2.Value = "FFFFFF"; #endregion

} } #endregion //DropDownList Selection Coding #region //protected void ddlAgent_SelectedIndexChanged(object sender, EventArgs e) //{ // if (ddlAgent.SelectedItem.Text == "----Select----") // { // txtBtmmsg.Text = string. Empty; // txtBackcolor.BackColor = System.Drawing.ColorTranslator.FromHtml("#A41520"); // txtTextcolor.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); // hdf1.Value = "A41520"; // hdf2.Value = "FFFFFF"; // hdf3.Value = "no_photo.jpg"; // txtAgentinfo.Text = string. Empty; // img.ImageUrl = "Uploads/no_photo.jpg"; // imgChatWindow.ImageUrl = "ChatWindowImages/Bell Davidson.jpg"; // imgBottomWidget.ImageUrl = "BottomWidgetImages/BottomWidget.jpg"; // imgSideWidget.ImageUrl = "SideWidgetImages/SideWidget.jpg"; // hdnPhotoCount.Value= // img.ImageUrl.ToString().Substring(img.ImageUrl.ToString().IndexOf('.') - 1, 1); // aflup1.Visible = false; // EnabledFalse(); // } // else // { // Response.Cache.SetCacheability(HttpCacheability.NoCache); // txtAgentname.Text = ddlAgent.SelectedItem.Text; // CustomizeWizardBL objCustomize = new CustomizeWizardBL(); // objCustomize.SelectAgent(ddlAgent.SelectedItem.Value); // txtAgentinfo.Text = objCustomize.AgentInfo; // string replace = txtAgentinfo.Text.Replace('\r', ' '); // string[] split = replace.Split('\n'); // replace = ""; // for (int i = 0; i < split.Length; i++) // { // replace += split[i].Trim() + "\\n"; // }

// txtBackcolor.BackColor = System.Drawing.ColorTranslator.FromHtml("#" + (objCustomize.BackGroundColor == "" ? "A41520" : objCustomize.BackGroundColor)); // txtTextcolor.BackColor = System.Drawing.ColorTranslator.FromHtml("#" + (objCustomize.TextColor == "" ? "FFFFFF" : objCustomize.TextColor)); // hdf1.Value = objCustomize.BackGroundColor; // hdf2.Value = objCustomize.TextColor; // hdf3.Value = objCustomize.AgentPhoto; // txtAgentinfo.Text = objCustomize.AgentInfo; // img.ImageUrl = "Uploads/" + (objCustomize.AgentPhoto == "" ? "no_photo.jpg" : objCustomize.AgentPhoto + "?x=" + DateTime.Now); // hdnPhotoCount.Value = img.ImageUrl.ToString().Substring(img.ImageUrl.ToString().IndexOf('.') - 1, 1); // imgChatWindow.ImageUrl = "DynamicChatWin.aspx?ImageType=1&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + ddlAgent.SelectedItem.Value + "&ChatTitle=BOBS USED CARS LIVE HELP&AgentName=" + ddlAgent.SelectedItem.Text + "&AgentInfo=" + replace + "&Photo=" + (hdf3.Value == "" ? "no_photo.jpg" : hdf3.Value); // imgBottomWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=2&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + ddlAgent.SelectedItem.Value + "&ChatTitle=BOBS USED CARS LIVE HELP&AgentName=" + ddlAgent.SelectedItem.Text + "&AgentInfo=" + replace + "&Photo=" + (hdf3.Value == "" ? "no_photo.jpg" : hdf3.Value); // imgSideWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=3&BGColor=" + (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" + (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" + ddlAgent.SelectedItem.Value + "&ChatTitle=BOBS USED CARS LIVE HELP&AgentName=" + ddlAgent.SelectedItem.Text + "&AgentInfo=" + replace + "&Photo=" + (hdf3.Value == "" ? "no_photo.jpg" : hdf3.Value); // aflup1.Visible = true; // EnabledTrue(); // } //}

#endregion //AsyncFile Upload Coding #region //protected void aflup1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) //{ // try // { // if (aflup1.PostedFile != null) // { // HttpPostedFile file = aflup1.PostedFile; // byte[] data = ReadFile(file); // Session[XMPPHelper.STORED_IMAGE] = data; // var imgstream = new MemoryStream(data); // Image imgPreview = Image.FromStream(imgstream); // string count = hdnPhotoCount.Value.ToString(); // if ((count != "1" && count != "2") || count != "1") // { // imgPreview.Save(Server.MapPath(".") + "\\Uploads\\" + ddlAgent.SelectedItem.Value + "1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); // } // else if (count != "2") // { // imgPreview.Save(Server.MapPath(".") + "\\Uploads\\" + ddlAgent.SelectedItem.Value + "2.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); // } // imgPreview.Dispose(); // } // hdfcount.Value = "1"; // imgbtnSave.Style["display"] = "none"; // } // catch { } //} #endregion private byte[] ReadFile(HttpPostedFile file) { byte[] data = new Byte[file.ContentLength]; file.InputStream.Read(data, 0, file.ContentLength); return data; }

//Preiview Button Coding #region protected void imgbtnPreview_Click(object sender, ImageClickEventArgs e) { imgbtnSave.Style["display"] = ""; btmmsg = txtBtmmsg.Text; username = Session["userNameSession"].ToString(); Response.Cache.SetCacheability(HttpCacheability.NoCache); txtBackcolor.BackColor = System.Drawing.ColorTranslator.FromHtml("#" (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString())); txtTextcolor.BackColor = System.Drawing.ColorTranslator.FromHtml("#" (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString())); imgChatWindow.ImageUrl = "DynamicChatWin.aspx?ImageType=1&BGColor=" (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" username + "&btmmsg1=" + btmmsg + "&Random=" Convert.ToString(objRandom.NextDouble()); imgBottomWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=2&BGColor=" (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" username + "&btmmsg1=" + btmmsg + "&Random=" Convert.ToString(objRandom.NextDouble()); imgSideWidget.ImageUrl = "DynamicChatWin.aspx?ImageType=3&BGColor=" (hdf1.Value.ToString() == "" ? "A41520" : hdf1.Value.ToString()) + "&TXTColor=" (hdf2.Value.ToString() == "" ? "FFFFFF" : hdf2.Value.ToString()) + "&AgentName1=" username + "&btmmsg1=" + btmmsg + "&Random=" Convert.ToString(objRandom.NextDouble()); } #endregion //Save Button Coding #region protected void imgbtnSave_Click(object sender, ImageClickEventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); username = Session["userNameSession"].ToString(); File.Delete(Server.MapPath("ChatWindowImages/") + username + "online.jpg"); System.IO.File.Copy(Server.MapPath("PreviewChatWindowImages/" + username "online.jpg"), Server.MapPath("ChatWindowImages/" + username + "online.jpg")); File.Delete(Server.MapPath("ChatWindowImages/") + username + "Away.jpg");

+ + + + + + + + + + + + + +

System.IO.File.Copy(Server.MapPath("PreviewChatWindowImages/" + username + "Away.jpg"), Server.MapPath("ChatWindowImages/" + username + "Away.jpg")); File.Delete(Server.MapPath("ChatWindowImages/") + username + "Offline.jpg"); System.IO.File.Copy(Server.MapPath("PreviewChatWindowImages/" + username + "Offline.jpg"), Server.MapPath("ChatWindowImages/" + username + "Offline.jpg")); File.Delete(Server.MapPath("ChatWindowImages/") + username + "onlinePopup.jpg"); System.IO.File.Copy(Server.MapPath("PreviewChatWindowImages/" + username + "onlinePopup.jpg"), Server.MapPath("ChatWindowImages/" + username + "onlinePopup.jpg")); File.Delete(Server.MapPath("ChatWindowImages/") + username + "OfflinePopup.jpg"); System.IO.File.Copy(Server.MapPath("PreviewChatWindowImages/" + username + "OfflinePopup.jpg"), Server.MapPath("ChatWindowImages/" + username + "OfflinePopup.jpg")); File.Delete(Server.MapPath("BottomWidgetImages/") + username + "BottomWidget.jpg"); System.IO.File.Copy(Server.MapPath("PreviewBottomWidgetImages/" + username + "BottomWidget.jpg"), Server.MapPath("BottomWidgetImages/" + username + "BottomWidget.jpg")); File.Delete(Server.MapPath("SideWidgetImages/") + username + "SideWidget.jpg"); System.IO.File.Copy(Server.MapPath("PreviewSideWidgetImages/" + username + "SideWidget.jpg"), Server.MapPath("SideWidgetImages/" + username + "SideWidget.jpg")); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "online.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "Away.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "Offline.jpg"); File.Delete(Server.MapPath("PreviewBottomWidgetImages/") + username + "BottomWidget.jpg"); File.Delete(Server.MapPath("PreviewSideWidgetImages/") + username + "SideWidget.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "onlinePopup.jpg"); File.Delete(Server.MapPath("PreviewChatWindowImages/") + username + "OfflinePopup.jpg"); //CustomizeWizardBL objCustomize = new CustomizeWizardBL(hdf1.Value.ToString(), hdf2.Value.ToString(),txtBtmmsg.Text,username, username, username); CustomizeWizardBL objCustomize = new CustomizeWizardBL(hdf1.Value.ToString(), hdf2.Value.ToString(), txtBtmmsg.Text, username + "online.jpg", username + "Away.jpg", username + "Offline.jpg", username + "SideWidget.jpg", username + "BottomWidget.jpg", username + "onlinePopup.jpg", username + "OfflinePopup.jpg"); objCustomize.UpdateCustomizeWizard(Convert.ToInt32(Session["loginIDSession"])); mpeMessage.Show(); } #endregion

//Enable true fun #region public void EnabledTrue() { txtBackcolor.Enabled = true; txtTextcolor.Enabled = true; txtBtmmsg.Enabled = true; } #endregion //public void EnabledFalse() //{ // txtAgentinfo.Enabled = false; // txtAgentname.Enabled = false; // txtBackcolor.Enabled = false; // txtTextcolor.Enabled = false; // aflup1.Enabled = false; // imgbtnPreview.Style["display"] = "none"; // imgbtnSave.Style["display"] = "none"; //} }

SAMPLE INPUT/OUTPUT
LOGIN

MANAGE WEBSITE

Add Website

Save Website

Dealer website (add new agent)

Save Dealer Website

ACCOUNT SETTINGS

CUSTOMIZE

EMBED WIDGET

TRANSCRIPTS

You might also like