protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource

                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/ManageScheduleScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);

                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);
                if (siteID == 0)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
                }

                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                ValidateUserPrivileges(userID, siteID, accessLevelID);

                string basePath        = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string imagePath       = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images";
                string userControlPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/');
                UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(userControlPath + "/DynamicGridControl.ascx");
                divDynamicGridContent.Controls.Add(dynamicGridControl);

                int           featureID   = 0;
                List <string> featureName = new List <string>();
                featureName.Add(Language_Resources.MaintenanceFeatures.ManageSchedule);

                List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName);
                if (featurePageToLoad.Count > 0)
                {
                    ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == featureName[0]);
                    if (result != null)
                    {
                        featureID = result.FeatureID;
                    }
                }

                string webServicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim();

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex     = 0;
                pagerData.PageSize      = Convert.ToInt32(hdnPageSize.Value);
                pagerData.CurrentPage   = 0;
                pagerData.SelectMethod  = "LoadDynamicGridContent";
                pagerData.ServicePath   = webServicePath;
                pagerData.SiteID        = siteID;
                pagerData.UserID        = userID;
                pagerData.AccessLevelID = accessLevelID;

                UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties();
                dynamicGridProperties.FeatureID       = featureID;
                dynamicGridProperties.GridType        = UserControls.DynamicGridType.Table;
                dynamicGridProperties.PagerData       = pagerData;
                dynamicGridProperties.TableHeaderText = Language_Resources.ManageSchedule_Resource.listOfSchedules;
                dynamicGridProperties.WebServiceName  = "Vegam_MaintenanceService.asmx";
                dynamicGridProperties.ExcelSheetName  = "MaintenanceSchedule";

                //using pager for displaying work order details
                UserControls.PagerData workOrderPagerData = new UserControls.PagerData();
                workOrderPagerData.PageIndex     = 0;
                workOrderPagerData.PageSize      = int.Parse(hdnWorkOrderPageSize.Value.ToString());
                workOrderPagerData.SelectMethod  = "LoadScheduleWorkOrderDetails";
                workOrderPagerData.ServicePath   = webServicePath;
                workOrderPagerData.SiteID        = siteID;
                workOrderPagerData.UserID        = userID;
                workOrderPagerData.AccessLevelID = accessLevelID;
                workOrderPagerData.LoadControlID = tBodyWorkOrderDetails.ClientID;

                string newScheduleHTML      = "<input id='btnNewSchedule' type='button'class='btn btn-sm btn-success pull-xs-right pover' data-placement='top' disabled='disabled' data-content='" + Language_Resources.ManageSchedule_Resource.addMaintSchedule + "' value='" + Language_Resources.ManageSchedule_Resource.addMaintSchedule + "'/>";
                string editScheduleHTML     = "<i class='fa fa-edit linkcolor big tiny-leftmargin tiny-rightmargin v-icon  cursor-pointer icon-muted'></i>";
                string deleteScheduleHTML   = "<i class='fa fa-trash-o red big tiny-leftmargin tiny-rightmargin v-icon  cursor-pointer icon-muted '></i>";
                string activateScheduleHTML = string.Empty;

                //if (_manageScheduleAccess.ToLower() != "read_only")
                //{
                editScheduleHTML = "<i class='fa fa-edit linkcolor big tiny-leftmargin tiny-rightmargin v-icon  cursor-pointer' title='Edit' onclick='javascript:EditScheduleInfo(this);'></i>";
                if (_manageScheduleAccess.ToLower() == "full_access")
                {
                    newScheduleHTML    = "<input id='btnNewSchedule' type='button'class='btn btn-sm btn-success pull-xs-right pover' data-placement='top' data-content='" + Language_Resources.ManageSchedule_Resource.addMaintSchedule + "' value='" + Language_Resources.ManageSchedule_Resource.addMaintSchedule + "' onclick='javascript:AddNewSchedule();'/>";
                    deleteScheduleHTML = "<i class='fa fa-trash-o red big tiny-leftmargin tiny-rightmargin v-icon  cursor-pointer' title='Delete' onclick='javascript:DeleteScheduleInfoConfirm(this);'></i>";
                    //activateScheduleHTML = "<li><label onclick='javascript:ActivateScheduleInfoConfirm(this);' class='font-small push-down full-width cursor-pointer'><span><i class='fa myicon text-danger big tiny-leftmargin tiny-rightmargin v-icon'></i><span name='activate'>ActivateButtonValue</span></span></label></li>";
                }
                //}

                Page.ClientScript.RegisterStartupScript(GetType(), "LoadManageScheduleInfo", "LoadManageScheduleInfo(" + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + _manageScheduleAccess + "',\"" + newScheduleHTML + "\",\"" + editScheduleHTML + "\",\"" + deleteScheduleHTML + "\",\"" + activateScheduleHTML + "\",'" + basePath + "','" + imagePath + "'," + (new JavaScriptSerializer()).Serialize(workOrderPagerData) + ")", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script_Resource_Refernce
                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/EquipmentModelScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);
                #endregion

                userID        = this.CurrentUser.UserID;
                siteID        = this.CurrentUser.SiteID;
                accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID);

                Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam();
                basicParam.SiteID = siteID;
                basicParam.UserID = userID;

                string usercontrolPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/');
                string webServicePath  = ConfigurationManager.AppSettings["MaintWebServicePath"].ToString().TrimEnd('/');
                string basePath        = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');


                SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);

                UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(usercontrolPath + "/DynamicGridControl.ascx");
                divDynamicGridContent.Controls.Add(dynamicGridControl);

                #region Feature Equipment Model

                List <string> featureName = new List <string>();
                featureName.Add(Language_Resources.MaintenanceFeatures.equipmentModels);

                int featureID = 0;
                List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName);
                if (featurePageToLoad.Count > 0)
                {
                    ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == Language_Resources.MaintenanceFeatures.equipmentModels);
                    if (result != null)
                    {
                        featureID = result.FeatureID;
                    }
                }
                #endregion

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex        = 0;
                pagerData.PageSize         = int.Parse(hdnPageSize.Value.ToString());
                pagerData.CurrentPage      = currentPage;
                pagerData.ServicePath      = webServicePath;
                pagerData.SelectMethod     = "LoadDynamicGridContent";
                pagerData.LoadControlID    = uploadFile.ClientID;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.AccessLevelID    = accessLevelID;
                pagerData.PlantDateFormat  = dateTimeForamt.DateFormat;
                pagerData.PlantTimeFormat  = dateTimeForamt.TimeFormat;
                pagerData.PageAccessRights = accessType.ToString();

                UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties();
                dynamicGridProperties.GridType         = UserControls.DynamicGridType.Table;
                dynamicGridProperties.FeatureID        = featureID;
                dynamicGridProperties.DatePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat);
                dynamicGridProperties.TableHeaderText  = Language_Resources.EquipmentModel_Resource.listOfEquipmentModel;
                dynamicGridProperties.ImagePath        = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images";
                dynamicGridProperties.PagerData        = pagerData;
                dynamicGridProperties.WebServiceName   = "Vegam_MaintenanceService.asmx";
                dynamicGridProperties.ExcelSheetName   = "EquipmentModelList";

                if (accessType == AccessType.FULL_ACCESS)
                {
                    uploadFile.Attributes.Add("onchange", "javascript:UploadMeasuringPointInfo(); return false;");
                    btnAddNewEquipmentModel.Attributes.Add("onclick", "javascript:AddNewEquipmentModel();return false;");
                }
                else
                {
                    btnUploadExcel.Attributes.Add("disabled", "disabled");
                    btnAddNewEquipmentModel.Attributes.Add("disabled", "disabled");
                }

                string equipmentModelImagePath = ConfigurationManager.AppSettings["EquipmentModelImagePath"].TrimEnd('/');
                Page.ClientScript.RegisterStartupScript(GetType(), "LoadEquipmentModelListPage", "LoadEquipmentModelListPage(" + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + basePath + "','" + equipmentModelImagePath + "')", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource

                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/WorkOrderOrderViewCalendarScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);
                if (siteID == 0)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
                }

                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                ValidateUserPrivileges(siteID, accessLevelID);

                string usercontrolPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/');
                UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(usercontrolPath + "/DynamicGridControl.ascx");
                divDynamicGridContent.Controls.Add(dynamicGridControl);

                #region Feature

                List <string> featureName = new List <string>();
                featureName.Add(Language_Resources.MaintenanceFeatures.workOrderOrderView);

                int featureID = 0;
                List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName);
                if (featurePageToLoad.Count > 0)
                {
                    ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == Language_Resources.MaintenanceFeatures.workOrderOrderView);
                    if (result != null)
                    {
                        featureID = result.FeatureID;
                    }
                }

                #endregion

                string maintBasePath = ConfigurationManager.AppSettings["MaintBasePath"].TrimEnd('/').ToString();

                SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);
                int currentDate = BLL.MaintenanceBLL.GetSiteCurrentDateTime(siteID).CurrentDate;

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex       = 1;
                pagerData.PageSize        = Convert.ToInt32(hdnPageSize.Value);
                pagerData.CurrentPage     = 0;
                pagerData.SelectMethod    = "LoadDynamicGridContent";
                pagerData.ServicePath     = ConfigurationManager.AppSettings["MaintWebServicePath"].TrimEnd('/');
                pagerData.SiteID          = siteID;
                pagerData.UserID          = userID;
                pagerData.AccessLevelID   = accessLevelID;
                pagerData.PlantDateFormat = dateTimeForamt.DateFormat;
                pagerData.PlantTimeFormat = dateTimeForamt.TimeFormat;

                UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties();
                dynamicGridProperties.CurrentDate            = currentDate;
                dynamicGridProperties.FeatureID              = featureID;
                dynamicGridProperties.GridType               = UserControls.DynamicGridType.Table;
                dynamicGridProperties.PagerData              = pagerData;
                dynamicGridProperties.DatePickerFormat       = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat);
                dynamicGridProperties.ImagePath              = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images";
                dynamicGridProperties.WebServiceName         = "Vegam_MaintenanceService.asmx";
                dynamicGridProperties.ShowGroupRowsByDefault = false;
                dynamicGridProperties.ExcelSheetName         = "OrderViewWorkOrders";

                Page.ClientScript.RegisterStartupScript(GetType(), "LoadOrderViewBasicInfo", "LoadOrderViewBasicInfo(" + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + maintBasePath + "');", true);
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource

                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/ManageWorkOrderScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/jQueryCalendarScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);

                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);
                if (siteID == 0)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
                }

                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                ValidateUserPrivileges(userID, siteID, accessLevelID);

                string basePath        = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string userControlPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/');

                SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);

                UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(userControlPath + "/DynamicGridControl.ascx");
                divDynamicGridContent.Controls.Add(dynamicGridControl);

                int           featureID   = 0;
                List <string> featureName = new List <string>();
                featureName.Add(Language_Resources.MaintenanceFeatures.ManageWorkOrder);

                List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName);
                if (featurePageToLoad.Count > 0)
                {
                    ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == featureName[0]);
                    if (result != null)
                    {
                        featureID = result.FeatureID;
                    }
                }

                Vegam_MaintenanceService.SiteDateTimeFormatInfo dateTimeFormat = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);
                string dateFormat = CommonBLL.GetDatePickerDateFormat(dateTimeFormat.DateFormat);

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex       = 0;
                pagerData.PageSize        = Convert.ToInt32(hdnPageSize.Value);
                pagerData.CurrentPage     = 0;
                pagerData.SelectMethod    = "LoadDynamicGridContent";
                pagerData.ServicePath     = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim();
                pagerData.SiteID          = siteID;
                pagerData.UserID          = userID;
                pagerData.PlantDateFormat = dateTimeForamt.DateFormat;
                pagerData.PlantTimeFormat = dateTimeForamt.TimeFormat;
                pagerData.AccessLevelID   = accessLevelID;

                string imagePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images";

                UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties();
                dynamicGridProperties.FeatureID        = featureID;
                dynamicGridProperties.DatePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat);
                dynamicGridProperties.GridType         = UserControls.DynamicGridType.Table;
                dynamicGridProperties.PagerData        = pagerData;
                dynamicGridProperties.TableHeaderText  = Language_Resources.ManageWorkOrder_Resource.listOfWorkOrders;
                dynamicGridProperties.WebServiceName   = "Vegam_MaintenanceService.asmx";
                dynamicGridProperties.ExcelSheetName   = "MaintenanceWorkOrder";
                dynamicGridProperties.ImagePath        = imagePath;

                string newWorkOrderHTML    = "<input id='btnNewWorkOrder' type='button'class='btn btn-sm btn-success pull-xs-right pover' data-placement='top' data-content='" + Language_Resources.ManageWorkOrder_Resource.addMaintWorkOrder + "' value='" + Language_Resources.ManageWorkOrder_Resource.addMaintWorkOrder + "' disabled='disabled'/>";
                string editWorkOrderHTML   = "<i class='fa fa-edit linkcolor big tiny-leftmargin tiny-rightmargin v-icon  cursor-pointer icon-muted'></i>";
                string deleteWorkOrderHTML = "<i class='fa fa-trash-o red big tiny-leftmargin tiny-rightmargin v-icon  cursor-pointer icon-muted '></i>";

                //if (_manageWorkOrderAccess.ToLower() != "read_only")
                //{
                editWorkOrderHTML = "<i class='fa fa-edit linkcolor big tiny-leftmargin tiny-rightmargin v-icon  cursor-pointer' onclick='javascript:EditWorkOrderInfo(this);' title='Edit'></i>";
                if (_manageWorkOrderAccess.ToLower() == "full_access")
                {
                    newWorkOrderHTML    = "<input id='btnNewWorkOrder' type='button'class='btn btn-sm btn-success pull-xs-right pover' data-placement='top' data-content='" + Language_Resources.ManageWorkOrder_Resource.addMaintWorkOrder + "' value='" + Language_Resources.ManageWorkOrder_Resource.addMaintWorkOrder + "' onclick='javascript:AddNewWorkOrder();'/>";
                    deleteWorkOrderHTML = "<i class='fa fa-trash-o red big tiny-leftmargin tiny-rightmargin v-icon  cursor-pointer' onclick='javascript:DeleteWorkOrderInfoConfirm(this);' title='Delete'></i>";
                }
                //}

                Page.ClientScript.RegisterStartupScript(GetType(), "LoadManageWorkOrderInfo", "LoadManageWorkOrderInfo(" + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + _manageWorkOrderAccess + "',\"" + newWorkOrderHTML + "\",\"" + editWorkOrderHTML + "\",\"" + deleteWorkOrderHTML + "\",'" + basePath + "','" + dateFormat + "')", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource

                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/ViewWorkOrderInfoScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/JQueryCalendarScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);
                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);
                if (siteID == 0)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
                }

                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                string workOrder = string.Empty;
                if (Request.QueryString["workorder"] != null && Request.QueryString["workorder"].Trim().Length > 0)
                {
                    workOrder = Request.QueryString["workorder"].Trim();
                }

                if (Request.QueryString["equipment"] != null && Request.QueryString["equipment"].Trim().Length > 0)
                {
                    equipmentID = Convert.ToInt32(Request.QueryString["equipment"].Trim());
                }

                string pType = string.Empty;
                if (Request.QueryString["ptype"] != null && Request.QueryString["ptype"].Trim().Length > 0)
                {
                    pType = Request.QueryString["ptype"].Trim();
                }


                AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID);

                string servicePath  = ConfigurationManager.AppSettings["MaintWebServicePath"].TrimEnd('/');
                string imagePath    = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images/";
                string basePath     = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string uploaderPath = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/');
                string maintScheduleAttachmentPath = ConfigurationManager.AppSettings["MaintScheduleAttachmentPath"].TrimEnd('/');


                Vegam_MaintenanceService.SiteDateTimeFormatInfo dateTimeFormat = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);
                hdfDatePickerFormat.Value = CommonBLL.GetDatePickerDateFormat(dateTimeFormat.DateFormat);

                Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam();
                basicParam.SiteID        = siteID;
                basicParam.UserID        = userID;
                basicParam.AccessLevelID = accessLevelID;
                basicParam.LanguageCode  = this.CurrentUser.LanguageCode;


                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex     = 0;
                pagerData.PageSize      = int.Parse(hdnEquipmentHistoryPageSize.Value.ToString());
                pagerData.SelectMethod  = "LoadEquipmentHistory";
                pagerData.ServicePath   = servicePath;
                pagerData.SiteID        = siteID;
                pagerData.UserID        = userID;
                pagerData.AccessLevelID = accessLevelID;

                string usercontrolPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/');
                UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(usercontrolPath + "/DynamicGridControl.ascx");
                divDynamicGridContent.Controls.Add(dynamicGridControl);


                #region Feature

                List <string> featureName = new List <string>();
                featureName.Add(Language_Resources.MaintenanceFeatures.viewMeasuringPointReadings);

                int featureID = 0;
                List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName);
                if (featurePageToLoad.Count > 0)
                {
                    ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == Language_Resources.MaintenanceFeatures.viewMeasuringPointReadings);
                    if (result != null)
                    {
                        featureID = result.FeatureID;
                    }
                }

                #endregion

                SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);
                int currentDate = BLL.MaintenanceBLL.GetSiteCurrentDateTime(siteID).CurrentDate;


                UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties();
                dynamicGridProperties.CurrentDate     = currentDate;
                dynamicGridProperties.TableHeaderText = Language_Resources.ViewWorkOrderResource.measuringPointList;
                //dynamicGridProperties.CustomRowNavigationMethod = "ViewWorkOrderInfo";
                dynamicGridProperties.FeatureID = featureID;
                dynamicGridProperties.GridType  = UserControls.DynamicGridType.Table;
                dynamicGridProperties.PagerData = pagerData;
                //dynamicGridProperties.ImagePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images";
                dynamicGridProperties.WebServiceName   = "Vegam_MaintenanceService.asmx";
                dynamicGridProperties.DatePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat);
                // dynamicGridProperties.ShowGroupRowsByDefault = false;
                dynamicGridProperties.ExcelSheetName = "MeasuringPointList";

                ScriptManager.RegisterStartupScript(this, this.GetType(), "LoadWorkOrderBasicInfo", "javascript:LoadWorkOrderBasicInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + "," + (new JavaScriptSerializer()).Serialize(pagerData) + "," + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + servicePath + "','" + workOrder + "','" + imagePath + "','" + basePath + "','" + uploaderPath + "','" + maintScheduleAttachmentPath + "','" + accessType.ToString() + "','" + hdfDatePickerFormat.Value + "'," + equipmentID + "," +
                                                    "'" + dateTimeFormat.DateFormat + "','" + dateTimeFormat.TimeFormat + "','" + pType + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script_Resource_Refernce
                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/NotificationScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);
                #endregion

                userID        = this.CurrentUser.UserID;
                siteID        = this.CurrentUser.SiteID;
                accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID);

                Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam();
                basicParam.SiteID = siteID;
                basicParam.UserID = userID;

                string usercontrolPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/');
                string webServicePath  = ConfigurationManager.AppSettings["MaintWebServicePath"].ToString().TrimEnd('/');
                string basePath        = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');


                SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);

                UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(usercontrolPath + "/DynamicGridControl.ascx");
                divDynamicGridContent.Controls.Add(dynamicGridControl);

                #region Feature Equipment Model

                List <string> featureName = new List <string>();
                featureName.Add(Language_Resources.MaintenanceFeatures.manageNotification);

                int featureID = 0;
                List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName);
                if (featurePageToLoad.Count > 0)
                {
                    ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == Language_Resources.MaintenanceFeatures.manageNotification);
                    if (result != null)
                    {
                        featureID = result.FeatureID;
                    }
                }
                #endregion

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex        = 0;
                pagerData.PageSize         = int.Parse(hdnPageSize.Value.ToString());
                pagerData.CurrentPage      = currentPage;
                pagerData.ServicePath      = webServicePath;
                pagerData.SelectMethod     = "LoadDynamicGridContent";
                pagerData.LoadControlID    = divDynamicGridContent.ClientID;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.AccessLevelID    = accessLevelID;
                pagerData.PlantDateFormat  = dateTimeForamt.DateFormat;
                pagerData.PlantTimeFormat  = dateTimeForamt.TimeFormat;
                pagerData.PageAccessRights = accessType.ToString();

                UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties();
                dynamicGridProperties.GridType         = UserControls.DynamicGridType.Table;
                dynamicGridProperties.FeatureID        = featureID;
                dynamicGridProperties.DatePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat);
                dynamicGridProperties.TableHeaderText  = Language_Resources.ManageNotification_Resource.listOfNotification;
                dynamicGridProperties.ImagePath        = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images";
                dynamicGridProperties.PagerData        = pagerData;
                dynamicGridProperties.WebServiceName   = "Vegam_MaintenanceService.asmx";
                dynamicGridProperties.ExcelSheetName   = "NotificationlList";

                string addNotificationHtml = string.Empty;
                if (accessType == AccessType.FULL_ACCESS)
                {
                    addNotificationHtml = "<input id='btnAddNewNotification' type='button' class='btn btn-sm btn-success pull-xs-right pover' data-placement='top' data-content='" + Language_Resources.ManageNotification_Resource.addEditNotificationInfo + "' value='" + Language_Resources.ManageNotification_Resource.addEditNotificationInfo + "' onclick='javascript:AddNewNotification();return false;'/>";
                }
                else
                {
                    addNotificationHtml = "<input id='btnAddNewNotification' type='button' class='btn btn-sm btn-success pull-xs-right' value='" + Language_Resources.ManageNotification_Resource.addEditNotificationInfo + "' disabled/>";
                }

                Page.ClientScript.RegisterStartupScript(GetType(), "LoadNotificationInfo", "LoadNotificationInfo(" + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + basePath + "',\"" + addNotificationHtml + "\")", true);
            }
        }