<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using DAL;

namespace DAO
{
    public class Category 
    {
        public CatDal mainCatDal = new CatDal();
        private int typeId;
        private String mainCat;
        private int mainCatID;
        private String category;
        private int catID;
        private int uGrouoId;

        public int UGrouoId
        {
            get { return uGrouoId; }
            set { uGrouoId = value; }
        }

       
        private int subCatID;

        public int SubCatID
        {
            get { return subCatID; }
            set { subCatID = value; }
        }
        private String subCat;

        public String SubCat
        {
            get { return subCat; }
            set { subCat = value; }
        }

        public int CatID
        {
            get { return catID; }
            set { catID = value; }
        }

        public String Category1
        {
            get { return category; }
            set { category = value; }
        }

        public int MainCatID
        {
            get { return mainCatID; }
            set { mainCatID = value; }
        }

        public String MainCat
        {
            get { return mainCat; }
            set { mainCat = value; }
        }
        private String desc;

        public String Desc
        {
            get { return desc; }
            set { desc = value; }
        }
        private int status;

        public int Status
        {
            get { return status; }
            set { status = value; }
        }
     


        public int TypeId
        {
          get { return typeId; }
          set { typeId = value; }
        }


       
        //Method for manage main categories
        public Boolean InsertMainCategory(Category obj)
        {
            if (mainCatDal.insertMainCat(obj.typeId, obj.MainCat, obj.desc, obj.status))
                return true;
            else
                return false;

        }
        //Method for manage main categories
        public DataTable GetAllMainCategory()
        {
            DataTable Dt = mainCatDal.GetAllMainCategory();
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

        //Method for manage main categories by category
        public DataTable GetAllMainCategoryByName(String category)
        {
            DataTable Dt = mainCatDal.GetAllMainCategoryByName(category);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

        public DataTable GetMainCat(Category obj)
        {
            DataTable Dt = mainCatDal.GetMainCategory(obj.typeId);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return Dt;

        }

        public DataTable GetCategoryByMaincat(Category obj)
        {
            DataTable Dt = mainCatDal.GetCategory(obj.mainCatID);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return Dt;

        }

        public DataTable GetSubCategoryByCat(Category obj)
        {
            DataTable Dt = mainCatDal.GetSubCategoryByCategory(obj.catID);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return Dt;

        }



        public DataTable GetAllData()
        {
            DataTable Dt = mainCatDal.GetAllDataForCategory();
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

        public DataTable GetAllDataWithSubCat(Category obj)
        {
            DataTable Dt = mainCatDal.GetAllDataForSubCategory(obj.catID);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

       
        public Boolean InsertCategory(Category obj)
        {
            if (mainCatDal.inserCat( obj.mainCatID,obj.category, obj.desc, obj.status))
                return true;
            else
                return false;

        }



        //Method for manage main categories by category
        public DataTable GetCategoryByName(String category)
        {
            DataTable Dt = mainCatDal.GetCategoryByName(category);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

     
        public DataTable GetSubCategoryByName(String subCategory)
        {
            DataTable Dt = mainCatDal.GetSubCategoryByName(subCategory);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return Dt;

        }


        //Method for manage sub  categories
        public Boolean InsertSubCategory(Category obj)
        {
            if (mainCatDal.inserSubCat(obj.catID,obj.subCat , obj.desc, obj.status,obj.uGrouoId,"Admin"))
                return true;
            else
                return false;

        }

    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;

namespace DAL
{
    public class TaskDal : DataAccess
    {

        public DataTable GetAllDataForUser(String user)
        {
            try
            {
                string sql = "";
                DataSet dt;



                sql = "SELECT        Sender, Message, ReceivedDate FROM    FB_MessageReceived";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }



    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using DAL;

namespace DAO
{
   public class Intraction
    {

       IntractionDal objItraction = new IntractionDal();

       private int type;

       public int Type
       {
           get { return type; }
           set { type = value; }
       }

       private int intractionID;

       public int IntractionID
       {
           get { return intractionID; }
           set { intractionID = value; }
       }
       
        private int mainCat;

        public int MainCat
        {
            get { return mainCat; }
            set { mainCat = value; }
        }
        private int category;

        public int Category
        {
            get { return category; }
            set { category = value; }
        }
        private int subCat;

        public int SubCat
        {
            get { return subCat; }
            set { subCat = value; }
        }
        private String agentRemarks;

        public String AgentRemarks
        {
            get { return agentRemarks; }
            set { agentRemarks = value; }
        }
        private String status;

        public String Status
        {
            get { return status; }
            set { status = value; }
        }
        private String modifiedUser;

        public String ModifiedUser
        {
            get { return modifiedUser; }
            set { modifiedUser = value; }
        }
        private int assignGrp;

        public int AssignGrp
        {
            get { return assignGrp; }
            set { assignGrp = value; }
        }
            private int reassign;

            public int Reassign
            {
                get { return reassign; }
                set { reassign = value; }
            }

            public Boolean UpdateIntraction(Intraction obj)
        {
            if (objItraction.UpdateIntraction(obj.intractionID, obj.type, obj.mainCat, obj.category, obj.subCat, obj.agentRemarks, obj.status, obj.modifiedUser, obj.assignGrp, obj.reassign))
                return true;
            else
                return false;

        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data;

namespace DAO
{
   public class LoginUser
    {
       //Variables for login

        private String userName;
        private String password;
        public LoginDal dal = new LoginDal();

        public String UserName
        {
            get { return userName; }
            set { userName = value; }
        }
       

        public String Password
        {
            get { return password; }
            set { password = value; }
        }

        public DataTable getUser(LoginUser obj)
        {
           DataTable Dt = dal.getLogin(obj.userName ,obj.password);
           if (Dt.Rows.Count > 0)
               return Dt;
           else
               return Dt;
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data;

namespace DAO
{
   public  class UserInfo
    {
       public UserDal userDal = new UserDal();

       private String distribution;

       public String Distribution
       {
           get { return distribution; }
           set { distribution = value; }
       }
        private String userGroupName;

        public String UserGroupName
        {
            get { return userGroupName; }
            set { userGroupName = value; }
        }
        private String userGrouDesc;

        public String UserGrouDesc
        {
            get { return userGrouDesc; }
            set { userGrouDesc = value; }
        }
        private int assignUsers;

        public int AssignUsers
        {
            get { return assignUsers; }
            set { assignUsers = value; }
        }


        private String uName;

        public String UName
        {
            get { return uName; }
            set { uName = value; }
        }
        private String password;

        public String Password
        {
            get { return password; }
            set { password = value; }
        }
        private String email;

        public String Email
        {
            get { return email; }
            set { email = value; }
        }
        private int status;

        public int Status
        {
            get { return status; }
            set { status = value; }
        }
        private String userMode;

        public String UserMode
        {
            get { return userMode; }
            set { userMode = value; }
        }
       
        public bool SaveUserDetails(UserInfo objuser)
       {
           
           if (userDal.InserUserDetails(objuser.uName,objuser.password,objuser.email,objuser.status,objuser.userMode))
               return true;
           else
               return false;
       }

        public DataTable GetUserData(UserInfo objuser)
        {
            DataTable Dt = userDal.GetAllDataForUser(objuser.userMode);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }


        public DataTable GetUserByName(String user)
        {
            DataTable Dt = userDal.GetUserByName(user);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

        public DataTable GetAllusers()
        {
            DataTable Dt = userDal.GetAllusers();
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

        public bool SaveUserGroupDetails(UserInfo objuser)
        {

            if (userDal.InserUserGroupDetails(objuser.userGroupName, objuser.userGrouDesc, objuser.status,  objuser.distribution))
                return true;
            else
                return false;
        }


        public DataTable GetAlluserGroups()
        {
            DataTable Dt = userDal.GetAllusersAndGroups();
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return Dt;

        }

        public DataTable GetAlluserGroupsBySubCat(int subCat)
        {
            DataTable Dt = userDal.GetAllusersAndGroupsBySubCat(subCat);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return Dt;

        }

        public DataTable GetUserGroupByName(String user)
        {
            DataTable Dt = userDal.GetDetailsByName(user);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

        public bool SaveUserGroupWithUsers(UserInfo objuser)
        {

            if (userDal.InserUserGroupDetailsWithUsers(objuser.userGroupName,objuser.uName))
                return true;
            else
                return false;
        }


    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;

namespace DAL
{
    public class UserDal : DataAccess
    {

        public Boolean InserUserDetails(String uname, String password, String email, int status, String mode)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[5];
                param[0] = new SqlParameter("@UserName", uname);
                param[1] = new SqlParameter("@Password", password);
                param[2] = new SqlParameter("@EmailAdd", email);
                param[3] = new SqlParameter("@Status", status);
                param[4] = new SqlParameter("@UserMode", mode);
                callSp("Sp_InsertUser", param);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


        public DataTable GetAllDataForUser(String userMode)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT     *  FROM         CIA_User WHERE UserMode =  '" + userMode + "'";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


        public DataTable GetUserByName(String Uname)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT     UserID, Username, Password, Email, IsActive, CreatedDate, Login, UserMode FROM CIA_User where Username= '" + Uname + "'  ";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


        public DataTable GetAllusers()
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT     UserID, Username, Password, Email, IsActive, CreatedDate, Login, UserMode FROM CIA_User  ";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public Boolean InserUserGroupDetails(String uGroupname, String desc, int status, String distribution)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[4];
                param[0] = new SqlParameter("@UserGroupName", uGroupname);
                param[1] = new SqlParameter("@Desc", desc);
                param[2] = new SqlParameter("@Status", status);
                param[3] = new SqlParameter("@Distribution", distribution);

                callSp("Sp_InsertUserGroups", param);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public Boolean InserUserGroupDetailsWithUsers(String uGroupname, String @User)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Group", uGroupname);
                param[1] = new SqlParameter("@User", @User);


                callSp("Sp_InsertUserGroupsToUsers", param);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable GetAllusersAndGroups()
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT     CIA_User.Username, CIA_UserGroups.GroupID, CIA_Group.GroupName, CIA_Group.Description, CIA_Group.IsActive FROM CIA_User INNER JOIN "+
                      " CIA_UserGroups ON CIA_User.UserID = CIA_UserGroups.UserID RIGHT OUTER JOIN "+
                      " CIA_Group ON CIA_UserGroups.GroupID = CIA_Group.GroupID" ;
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable GetAllusersAndGroupsBySubCat(int Subcat)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT     CIA_SubCategory.SubCatID, CIA_Group.GroupName ,CIA_Group.GroupName,CIA_Group.GroupID FROM  CIA_SubCategory INNER JOIN  " +
                      " CIA_Group ON CIA_SubCategory.AssignedGroup = CIA_Group.GroupID where SubCatID ='" + Subcat + "'";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }



        public DataTable GetDetailsByName(String groupName)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT GroupID, GroupName, Description, RegionID, AccessID, IsActive, CreatedDate, Distribution, MaxInteraction, MinInteraction FROM CIA_Group where GroupName ='" + groupName + "' ";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using System.Data;

namespace DAO
{
    public class PendingOrder : DataAccess
    {

        //get pending order summary
        public List<OrderSummary> GetAllPendingOrder()
        {
            List<OrderSummary> _lst = new List<OrderSummary>();
            string sql = "select * from  view_pendingOrder";
            SqlDataReader dr = getDataReaderData(sql);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    _lst.Add(new OrderSummary
                    {
                        customerName = dr["Sender"] != DBNull.Value ? Convert.ToString(dr["Sender"]) : "",
                        receivedDate = dr["ReceivedDate"] != DBNull.Value ? Convert.ToDateTime(dr["ReceivedDate"]) : DateTime.Now,
                        orderId = dr["ID"] != DBNull.Value ? Convert.ToString(dr["ID"]) : "",
                    });
                }
            }

            return _lst;
        }

        //get current order summary details
        public List<CurrentOrderDetails> GetCurrentPendingOrder(string orderId)
        {
            List<OrderDetails> _lstOrder = new List<OrderDetails>();
            List<OrderSummary> _lstCustomer = new List<OrderSummary>();
            List<CurrentOrderDetails> _lstCurrentOrder= new List<CurrentOrderDetails>();

            string sql = "SELECT  DISTINCT dbo.FB_MessageReceived.ID, dbo.FB_MessageReceived.Sender," +
                "dbo.FB_MessageReceived.ReceivedDate, dbo.FB_Order_Details.ItemCode, dbo.FB_Order_Details.Qty," +
                "dbo.FB_Order_Details.UnitPrice,dbo.FB_Order_Details.Value, dbo.CIA_ItemMaster.ItemName FROM " +
                " dbo.FB_MessageReceived INNER JOIN dbo.FB_Order_Details ON " +
                "dbo.FB_MessageReceived.ID = dbo.FB_Order_Details.O_id INNER JOIN " +
                 "dbo.CIA_ItemMaster ON dbo.FB_Order_Details.ItemCode = dbo.CIA_ItemMaster.ItemCode " +
                 "where FB_MessageReceived.ID ='" + Convert.ToInt16(orderId) + "'";
            SqlDataReader dr = getDataReaderData(sql);

            if (dr.HasRows)
            {
                int i = 0;
                while (dr.Read())
                {
                    if (i == 0)
                    {
                        _lstCustomer.Add(new OrderSummary
                        {
                            customerName = dr["Sender"] != DBNull.Value ? Convert.ToString(dr["Sender"]) : "",
                            receivedDate = dr["ReceivedDate"] != DBNull.Value ? Convert.ToDateTime(dr["ReceivedDate"]) : DateTime.Now,
                            orderId = dr["ID"] != DBNull.Value ? Convert.ToString(dr["ID"]) : "",
                        });
                    }

                    _lstOrder.Add(new OrderDetails
                    {
                        itemCode = dr["ItemCode"] != DBNull.Value ? Convert.ToString(dr["ItemCode"]) : "-",
                        itemName = dr["ItemName"] != DBNull.Value ? Convert.ToString(dr["ItemName"]) : "-",
                        qty = dr["Qty"] != DBNull.Value ? Convert.ToString(dr["Qty"]) : "0",
                        unitPrice = dr["UnitPrice"] != DBNull.Value ? Convert.ToDecimal(dr["UnitPrice"]) : 0,
                        value = dr["Value"] != DBNull.Value ? Convert.ToDecimal(dr["Value"]) : 0,

                    });
                    i++;
                }
                _lstCurrentOrder.Add(new CurrentOrderDetails
                {
                    customer = _lstCustomer,
                    currentOrder = _lstOrder
                });
            }

            return _lstCurrentOrder;
        }

        //update order status 

        public bool UpdateOrderStatus(string orderId,string status)
        {
            string sql = "update FB_MessageReceived  SET  FB_MessageReceived.Status='" + status + "' where  FB_MessageReceived.ID='" + Convert.ToInt16(orderId) + "'";
            int state = exeNonQury(sql);
            return state == 1 ? true : false;

        }

    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;



namespace DAL
{
    public class CatDal: DataAccess
    {


        DataTable dt;
        

     
        public DataTable GetMainCategory(int id)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT  TypeID,Type FROM CIA_Type where  InteractionTypeID = '" + id + "'";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable GetCategory(int id)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT    CatID ,Category FROM         CIA_Category where TypeID = '" + id + "'";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable GetSubCategoryByCategory(int id)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT SubCatID, CatID, SubCategory, Description, IsActive, CreatedUser, CreatedDate, AssignedGroup FROM         CIA_SubCategory where CatID = '" + id + "'";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable GetAllMainCategory()
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = " SELECT     CIA_InteractionType.InteractionType, CIA_Type.Type " +
                        "FROM         CIA_Type INNER JOIN " +
                       "CIA_InteractionType ON CIA_Type.InteractionTypeID = CIA_InteractionType.InteractionTypeID";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        public DataTable GetAllMainCategoryByName(String mainCat)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT   *  FROM  CIA_Type WHERE  Type ='" + mainCat + "' ";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable GetAllDataForCategory()
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT     CIA_InteractionType.InteractionType, CIA_Type.Type, CIA_Type.TypeID, CIA_Category.Category ,CIA_Category.Description" +
                        " FROM         CIA_Type INNER JOIN "+
                      "CIA_InteractionType ON CIA_Type.InteractionTypeID = CIA_InteractionType.InteractionTypeID INNER JOIN "+
                      "CIA_Category ON CIA_Type.TypeID = CIA_Category.TypeID ";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public Boolean insertMainCat(Int32 IntractionTypeID,String mainType,String desc ,int status)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[4];
                param[0] = new SqlParameter("@IntractionTypeID", IntractionTypeID);
                param[1] = new SqlParameter("@MainType", mainType);
                param[2] = new SqlParameter("@Desc", desc);
                param[3] = new SqlParameter("@Status", status);
                callSp("Sp_InsertMainCategory",param);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


        public Boolean inserCat(int maincatID ,String category, String desc, int status)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[4];
                param[0] = new SqlParameter("@MainTypeID", maincatID);
                param[1] = new SqlParameter("@Catgegory", category);
                param[2] = new SqlParameter("@Desc", desc);
                param[3] = new SqlParameter("@Status", status);
                callSp("Sp_InsertCategory", param);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable GetCategoryByName(String Cat)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT   * FROM         CIA_Category where Category ='" + Cat + "' ";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

            public DataTable GetSubCategoryByName(String sCat)
            {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT   *   FROM  CIA_SubCategory  where SubCategory  ='" + sCat + "' ";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public Boolean inserSubCat(int catID, String category, String desc, int status,int uGroup,String User)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[6];
                param[0] = new SqlParameter("@CatID", catID);
                param[1] = new SqlParameter("@SubCat", category);
                param[2] = new SqlParameter("@Description", desc);
                param[3] = new SqlParameter("@CreatedUser", User);
                param[4] = new SqlParameter("@Status", status);
                param[5] = new SqlParameter("@AssignedGroup", uGroup);
               
                callSp("Sp_InsertSubCategory", param);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable GetAllDataForSubCategory(int catId)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT     CIA_InteractionType.InteractionType, CIA_Type.Type, CIA_Type.TypeID, CIA_Category.Category, CIA_Category.Description, CIA_SubCategory.SubCategory, " +
                      "CIA_SubCategory.Description AS Expr1 FROM         CIA_Type INNER JOIN" +
                     " CIA_InteractionType ON CIA_Type.InteractionTypeID = CIA_InteractionType.InteractionTypeID INNER JOIN " +
                     " CIA_Category ON CIA_Type.TypeID = CIA_Category.TypeID INNER JOIN " +
                      "CIA_SubCategory ON CIA_Category.CatID = CIA_SubCategory.CatID where CIA_SubCategory.CatID ='" + catId + "'";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

    
    }
}
<file_sep>﻿


    var loginAuth = (function () {
        var UserName ='admin'
        var Password ='<PASSWORD>'
        return {
            login: function (uName, pwd) {
                if (uName == UserName && Password == pwd) {
                    window.location.href = "pendingOrders.aspx";
                    return;
                }
                else {
                    //invlid login details
                    notie.alert(3, 'Invalid use name or password!', 3);
                    return;
                }
            }
        }
    })();

    $('#loginBtn').on('click', function () {
        var userName = $('#userName').val();
        var passWord = $('#password').val();
        if (!userName) {
            notie.alert(3, 'Please enter user name', 3);
            $('#userName').focus();
            return;
        }
        if (!passWord) {
            notie.alert(3, 'Please enter passsowrd', 3);
            $('#password').focus();
            return;
        }
         loginAuth.login(userName,passWord);
    });
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAO
{
   public class OrderDetails
    {
       public string qty { get; set; }
       public decimal unitPrice { get; set; }
       public decimal value { get; set; }
       public float total { get; set; }
       public string itemName { get; set; }
       public string itemCode { get; set; }

    }

   public class OrderSummary
   {
       public string customerName { get; set; }
       public string orderId { get; set; }
       public DateTime receivedDate { get; set; }
   }

   public class CurrentOrderDetails
   {
       public List<OrderSummary> customer { get; set; }
       public List<OrderDetails> currentOrder { get; set; }


   }

}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using DAL;

namespace DAO
{
    public class Tasks
    {
        private String UserName;
        TaskDal taskObj = new TaskDal();
        
        public String UserName1
        {
            get { return UserName; }
            set { UserName = value; }
        }


        public DataTable GetTasksUserWise(String userName)
        {
            DataTable Dt = taskObj.GetAllDataForUser(userName);
            if (Dt.Rows.Count > 0)
                return Dt;
            else
                return null;

        }

    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using System.Data.SqlClient;

namespace DAO
{
   public class CompleteOrder:DataAccess
    {
       public List<OrderSummary> GetAllCompletOrder()
       {
           List<OrderSummary> _lst = new List<OrderSummary>();
           string sql = "select * from  view_completOrder";
           SqlDataReader dr = getDataReaderData(sql);

           if (dr.HasRows)
           {
               while (dr.Read())
               {
                   _lst.Add(new OrderSummary
                   {
                       customerName = dr["Sender"] != DBNull.Value ? Convert.ToString(dr["Sender"]) : "",
                       receivedDate = dr["ReceivedDate"] != DBNull.Value ? Convert.ToDateTime(dr["ReceivedDate"]) : DateTime.Now,
                       orderId = dr["ID"] != DBNull.Value ? Convert.ToString(dr["ID"]) : "",
                   });
               }
           }

           return _lst;
       }
    }
}
<file_sep>﻿


var getPendingOrder = function () {

     $('#table_id').html("");
        $.ajax({
            type: "POST",
            contentType: "application/json",
            dataType: "json",
            url: 'services/pendingOredrService.asmx/GetPendingOrder',
            success: function (data) {
                var order = JSON.parse(data.d);
                for (var i = 0; i < order.length; i++) {
                    $('#table_id').append("<tr><td>" + order[i].orderId +
                        "</td><td>" + order[i].customerName +
                        "</td><td>" + order[i].receivedDate +
                        "</td></td><td><button type='button'  data-toggle='modal' data-target='#myModal'" +
                        "onClick='vieweMoreDetails(" + order[i].orderId + ")' class='btn btn-info'>" +
                       " View Order</button></td></tr>");
                }
            },
            error: function (repo) {
                console.log("error"+ repo);
            }
        });
    }

getPendingOrder();

var getProcessingOrder = function () {

    $('#tablePro_id').html("");
    $.ajax({
        type: "POST",
        contentType: "application/json",
        dataType: "json",
        url: 'services/pendingOredrService.asmx/GetProcessingOrder',
        success: function (data) {
            var order = JSON.parse(data.d);
            for (var i = 0; i < order.length; i++) {
                $('#tablePro_id').append("<tr><td>" + order[i].orderId +
                    "</td><td>" + order[i].customerName +
                    "</td><td>" + order[i].receivedDate +
                    "</td></td><td><button type='button'  data-toggle='modal'" +
                    "onClick='updateOrder(" + order[i].orderId + ",3)' class='btn btn-warning'>" +
                   " Order Complete</button></td></tr>");
            }
        },
        error: function (repo) {
            console.log("error" + repo);
        }
    });
}
getProcessingOrder();


var getCompleteOrder = function () {

    $('#tableComplete_id').html("");
    $.ajax({
        type: "POST",
        contentType: "application/json",
        dataType: "json",
        url: 'services/pendingOredrService.asmx/GetCompeleteOrder',
        success: function (data) {
            var order = JSON.parse(data.d);
            for (var i = 0; i < order.length; i++) {
                $('#tableComplete_id').append("<tr><td>" + order[i].orderId +
                    "</td><td>" + order[i].customerName +
                    "</td><td>" + order[i].receivedDate +
                    "</td></td><td><button type='button'  data-toggle='modal'" +
                    " class='btn btn-success  disabled'>" +
                   " Complete</button></td></tr>");
            }
        },
        error: function (repo) {
            console.log("error" + repo);
        }
    });
}
getCompleteOrder();


    var vieweMoreDetails = function (id) {
        
        $.ajax({
            type: "POST",
            data: JSON.stringify({ 'orderId': id}),
            contentType: "application/json",
            dataType: "json",
            url: 'services/pendingOredrService.asmx/GetCurrentPendingOrder',
            success: function (data) {
                var currentOrder = JSON.parse(data.d);
                $('#OrderView_id').html("");
                $('#total').html("");
                var total = parseInt("0");
                if (currentOrder.length > 0) {
                    document.getElementById('orderId').innerHTML = currentOrder[0].customer[0].orderId;
                    document.getElementById('customerName').innerHTML = currentOrder[0].customer[0].customerName;
                   
                    for (var i = 0; i < currentOrder[0].currentOrder.length; i++) {
                        total = total + parseInt(currentOrder[0].currentOrder[i].value)
                        $('#OrderView_id').append("<tr><td>" + currentOrder[0].currentOrder[i].itemName +
                                "</td><td>" + currentOrder[0].currentOrder[i].itemCode +
                                "</td><td>" + +currentOrder[0].currentOrder[i].qty +
                                "</td><td>" + +currentOrder[0].currentOrder[i].unitPrice +
                                "</td><td>" + +currentOrder[0].currentOrder[i].value +
                                "</tr>");
                    }
                    document.getElementById('total').innerHTML = total = null ? "Total Rs : 0" : "Total Rs : " + total;
                }
            },
            error: function (repo) {
                console.log("error" + repo);
            }
        });
    }

    var updateOrder = function (orderId, status) {
        var orderId = orderId;
        var status = status;
        if (orderId == null || orderId == "") {
            var orderId = document.getElementById('orderId').innerHTML;
            var status = 2;
        }
       
        $.ajax({
            type: "POST",
            data: JSON.stringify({ 'orderId': orderId, 'status': status }),
            contentType: "application/json",
            dataType: "json",
            url: 'services/pendingOredrService.asmx/UpdateOrderStatus',
            success: function (data) {
                if (data.d) {
                    getPendingOrder();
                    getProcessingOrder();
                    $('#myModal').modal('toggle');
                }
            },
            error: function (repo) {
                console.log("error" + repo);
            }
        });
    }


   <file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;


namespace DAL
{
    public  class IntractionDal : DataAccess
    {

        public Boolean UpdateIntraction(Int32 intractionID, int type, int mainCat, int cat, int subCat, String agentRemarks,  String status, String modifiedUser, int assignGrp, int reassign)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[10];
                param[0] = new SqlParameter("@IntractionID", intractionID);
                param[1] = new SqlParameter("@MainCat", mainCat);
                param[2] = new SqlParameter("@Cat", cat);
                param[3] = new SqlParameter("@SubCat", subCat);
                param[4] = new SqlParameter("@AgentRemarks", agentRemarks);
                param[5] = new SqlParameter("@Status", status);
                param[6] = new SqlParameter("@ModifiedUser", modifiedUser);
                param[7] = new SqlParameter("@AssignedGroup", assignGrp);
                param[8] = new SqlParameter("@Reassign", reassign);
                param[9] = new SqlParameter("@Type", type);
                
                callSp("Sp_UpdateIntraction", param);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using DAO;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
using Newtonsoft.Json;


namespace OnlineOrderSystem.services
{
    /// <summary>
    /// Summary description for pendingOredrService
    /// </summary>
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    [System.Web.Script.Services.ScriptService]
    public class pendingOredrService : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetPendingOrder()
        {
            List<OrderSummary> _lstPendingLst = new List<OrderSummary>();
            PendingOrder _pendingOrder = new PendingOrder();
            _lstPendingLst = _pendingOrder.GetAllPendingOrder();
            var jsonss = Newtonsoft.Json.JsonConvert.SerializeObject(_lstPendingLst);
            return jsonss;
        }

        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetProcessingOrder()
        {
            List<OrderSummary> _lstPendingLst = new List<OrderSummary>();
            ProcessingOrder _processingOrder = new ProcessingOrder();
            _lstPendingLst = _processingOrder.GetAllProcessingOrder();
            var jsonss = Newtonsoft.Json.JsonConvert.SerializeObject(_lstPendingLst);
            return jsonss;
        }

        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetCompeleteOrder()
        {
            List<OrderSummary> _lstPendingLst = new List<OrderSummary>();
            CompleteOrder _compeletgOrder = new CompleteOrder();
            _lstPendingLst = _compeletgOrder.GetAllCompletOrder();
            var jsonss = Newtonsoft.Json.JsonConvert.SerializeObject(_lstPendingLst);
            return jsonss;
        }




        //{ parameter orderId = 0}
        //get current pending order
        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetCurrentPendingOrder(string orderId)
        {
            List<CurrentOrderDetails> _lstCurrentOrderLst = new List<CurrentOrderDetails>();
            PendingOrder _pendingOrder = new PendingOrder();
            _lstCurrentOrderLst = _pendingOrder.GetCurrentPendingOrder(orderId);
            var jsonss = Newtonsoft.Json.JsonConvert.SerializeObject(_lstCurrentOrderLst);
            return jsonss;
        }


        

        //update status
        //order procssing 
        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public bool UpdateOrderStatus(string orderId,string status)
        {
            PendingOrder _pendingOrder = new PendingOrder();
            if (string.IsNullOrEmpty(orderId) || string.IsNullOrEmpty(status))
            {
                return false;
            }
            return _pendingOrder.UpdateOrderStatus(orderId, status);
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

namespace DAL
{
  public  class LoginDal : DataAccess
    {
        DataTable dt;
        

      // This method to get the user details for the given login details
        public DataTable getLogin(String uname ,String password)
        {
            try
            {
                string sql = "";
                DataSet dt;
                sql = "SELECT   *   FROM         CIA_User where Username= '" + uname + "' and  Password ='" + password + "'";
                dt = getDataset(sql);
                return dt.Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        
       
    }
}
