protected void Page_PreRender(object sender, EventArgs e)
        {
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            if (objAuthorizationBDto != null)
            {
                if (objAuthorizationBDto.ProgramWriteAccess == true && objAuthorizationBDto.ProgramDeleteAccess == true)
                {
                    btnAssignRightModule.Enabled = true;
                    btnAssignLeftModule.Enabled = true;
                    btnSave.Enabled = true;
                }
                if (objAuthorizationBDto.ProgramWriteAccess == true && objAuthorizationBDto.ProgramDeleteAccess != true)
                {
                    btnAssignRightModule.Enabled = true;
                    btnAssignLeftModule.Enabled = false;
                    btnSave.Enabled = true;
                }
                if (objAuthorizationBDto.ProgramWriteAccess != true && objAuthorizationBDto.ProgramDeleteAccess == true)
                {
                    btnAssignRightModule.Enabled = false;
                    btnAssignLeftModule.Enabled = true;
                    btnSave.Enabled = false;
                }

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WebHelper.WebManager.CheckSessionIsActive();
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            string usrid = Session["usersid"].ToString();
            if (objAuthorizationBDto != null)
            {
                _empID = Convert.ToInt32(Session["empid"]);
            }
            String query = "SELECT TOP 5 TOUR_SHORT_NAME,TOUR_QUOTE_MASTER.QUOTE_ID,TOUR_QUOTE_MASTER.TOUR_ID,CONVERT(varchar(10),TOUR_QUOTE_MASTER.RECONFIRMATION_DATE,103) AS DATE FROM FARE_TOUR_MASTER LEFT OUTER JOIN TOUR_QUOTE_MASTER ON FARE_TOUR_MASTER.TOUR_ID=TOUR_QUOTE_MASTER.TOUR_ID WHERE ORDER_STATUS='4' AND RECONFIRMATION_DATE BETWEEN GETDATE() AND GETDATE()+7";
            DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
            StringBuilder _sbi = new StringBuilder();
            _sbi.AppendLine("<ul>");
            foreach (DataRow dr in dt.Rows)
            {

                DataSet ds = objfitquote.fetchallData("FETCH_ALL_BOOKING_TO_BE_RECONFIRMED", usrid);
                Session["editorderstatus"] = ds.Tables[0].Rows[0]["ORDER_STATUS"].ToString();

                //_sbi.AppendLine("<li style=\"list-style-type:square;font-size:12px;padding:3px;\">" + " " + dr["TOUR_SHORT_NAME"].ToString() + " " + dr["DATE"].ToString() + "<a href=\"../../Views/FIT/BookingFit.aspx?TOURID=" + dr["TOUR_ID"].ToString() + "&QUOTEID=" + dr["QUOTE_ID"].ToString() + "" + "\"><br/>View</a>");

                _sbi.AppendLine("<li style=\"list-style-type:square;font-size:12px;padding:3px;\">" + " " + dr["TOUR_SHORT_NAME"].ToString() + "<div align=\"left\" style=\"font-size:11px;color:red;\">" + dr["DATE"].ToString() + "<a href=\"../../Views/FIT/BookingFit.aspx?TOURID=" + dr["TOUR_ID"].ToString() + "&QUOTEID=" + dr["QUOTE_ID"].ToString() + "" + "\"><br/>View</a>");


            }
            _sbi.AppendLine("</ul>");
            // _sbi.AppendLine("<a href=\"../../Views/FIT/AllBookingsToBeReconfirmed.aspx\">View All</a>");
            divanc.InnerHtml = _sbi.ToString();
        }
 protected void Page_PreInit(object sender, EventArgs e)
 {
     WebHelper.WebManager.CheckSessionIsActive();
     objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
     if (objAuthorizationBDto != null)
         _userID = objAuthorizationBDto.UserProfile.UserId;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                acbGeographicLocation.ExportButton.Enabled = false;
                BindGridCountry();
                BindGridState();
                BindGridCity();
            }


            if (Session[PageConstants.ssnUserAuthorization] != null)
            {
                objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
                Session["currentevent"] = "GeographicLocation";
            }

            hdnEditableModeCountry.Value = "false";
            hdnEditableModeState.Value = "false";
            hdnEditableModeCity.Value = "false";
            acbGeographicLocation.AddAttributeToEditButton("onClick", String.Format("javascript:return ValidateEdit('{0}')", radgrdCountry.ClientID));
            acbGeographicLocation.AddAttributeToDeleteButton("onClick", String.Format("javascript:return ValidateDelete('{0}')", radgrdCountry.ClientID));



        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
         lblWelcome.Text = "Logged in as: " + objAuthorizationBDto.UserProfile.UserName + "(" + objAuthorizationBDto.UserSelectedRoleName + ")";
         lblPreferedCompanyName.Text = objAuthorizationBDto.UserSelectedCompanyName;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[PageConstants.ssnUserAuthorization] != null)
            {
                objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            }

            if (!IsPostBack)
            {

            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            if (objAuthorizationBDto != null)
            {
                if (!objAuthorizationBDto.ProgramWriteAccess)
                {
                    cbxCompany.SaveButton.Enabled = false;
                    cbxCompany.SaveNewButton.Enabled = false;
                    cbxCompany.CopyButton.Enabled = false;
                }

            }
        }
        /// <summary>
        /// Page load event
        /// </summary>
        /// <param name="sender">The object which raised the event</param>
        /// <param name="e">The event listener object</param>

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGrid();
            }
            if (Session[PageConstants.ssnUserAuthorization] != null)
            {
                objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            }
            hdnEditableMode.Value = "false";
            acbOutputCheckList.AddAttributeToEditButton("onClick", String.Format("javascript:return ValidateEdit('{0}')", radgrdOutputCheckList.ClientID));
            acbOutputCheckList.AddAttributeToDeleteButton("onClick", String.Format("javascript:return ValidateDelete('{0}')", radgrdOutputCheckList.ClientID));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[PageConstants.ssnUserAuthorization] != null)
            {
                objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            }

            if (!IsPostBack)
            {
                BindCompanyRoleGrid();
                //Function to select one Radio Button at a time 
                SetGrdCompanyRoleRadioButtonOnClick();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindGrid();
     }
     if (Session[PageConstants.ssnUserAuthorization] != null)
     {
         objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
         Session["currentevent"] = "Role Access Mapping";
     }
     String sEventArguments = Request.Params["__EVENTARGUMENT"];
     if (sEventArguments == "DeleteModule")
         DeallocateModule();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGrid();
            }

            if (Session[PageConstants.ssnUserAuthorization] != null)
            {
                objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
                Session["currentevent"] = "Religion";
            }

            acbReligion.AddAttributeToEditButton("onClick", String.Format("javascript:return ValidateEdit('{0}')", radgrdReligion.ClientID));
            acbReligion.AddAttributeToDeleteButton("onClick", String.Format("javascript:return ValidateDelete('{0}')", radgrdReligion.ClientID));
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {

            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];

            if (!IsPostBack)
            {
                BindThemeList();
                SetTheme();
                GetEmployeeDetails();
            }

            pnlDisplayInfo.Visible = true;
            pnlEditInfo.Visible = false;

        }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     WebHelper.WebManager.CheckSessionIsActive();
     objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
     if (objAuthorizationBDto != null)
         _userID = objAuthorizationBDto.UserProfile.UserId;
     string query = "SELECT TOP 5 ANNOUNCEMENT_BODY,CONVERT(varchar(10),DATE_CREATED,101) as DATE,suma.USER_NAME FROM COMMON_ANNOUNCEMENT_MASTER cam join dbo.SYS_USER_MASTER suma on suma.USER_ID=cam.CREATED_BY ORDER BY DATE_CREATED";
     DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
     StringBuilder _sbi = new StringBuilder();
     _sbi.AppendLine("<ul>");
     foreach (DataRow dr in dt.Rows)
     {
         _sbi.AppendLine("<li style=\"list-style-type:square;font-size:13px;padding:5px;\">" + dr["ANNOUNCEMENT_BODY"].ToString() + "</br><div align=\"right\" style=\"font-size:9px;\"><b>Added on : " + dr["DATE"].ToString() + " by : " + dr["USER_NAME"].ToString() + "</b></div></li>");
     }
     _sbi.AppendLine("</ul>");
     divanc.InnerHtml = _sbi.ToString();
 }
        /// <summary>
        /// Page load event
        /// </summary>
        /// <param name="sender">The object which raised the event</param>
        /// <param name="e">The event listener object</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                BindGrid();
                mvCompany.SetActiveView(vwCompany);
            }
            if (Session[PageConstants.ssnUserAuthorization] != null)
            {
                objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
                Session["currentevent"] = "Manage Company";
            }
            hdnEditableMode.Value = "false";
            acbCompany.AddAttributeToEditButton("onClick", String.Format("javascript:return ValidateGridForEdit('{0}')", radgrdCompany.ClientID));
            acbCompany.AddAttributeToDeleteButton("onClick", String.Format("javascript:return ValidateDelete('{0}')", radgrdCompany.ClientID));

        }
 protected void Page_Load(object sender, EventArgs e)
 {
     WebHelper.WebManager.CheckSessionIsActive();
     objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
     if (objAuthorizationBDto != null)
     {
         _empID = Convert.ToInt32(Session["empid"]);
     }
     String query = "SELECT FARE_CRUISE_SCHEDULE_MASTER.CRUISE_NAME ,CONVERT(varchar(10),FARE_TOUR_CRUISE_DETAIL.TIME_LIMIT,101) AS DATE,FARE_TOUR_MASTER.TOUR_SHORT_NAME FROM FARE_TOUR_CRUISE_DETAIL,FARE_CRUISE_SCHEDULE_MASTER ,FARE_TOUR_MASTER WHERE FARE_TOUR_CRUISE_DETAIL.TOUR_ID = FARE_TOUR_MASTER.TOUR_ID AND FARE_TOUR_CRUISE_DETAIL.CRUISE_SCHEDULE_ID = FARE_CRUISE_SCHEDULE_MASTER.CRUISE_ID AND FARE_TOUR_CRUISE_DETAIL.BOOKING_STATUS != 1 AND DATEDIFF(dd,GETDATE(),FARE_TOUR_CRUISE_DETAIL.TIME_LIMIT) <= 15 AND FARE_TOUR_CRUISE_DETAIL.BOOKING_REQUEST_TO =" + _empID;
     DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
     StringBuilder _sbi = new StringBuilder();
     _sbi.AppendLine("<ul>");
     foreach (DataRow dr in dt.Rows)
     {
         _sbi.AppendLine("<li style=\"list-style-type:square;font-size:15px;padding:3px;\"> Cruise : " + dr["CRUISE_NAME"].ToString() + "</br><div align=\"left\" style=\"font-size:11px;color:red;\"><b>Time Limit : " + dr["DATE"].ToString() + "</b></br> Tour : " + dr["TOUR_SHORT_NAME"].ToString() + "</div></li>");
     }
     _sbi.AppendLine("</ul>");
     divanc.InnerHtml = _sbi.ToString();
 }
Example #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     WebHelper.WebManager.CheckSessionIsActive();
     objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
     if (objAuthorizationBDto != null)
     {
         _empID = Convert.ToInt32(Session["empid"]);
     }
     String query = "SELECT TOP 5 PACKAGE_NAME,PRICE,CURRENCY FROM SPECIAL_OFFER WHERE DISPLAY_ON_DASHBOARD='YES'";
     DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
     StringBuilder _sbi = new StringBuilder();
     _sbi.AppendLine("<ul>");
     foreach (DataRow dr in dt.Rows)
     {
         _sbi.AppendLine("<li style=\"list-style-type:square;font-size:12px;padding:3px;\">" + dr["PACKAGE_NAME"].ToString() + "</br><div align=\"left\" style=\"font-size:11px;color:red;\"><b>Price : " + dr["PRICE"].ToString()+" "+ dr["CURRENCY"].ToString());
     }
     _sbi.AppendLine("</ul>");
     //  _sbi.AppendLine("<a href=\"../../Views/Sales/Tour.aspx\">View All</a>");
     divanc.InnerHtml = _sbi.ToString();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     WebHelper.WebManager.CheckSessionIsActive();
     objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
     if (objAuthorizationBDto != null)
     {
         _empID = Convert.ToInt32(Session["empid"]);
     }
     String query = "SELECT COALESCE(CHART_OF_ACCOUNTS.CL_BALANCE,0) AS CL_BALANCE,CHART_OF_ACCOUNTS.GL_DESCRIPTION FROM CHART_OF_ACCOUNTS WHERE ACCOUNT_FLAG='A' AND CHART_OF_ACCOUNTS.CL_BALANCE <> 0  ORDER BY GL_DESCRIPTION";
     DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
     StringBuilder _sbi = new StringBuilder();
     _sbi.AppendLine("<ul>");
     foreach (DataRow dr in dt.Rows)
     {
         _sbi.AppendLine("<li style=\"list-style-type:square;font-size:12px;padding:3px;\">" + dr["GL_DESCRIPTION"].ToString() + "</br><div align=\"left\" style=\"font-size:11px;color:red;\"><b>Amount : " + dr["CL_BALANCE"].ToString()+" "+"THB");
     }
     _sbi.AppendLine("</ul>");
     //  _sbi.AppendLine("<a href=\"../../Views/Sales/Tour.aspx\">View All</a>");
     divanc.InnerHtml = _sbi.ToString();
 }
Example #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebHelper.WebManager.CheckSessionIsActive();
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            if (objAuthorizationBDto != null)
            {
                _empID = Convert.ToInt32(Session["empid"]);  
            }
            String query = "SELECT TITLE,EMP_NAME,CONVERT(varchar(10),START_DATE,101) AS DATE FROM MYTASK_MASTER,EMP_EMPLOYEE_MASTER WHERE MYTASK_MASTER.ASSIGN_BY = EMP_EMPLOYEE_MASTER.EMP_ID AND MYTASK_MASTER.STATUS_ID != 1 AND DATEDIFF(dd,GETDATE(),MYTASK_MASTER.START_DATE) <= 15 AND MYTASK_MASTER.ASSIGN_TO = " + _empID;
            DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
            StringBuilder _sbi = new StringBuilder();
            _sbi.AppendLine("<ul>");
            foreach (DataRow dr in dt.Rows)
            {
                _sbi.AppendLine("<li style=\"list-style-type:square;font-size:15px;padding:3px;\">" + dr["TITLE"].ToString() + "</br><div align=\"right\" style=\"font-size:11px;color:red\"><b>Started on : " + dr["DATE"].ToString() + " | By : " + dr["EMP_NAME"].ToString() + "</b></div></li>");
            }
            _sbi.AppendLine("</ul>");
            _sbi.AppendLine("<a href=\"../../Views/Sales/Tour.aspx\">View All</a>");  
            divanc.InnerHtml = _sbi.ToString();

        }
Example #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[PageConstants.ssnUserAuthorization] != null)
            {
                objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
                Session["currentevent"] = "Tour Flash";

            }
            else
            {
                objAuthorizationBDto = new AuthorizationBDto();
            }

            if (!IsPostBack)
            {
                ControlBox1_ResetClick(ControlBox1, new EventArgs());
            }

            ControlBox1.CancelButton.Text = "Reset";
            //ControlBox1.AddAttributeToClearButton("onClick", "javascript:return ControlBox1_ClearClientClick()");
        }
		protected void Page_PreRender(object sender, EventArgs e)
		{
			objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
			if (objAuthorizationBDto != null)
			{
				if (!objAuthorizationBDto.ProgramWriteAccess)
				{

				}
			}

			if (!IsPostBack)
			{
				objBindCombo = new BindCombo();
				DataSet dsCountry = objBindCombo.GetCountryKeyValue();
				DataSet dsregion = objBindCombo.GetRegionKeyValue();
			BindRegionCombo(radAirline, dsregion);
			bindCountryCombo(radCmbDestination, dsCountry);

			}
		}
 protected void Page_Load(object sender, EventArgs e)
 {
     WebHelper.WebManager.CheckSessionIsActive();
     objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
     if (objAuthorizationBDto != null)
     {
         _empID = Convert.ToInt32(Session["empid"]);
     }
     String query = "SELECT SUPPLIER_CONTACT_DETAILS.CHAIN_NAME , HOTEL_DASHBOARD_MASTER.DESCRIPTION FROM HOTEL_DASHBOARD_MASTER LEFT OUTER JOIN SUPPLIER_CONTACT_DETAILS ON SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO  = HOTEL_DASHBOARD_MASTER.HOTEL_PRICE_LIST_ID WHERE HOTEL_DASHBOARD_MASTER.CITY_ID='571' AND IS_DASHBOARD='YES'";
     DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
     StringBuilder _sbi = new StringBuilder();
     _sbi.AppendLine("<ul>");
     foreach (DataRow dr in dt.Rows)
     {
         _sbi.AppendLine("<li style=\"list-style-type:square;font-size:12px;padding:3px;\">" + dr["CHAIN_NAME"].ToString() 
         + "</br><div align=\"left\" style=\"font-size:11px;color:red;\"><b>Description : " + dr["DESCRIPTION"].ToString());
     }
     _sbi.AppendLine("</ul>");
     //  _sbi.AppendLine("<a href=\"../../Views/Sales/Tour.aspx\">View All</a>");
     divanc.InnerHtml = _sbi.ToString();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     WebHelper.WebManager.CheckSessionIsActive();
     objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
     if (objAuthorizationBDto != null)
     {
         _empID = Convert.ToInt32(Session["empid"]);
     }
     //String query = "SELECT PURCHASE_PAYMENT_VOUCHER_DETAILS.GL_CODE,SUM(CR_AMOUNT) AS TOTAL_PAYMENT_MADE FROM PURCHASE_PAYMENT_VOUCHER_DETAILS WHERE CONVERT (VARCHAR(10), PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE,103)=CONVERT(VARCHAR(10),GETDATE(),103) GROUP BY GL_CODE";
     String query = "SELECT PURCHASE_PAYMENT_VOUCHER_DETAILS.GL_CODE,CR_AMOUNT AS TOTAL_PAYMENT_MADE FROM PURCHASE_PAYMENT_VOUCHER_DETAILS WHERE PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE BETWEEN GETDATE() AND GETDATE()+7 ";
     DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
     StringBuilder _sbi = new StringBuilder();
     _sbi.AppendLine("<ul>");
     foreach (DataRow dr in dt.Rows)
     {
         _sbi.AppendLine("<li style=\"list-style-type:square;font-size:12px;padding:3px;\">" + dr["GL_CODE"].ToString()+" " + dr["TOTAL_PAYMENT_MADE"].ToString() + " " + "THB");
     }
     _sbi.AppendLine("</ul>");
     _sbi.AppendLine("<a href=\"../../Views/Account/Payment.aspx\">View All</a>");
     divanc.InnerHtml = _sbi.ToString();
     
 }
Example #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString != null && Request.QueryString.Count > 0)
         {
             switch (Request.QueryString["Action"].ToLower())
             {
                 case "addnewuser":
                     acbUser_NewClick(new object(), new EventArgs());
                     break;
             }
         }
         BindGrid();
     }
     if (Session[PageConstants.ssnUserAuthorization] != null)
     {
         objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
         Session["currentevent"] = "Manage User";
     }
     hdnEditableMode.Value = "false";
     acbUser.AddAttributeToEditButton("onClick", String.Format("javascript:return ValidateEdit('{0}')", radgrdUser.ClientID));
     acbUser.AddAttributeToDeleteButton("onClick", String.Format("javascript:return ValidateDelete('{0}')", radgrdUser.ClientID));
 }
Example #24
0
 public static void CheckUserAuthorizationForProgram(string ProgramName)
 {
     DataTable dtAccess = new DataTable();
     DataSet dsAccess = new DataSet();
     AuthorizationBDto objAuthorizationBDto;
     AuthorizationDal objAuthorizationDal;
     if (HttpContext.Current.Session[PageConstants.ssnUserAuthorization] != null)
     {
         objAuthorizationBDto = (AuthorizationBDto)HttpContext.Current.Session[PageConstants.ssnUserAuthorization];
         int RoleId = objAuthorizationBDto.UserSelectedRoleId;
         if (RoleId != 0)
         {
             objAuthorizationDal = new AuthorizationDal();
             dsAccess = objAuthorizationDal.GetProgrameAccessByProgramName(RoleId, ProgramName);
             dtAccess = dsAccess.Tables[0];
             if (dtAccess.Rows.Count > 0)
             {
                 if (dtAccess.Rows[0]["READ_ACCESS"] != null)
                 {
                     if (dtAccess.Rows[0]["READ_ACCESS"].ToString() != "True")
                     {
                         int ModuleId = int.Parse(dtAccess.Rows[0]["MODULE_ID"].ToString());
                         switch (ModuleId)
                         {
                             case 1: // Administration
                                 HttpContext.Current.Response.Redirect("~/Views/Administration/AccessDenied.aspx");
                                 break;
                             case 2: // Customers
                                 HttpContext.Current.Response.Redirect("~/Views/Customers/AccessDenied.aspx");
                                 break;
                             case 3: // Inquiry
                                 HttpContext.Current.Response.Redirect("~/Views/Inquiry/AccessDenied.aspx");
                                 break;
                             case 4: // Orders
                                 HttpContext.Current.Response.Redirect("~/Views/Orders/AccessDenied.aspx");
                                 break;
                             case 5: // Fares
                                 HttpContext.Current.Response.Redirect("~/Views/Fares/AccessDenied.aspx");
                                 break;
                             case 6: // HR
                                 HttpContext.Current.Response.Redirect("~/Views/HR/AccessDenied.aspx");
                                 break;
                             default:
                                 break;
                         }
                     }
                 }
                 else
                 {
                     HttpContext.Current.Response.Redirect("~/Default.aspx");
                 }
                 objAuthorizationBDto = new AuthorizationBDto();
                 objAuthorizationBDto = (AuthorizationBDto)HttpContext.Current.Session[PageConstants.ssnUserAuthorization];
                 if (dtAccess.Rows[0]["READ_ACCESS"] != null)
                     objAuthorizationBDto.ProgramReadAccess = bool.Parse(dtAccess.Rows[0]["READ_ACCESS"].ToString());
                 if (dtAccess.Rows[0]["WRITE_ACCESS"] != null)
                     objAuthorizationBDto.ProgramWriteAccess = bool.Parse(dtAccess.Rows[0]["WRITE_ACCESS"].ToString());
                 if (dtAccess.Rows[0]["DELETE_ACCESS"] != null)
                     objAuthorizationBDto.ProgramDeleteAccess = bool.Parse(dtAccess.Rows[0]["DELETE_ACCESS"].ToString());
                 if (dtAccess.Rows[0]["PRINT_ACCESS"] != null)
                     objAuthorizationBDto.ProgramPrintAccess = bool.Parse(dtAccess.Rows[0]["PRINT_ACCESS"].ToString());
                 HttpContext.Current.Session[PageConstants.ssnUserAuthorization] = objAuthorizationBDto;
             }
             else
             {
                 HttpContext.Current.Response.Redirect("~/Default.aspx");
             }
         }
     }
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            WebHelper.WebManager.CheckSessionIsActive();
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            if (objAuthorizationBDto != null)
                _userID = objAuthorizationBDto.UserProfile.UserId;
            // Create new data series and set it's visual attributes
            Series series = new Series("Pie");
            series.ChartType = SeriesChartType.Pie;
            series.BorderWidth = 1;
            series.ShadowOffset = 2;

            //general setting
            // set query according to from and to date
            // set query according to from and to date
            DataSet _Ds = objdeshboardentity.getfilter(_userID);
            DataTable _DT = _Ds.Tables[0];
            DataTable _DT1 = _Ds.Tables[1];
            //GET FILTER DETAILS FROM HERE
            string query = string.Empty;
            StringBuilder _employee = new StringBuilder();
            if (_DT.Rows[0]["EMP_ID"].ToString() == null || _DT.Rows[0]["EMP_ID"].ToString() == "0" || _DT.Rows[0]["EMP_ID"].ToString() == "")
            {
                foreach (DataRow dr in _DT1.Rows)
                {
                    _employee.Append(dr["EMP_ID"].ToString() + ",");
                }
                _employee.Append("0");
            }
            else
            {
                foreach (DataRow dr in _DT1.Rows)
                {
                    if (dr["RESULT"].ToString() == _DT.Rows[0]["EMP_ID"].ToString())
                        _employee.Append(dr["EMP_ID"].ToString() + ",");
                }
                _employee.Append("0");

            }
            switch (_DT.Rows[0]["FILTER_ID"].ToString())
            {
                case "12":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where CONVERT(VARCHAR(10),IMH.INQUIRY_DATE, 101)=CONVERT(VARCHAR(10),GETDATE(), 101) AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "13":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where CONVERT(VARCHAR(10),IMH.INQUIRY_DATE, 101)=CONVERT(VARCHAR(10),GETDATE()-1, 101) AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "14":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where CONVERT(VARCHAR(10),imh.INQUIRY_DATE, 101) >= CONVERT(VARCHAR(10),GETDATE(), 101) AND CONVERT(VARCHAR(10),imh.INQUIRY_DATE, 101) <= CONVERT(VARCHAR(10),GETDATE()+7, 101)) AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "15":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where CONVERT(VARCHAR(10),imh.INQUIRY_DATE, 101) >= CONVERT(DATE,GETDATE()) AND CONVERT(VARCHAR(10),imh.INQUIRY_DATE, 101) <=CONVERT(VARCHAR(10),GETDATE()-7, 101)) AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "16":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where CONVERT(VARCHAR(10),imh.INQUIRY_DATE, 101) >= CONVERT(DATE,GETDATE()) AND CONVERT(VARCHAR(10),imh.INQUIRY_DATE, 101) <= CONVERT(VARCHAR(10),GETDATE()+14, 101)) AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "17":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where CONVERT(VARCHAR(10),imh.INQUIRY_DATE, 101) >= CONVERT(DATE,GETDATE()) AND CONVERT(VARCHAR(10),imh.INQUIRY_DATE, 101) <= CONVERT(VARCHAR(10),GETDATE()-14, 101)) AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "18":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where datepart(MONTH,imh.INQUIRY_DATE)= '" + System.DateTime.Now.AddMonths(1).Month + "'  AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "19":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where datepart(MONTH,imh.INQUIRY_DATE)= '" + System.DateTime.Now.AddMonths(-1).Month + "' AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "20":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where datepart(MONTH,imh.INQUIRY_DATE)= '" + System.DateTime.Now.Month + "' AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                case "21":
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where CONVERT(VARCHAR(10),IMH.INQUIRY_DATE, 101)=CONVERT(DATE,GETDATE()+1) AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
                default:
                    query = "select COUNT(*) TOTAL,(case IS_REVISED when 1 then 'Revised' else 'New' END) as IS_REVISED from dbo.INQ_INQUIRY_SUB_HEAD iish join INQ_INQUIRY_MAIN_HEAD IMH ON IISH.INQUIRY_ID=IMH.INQUIRY_ID where CONVERT(VARCHAR(10),IMH.INQUIRY_DATE, 101) >=CONVERT(VARCHAR(10),'" + _DT.Rows[0]["FROM_DATE"].ToString() + "', 101) and CONVERT(VARCHAR(10),IMH.INQUIRY_DATE, 101) <=CONVERT(VARCHAR(10),'" + _DT.Rows[0]["TO_DATE"].ToString() + "', 101) AND IMH.SALES_PERSON_ID IN (" + _employee.ToString() + ") group by IS_REVISED ORDER BY TOTAL DESC";
                    break;
            }
            //END QUERY
        // Add series into the chart's series collection
            try
            {
                DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
            
                Chart1.Series.Add(series);
                series.XValueMember = "IS_REVISED";
                series.YValueMembers = "TOTAL";
                series.IsValueShownAsLabel = true;
                Chart1.ChartAreas[0].AxisY.Maximum = int.Parse(dt.Rows[0]["TOTAL"].ToString());
                Chart1.DataSource = dt;
                Chart1.DataBind();
            }
            catch (Exception ex) { }
            //general setting over
        }
Example #26
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="roleId"></param>
        /// <param name="progId"></param>
        public void ShowPageAccess()
        {
            try
            {
                //bool readAccess = false;
                //bool writeAccess = false;
                //bool deleteAccess = false;
                //bool printAccess = false;
                //DataSet dsAccess = null;

                //AuthorizationDal objAuthorizationDal = new AuthorizationDal();

                //dsAccess = objAuthorizationDal.GetPageOperationAccess(userId, roleId, progId);
                //if (dsAccess != null && dsAccess.Tables.Count > 0)
                //{
                //    if (dsAccess.Tables[0] != null && dsAccess.Tables[0].Rows.Count > 0)
                //    {
                //        readAccess = Convert.ToBoolean(dsAccess.Tables[0].Rows[0]["READ_ACCESS"].ToString());
                //        writeAccess = Convert.ToBoolean(dsAccess.Tables[0].Rows[0]["WRITE_ACCESS"].ToString());
                //        deleteAccess = Convert.ToBoolean(dsAccess.Tables[0].Rows[0]["DELETE_ACCESS"].ToString());
                //        printAccess = Convert.ToBoolean(dsAccess.Tables[0].Rows[0]["PRINT_ACCESS"].ToString());
                //    }
                //}
                //btnSearch.Enabled = readAccess;
                //btnNew.Enabled = writeAccess;
                //btnEdit.Enabled = writeAccess;
                //btnDelete.Enabled = deleteAccess;
                //btnExport.Enabled = printAccess;

                objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
                if (objAuthorizationBDto != null)
                {
                    if (!objAuthorizationBDto.ProgramWriteAccess)
                    {
                        btnNew.Enabled = false;
                        btnSave.Enabled = false;
                        btnSaveNew.Enabled = false;
                    }
                    if (!objAuthorizationBDto.ProgramDeleteAccess)
                        btnDelete.Enabled = false;
                    if (!objAuthorizationBDto.ProgramPrintAccess)
                        btnExport.Enabled = false;
                }


            }
            catch (Exception) { }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WebHelper.WebManager.CheckSessionIsActive();
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            if (objAuthorizationBDto != null)
                _userID = objAuthorizationBDto.UserProfile.UserId;

            Series series = new Series("Spline");
            series.ChartType = SeriesChartType.Column;
            series.BorderWidth = 3;
            series.ShadowOffset = 2;

             //general setting
            // set query according to from and to date
            // set query according to from and to date
            DataSet _Ds = objdeshboardentity.getfilter(_userID);
            DataTable _DT = _Ds.Tables[0];
            DataTable _DT1 = _Ds.Tables[1];
            //GET FILTER DETAILS FROM HERE
            string query = string.Empty;
            StringBuilder _employee = new StringBuilder();
            if (_DT.Rows[0]["EMP_ID"].ToString() == null || _DT.Rows[0]["EMP_ID"].ToString() == "0" || _DT.Rows[0]["EMP_ID"].ToString() == "")
            {
                foreach (DataRow dr in _DT1.Rows)
                {
                    _employee.Append(dr["EMP_ID"].ToString() + ",");
                }
                _employee.Append("0");
            }
            else
            {
                foreach (DataRow dr in _DT1.Rows)
                {
                    if (dr["RESULT"].ToString() == _DT.Rows[0]["EMP_ID"].ToString())
                        _employee.Append(dr["EMP_ID"].ToString() + ",");
                }
                _employee.Append("0");

            }

            switch (_DT.Rows[0]["FILTER_ID"].ToString())
            {
                case "12":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,CONVERT(VARCHAR(10),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  CONVERT(VARCHAR(15),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) =CONVERT(VARCHAR(15),GETDATE(), 103) AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE";
                    break;
                case "13":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,CONVERT(VARCHAR(10),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  CONVERT(VARCHAR(15),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) =CONVERT(VARCHAR(15),GETDATE()-1, 103) AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE";
                    break;
                case "14":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,CONVERT(VARCHAR(10),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  CONVERT(VARCHAR(5),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,101) >= CONVERT(VARCHAR(5),getdate(), 101) AND CONVERT(VARCHAR(5),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE, 101) <= CONVERT(VARCHAR(5),GETDATE()+7, 101) AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE";
                    break;
                case "15":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,CONVERT(VARCHAR(10),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  CONVERT(VARCHAR(5),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,101) <= CONVERT(VARCHAR(5),getdate(), 101) AND CONVERT(VARCHAR(5),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE, 101) >= CONVERT(VARCHAR(5),GETDATE()-7, 101) AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE";
                    break;
                case "16":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,CONVERT(VARCHAR(10),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  CONVERT(VARCHAR(5),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,101) >= CONVERT(VARCHAR(5),getdate(), 101) AND CONVERT(VARCHAR(5),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE, 101) <= CONVERT(VARCHAR(5),GETDATE()+14, 101) AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE";
                    break;
                case "17":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,CONVERT(VARCHAR(10),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  CONVERT(VARCHAR(5),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,101) <= CONVERT(VARCHAR(5),getdate(), 101) AND CONVERT(VARCHAR(5),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE, 101) >= CONVERT(VARCHAR(5),GETDATE()-14, 101) AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE";
                    break;
                case "18":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,datename(month,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE ) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  datepart(MONTH,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE)= '" + System.DateTime.Now.AddMonths(1).Month + "'  AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY datename(month,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE ) ORDER BY EXPENSE_DATE";

                    break;
                case "19":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,datename(month,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE ) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  datepart(MONTH,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE)= '" + System.DateTime.Now.AddMonths(-1).Month + "' AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY datename(month,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE ) ORDER BY EXPENSE_DATE";
                    break;
                case "20":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,datename(month,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE ) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  datepart(MONTH,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE)= '" + System.DateTime.Now.Month + "' AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY datename(month,SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE ) ORDER BY EXPENSE_DATE ";
                    break;
                case "21":
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT,CONVERT(VARCHAR(10),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS WHERE  CONVERT(VARCHAR(15),SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE,103) =CONVERT(VARCHAR(15),GETDATE()+1, 103) AND SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT <>0 GROUP BY SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE";
                    break;
                default:
                    query = "SELECT SUM (SALES_RECEIPT_VOUCHER_DETAILS.DR_AMOUNT) AS TOTAL_EXPENCE_AMOUNT , CONVERT (VARCHAR(15), YEAR ( SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE)) AS EXPENSE_DATE FROM SALES_RECEIPT_VOUCHER_DETAILS GROUP BY CONVERT (VARCHAR(15), YEAR ( SALES_RECEIPT_VOUCHER_DETAILS.POSTED_DATE)) ORDER BY EXPENSE_DATE";
                    break;
            }
            //END QUERY
            //END QUERY
            DataTable _dttemp = new DataTable();
            DataTable dt = new DataTable();
            try
            {
                dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];

                _dttemp.Columns.Add("CUSTOMER_TYPE", typeof(string));
                _dttemp.Columns.Add("TOTAL", typeof(int));
                _dttemp.Rows.Add(_dttemp.NewRow());
                _dttemp.Rows.Add(_dttemp.NewRow());
                _dttemp.Rows[0]["TOTAL"] = 0;
                _dttemp.Rows[1]["TOTAL"] = 0;
                // Add series into the chart's series collection
                foreach (DataRow dr in _dttemp.Rows)
                {
                    try
                    {
                        if (dr["TOTAL"].ToString() == "1")
                        {
                            _dttemp.Rows[0]["CUSTOMER_TYPE"] = "New";
                            _dttemp.Rows[0]["TOTAL"] = int.Parse(_dttemp.Rows[0]["TOTAL"].ToString()) + int.Parse(dr["TOTAL"].ToString());
                        }
                        else
                        {
                            _dttemp.Rows[1]["CUSTOMER_TYPE"] = "Old";
                            _dttemp.Rows[1]["TOTAL"] = int.Parse(_dttemp.Rows[0]["TOTAL"].ToString()) + int.Parse(dr["TOTAL"].ToString());

                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            catch (Exception ex) { throw ex; }
            try
            {
                DataTable dt1 = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
                //SqlConnection con = new SqlConnection(str);
                //con.Open();

                //SqlCommand cmd = new SqlCommand("GEDJET_EXPENCE_COMPANRASION", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //SqlDataReader rdr = cmd.ExecuteReader();
                //DataTable dt1 = new DataTable();
                //dt.Load(rdr);

                Chart1.Series.Add(series);
                series.XValueMember = "EXPENSE_DATE";
                series.YValueMembers = "TOTAL_EXPENCE_AMOUNT";
                series.IsValueShownAsLabel = true;
                //    Chart1.ChartAreas[0].AxisY.Maximum = int.Parse(dt.Rows[0]["TOTAL_RECEIPT_AMOUNT"].ToString());


                Chart1.DataSource = dt1;
                Chart1.DataBind();
            }
            catch
            {
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            WebHelper.WebManager.CheckSessionIsActive();
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            if (objAuthorizationBDto != null)
                _userID = objAuthorizationBDto.UserProfile.UserId;
            // Create new data series and set it's visual attributes
            Series series = new Series("FastLine");
            series.ChartType = SeriesChartType.Line;
            //general setting
            // set query according to from and to date
            // set query according to from and to date
            DataSet _Ds = objdeshboardentity.getfilter(_userID);
            DataTable _DT = _Ds.Tables[0];
            DataTable _DT1 = _Ds.Tables[1];
            //GET FILTER DETAILS FROM HERE
            string query = string.Empty;
            StringBuilder _employee = new StringBuilder();
            if (_DT.Rows[0]["EMP_ID"].ToString() == null || _DT.Rows[0]["EMP_ID"].ToString() == "0" || _DT.Rows[0]["EMP_ID"].ToString() == "")
            {
                foreach (DataRow dr in _DT1.Rows)
                {
                    _employee.Append(dr["EMP_ID"].ToString() + ",");
                }
                _employee.Append("0");
            }
            else
            {
                foreach (DataRow dr in _DT1.Rows)
                {
                    if (dr["RESULT"].ToString() == _DT.Rows[0]["EMP_ID"].ToString())
                        _employee.Append(dr["EMP_ID"].ToString() + ",");
                }
                _employee.Append("0");

            }
            switch (_DT.Rows[0]["FILTER_ID"].ToString())
            {
                case "12":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH=CONVERT(varchar(6),CAST(GETDATE() AS DATETIME),112) AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "13":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH=CONVERT(varchar(6),CAST(GETDATE()-1 AS DATETIME),112) AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "14":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH >= CONVERT(varchar(6),CAST(GETDATE() AS DATETIME),112) AND PLAN_YEAR_MONTH <= CONVERT(varchar(6),GETDATE()+7 AS DATETIME),112)) AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "15":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH >= CONVERT(varchar(6),CAST(GETDATE() AS DATETIME),112) AND PLAN_YEAR_MONTH <=CONVERT(varchar(6),GETDATE()-7 AS DATETIME),112)) AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "16":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH >= CONVERT(varchar(6),CAST(GETDATE() AS DATETIME),112) AND PLAN_YEAR_MONTH <= CONVERT(varchar(6),GETDATE()+14 AS DATETIME),112)) AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "17":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH >= CONVERT(varchar(6),CAST(GETDATE() AS DATETIME),112) AND PLAN_YEAR_MONTH <= CONVERT(varchar(6),GETDATE()+14 AS DATETIME),112)) AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "18":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH= '" + System.DateTime.Now.Year + System.DateTime.Now.AddMonths(1).Month + "'  AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "19":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH= '" + System.DateTime.Now.Year + System.DateTime.Now.AddMonths(-1).Month + "' AND CREATED_BY IN (" + _employee.ToString() + ") group by  PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "20":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH= '" + System.DateTime.Now.Year + System.DateTime.Now.Month + "' AND CREATED_BY IN (" + _employee.ToString() + ") group by  PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                case "21":
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH=CONVERT(varchar(6),CAST(GETDATE()+1 AS DATETIME),112) AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
                default:
                    query = "select COUNT(*) TOTAL,PLAN_YEAR_MONTH as DATE from dbo.CUST_NEXT_TRAVEL_PLAN where PLAN_YEAR_MONTH >=CONVERT(varchar(6),CAST('" + _DT.Rows[0]["FROM_DATE"].ToString() + "' AS DATETIME),112) and PLAN_YEAR_MONTH <=CONVERT(varchar(6),CAST('" + _DT.Rows[0]["TO_DATE"].ToString() + "' AS DATETIME),112) AND CREATED_BY IN (" + _employee.ToString() + ") group by PLAN_YEAR_MONTH ORDER BY TOTAL DESC";
                    break;
            }
            //END QUERY
            // Add series into the chart's series collection
            Chart1.Series.Add(series);
            try
            {
                DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
           
                series.XValueMember = "DATE";
                series.YValueMembers = "TOTAL";
                series.IsValueShownAsLabel = true;
                Chart1.ChartAreas[0].AxisY.Maximum = int.Parse(dt.Rows[0]["TOTAL"].ToString());
                Chart1.DataSource = dt;
                Chart1.DataBind();
            }
            catch (Exception ex) { }
            //general setting over
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WebHelper.WebManager.CheckSessionIsActive();
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            if (objAuthorizationBDto != null)
            {
                _userID = objAuthorizationBDto.UserProfile.UserId;
                _empID = Convert.ToInt32(Session["empid"]);
            }
            DataSet _Ds = objdeshboardentity.getfilter(_userID);
            DataTable _DT = _Ds.Tables[0];
            DataTable _DT1 = _Ds.Tables[1];

            string query = string.Empty;


            switch (_DT.Rows[0]["FILTER_ID"].ToString())
            {
                case "12":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,103)  = CONVERT(VARCHAR(15),getdate(), 103) AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                case "13":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,103)  = CONVERT(VARCHAR(15),getdate()-1, 103) AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                case "14":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,101)  >= CONVERT(VARCHAR(15),getdate(), 101) AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,101)  <= CONVERT(VARCHAR(15),getdate()+7, 101) AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                case "15":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,101)  <= CONVERT(VARCHAR(15),getdate(), 101) AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,101)  >= CONVERT(VARCHAR(15),getdate()-7, 101) AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                case "16":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,101)  >= CONVERT(VARCHAR(15),getdate(), 101) AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,101)  <= CONVERT(VARCHAR(15),getdate()+14, 101) AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                case "17":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,101)  <= CONVERT(VARCHAR(15),getdate(), 101) AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,101)  >= CONVERT(VARCHAR(15),getdate()-14, 101) AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                case "18":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND datepart(MONTH, HOTEL_CART_DETAIL.CREATED_DATE)  ='" + System.DateTime.Now.AddMonths(1).Month + "' AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";

                    break;
                case "19":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND datepart(MONTH, HOTEL_CART_DETAIL.CREATED_DATE)  ='" + System.DateTime.Now.AddMonths(-1).Month + "' AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                case "20":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND datepart(MONTH, HOTEL_CART_DETAIL.CREATED_DATE)  ='" + System.DateTime.Now.Month + "' AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                case "21":
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "' AND CONVERT(VARCHAR(15), HOTEL_CART_DETAIL.CREATED_DATE,103)  = CONVERT(VARCHAR(15),getdate()+1, 103) AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True' GROUP BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
                default:
                    query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL  AND HOTEL_CART_DETAIL.CREATED_BY = '" + _userID + "'  AND HOTEL_CART_DETAIL.PACKAGE_FLAG='True'  ORDER BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
                    break;
            }

        //    String query = "SELECT DISTINCT TOP 5 dbo.SUPPLIER_CONTACT_DETAILS.CHAIN_NAME FROM dbo.HOTEL_CART_DETAIL LEFT OUTER JOIN dbo.SUPPLIER_HOTEL_PRICE_LIST ON dbo.HOTEL_CART_DETAIL.SUPPLIER_HOTEL_PRICE_LIST_ID = dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_HOTEL_PRICE_LIST_ID LEFT OUTER JOIN dbo.SUPPLIER_CONTACT_DETAILS ON dbo.SUPPLIER_HOTEL_PRICE_LIST.SUPPLIER_SR_NO = dbo.SUPPLIER_CONTACT_DETAILS.SUPPLIER_SR_NO WHERE SUPPLIER_CONTACT_DETAILS.CHAIN_NAME IS NOT NULL ORDER BY SUPPLIER_CONTACT_DETAILS.CHAIN_NAME";
            DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
            StringBuilder _sbi = new StringBuilder();
            _sbi.AppendLine("<ul>");
            foreach (DataRow dr in dt.Rows)
            {
                _sbi.AppendLine("<li style=\"list-style-type:square;font-size:12px;padding:3px;\">" + dr["CHAIN_NAME"].ToString());
            }
            _sbi.AppendLine("</ul>");
          //  _sbi.AppendLine("<a href=\"../../Views/Sales/Tour.aspx\">View All</a>");
            divanc.InnerHtml = _sbi.ToString();
        }
Example #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebHelper.WebManager.CheckSessionIsActive();
            objAuthorizationBDto = (AuthorizationBDto)Session[PageConstants.ssnUserAuthorization];
            if (objAuthorizationBDto != null)
                _userID = objAuthorizationBDto.UserProfile.UserId;
            // Create new data series and set it's visual attributes
            //Series series = new Series("Spline");
            //series.ChartType = SeriesChartType.Column;
            //series.BorderWidth = 3;
            //series.ShadowOffset = 2;

            //general setting
            // set query according to from and to date
            DataSet _Ds = objdeshboardentity.getfilter(_userID);
            DataTable _DT = _Ds.Tables[0];
            DataTable _DT1 = _Ds.Tables[1];
            //GET FILTER DETAILS FROM HERE
            string query = string.Empty;
            StringBuilder _employee = new StringBuilder();
            if (_DT.Rows[0]["EMP_ID"].ToString() == null || _DT.Rows[0]["EMP_ID"].ToString() == "0" || _DT.Rows[0]["EMP_ID"].ToString() == "")
            {
                foreach (DataRow dr in _DT1.Rows)
                {
                    _employee.Append(dr["EMP_ID"].ToString() + ",");
                }
                _employee.Append("0");
            }
            else
            {
                foreach (DataRow dr in _DT1.Rows)
                {
                    if (dr["RESULT"].ToString() == _DT.Rows[0]["EMP_ID"].ToString())
                        _employee.Append(dr["EMP_ID"].ToString() + ",");
                }
                _employee.Append("0");

            }
            switch (_DT.Rows[0]["FILTER_ID"].ToString())
            {
                case "12":
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) = CONVERT(VARCHAR(5),getdate(), 101)";
                    break;
                case "13":
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) = CONVERT(VARCHAR(5),dateadd(DAY,-1,getdate()), 101) ";
                    break;
                case "14":
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) >= CONVERT(VARCHAR(5),getdate()+ 7, 101)";
                    break;
                case "15":
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) <= CONVERT(VARCHAR(5),getdate()-7, 101)";
                    break;
                case "16":
                    query= "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) >= CONVERT(VARCHAR(5),getdate()+14, 101)";
                    break;
                case "17":
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) <= CONVERT(VARCHAR(5),getdate()-14, 101)";
                    break;
                case "18":
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) >= CONVERT(VARCHAR(5),DATEADD(MONTH,+1,GETDATE()),101)";
                    break;
                case "19":
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) <= CONVERT(VARCHAR(5),DATEADD(MONTH,-1,GETDATE()),101)";
                   
                    break;
                case "20":
                    //query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where datepart(month,PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE) = datepart(month,getdate())";  /*Running */
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),MONTH(PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE), 101) = CONVERT(VARCHAR(5),MONTH(getdate()), 101)";
                    break;
                case "21":
                    query = "SELECT SUM(CR_AMOUNT) AS TOTAL_PAYMENT_MADE,GL_CODE  FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) = CONVERT(VARCHAR(5),GETDATE()+1, 101) GROUP BY GL_CODE";
                    break;
                default:
                    query = "SELECT CR_AMOUNT AS TOTAL_PAYMENT_MADE,GL_CODE FROM PURCHASE_PAYMENT_VOUCHER_DETAILS where CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) >=CONVERT(VARCHAR(5),'" + _DT.Rows[0]["FROM_DATE"].ToString() + "', 101) and CONVERT(VARCHAR(5),PURCHASE_PAYMENT_VOUCHER_DETAILS.POSTED_DATE, 101) <=CONVERT(VARCHAR(5),'" + _DT.Rows[0]["TO_DATE"].ToString() + "', 101)";
                    break;
            }
            try
            {
                DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];
                StringBuilder _sbi = new StringBuilder();
                _sbi.AppendLine("<ul>");
                foreach (DataRow dr in dt.Rows)
                {
                    _sbi.AppendLine("<li style=\"list-style-type:square;font-size:12px;padding:3px;\">" + dr["GL_CODE"].ToString() + " " + dr["TOTAL_PAYMENT_MADE"].ToString() + " " + "THB");
                }
                _sbi.AppendLine("</ul>");
                _sbi.AppendLine("<a href=\"../../Views/Account/Payment.aspx\">View All</a>");
                divanc.InnerHtml = _sbi.ToString();
            }
            catch (Exception ex)
            { }
            //END QUERY
            // Add series into the chart's series collection
            //Chart1.Series.Add(series);
            //try
            //{
            //    DataTable dt = objdeshboardentity.ExecuteQuery(query.ToString().Trim()).Tables[0];

            //    Chart1.Series.Add(series);
            //    series.XValueMember = "DATE";
            //    series.YValueMembers = "TOTAL";
            //    series.IsValueShownAsLabel = true;
            //    Chart1.ChartAreas[0].AxisY.Maximum = int.Parse(dt.Rows[0]["TOTAL"].ToString());
            //    Chart1.DataSource = dt;
            //    Chart1.DataBind();
            //}
            //catch (Exception ex) { }
            //general setting over
        }