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/NotificationScriptResource.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);

                #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);

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

                AccessType access = ValidateUserPrivileges(siteID, accessLevelID);
                if (access == AccessType.FULL_ACCESS || access == AccessType.EDIT_ONLY)
                {
                    btnSaveNotification.Attributes.Add("onclick", "javascript:AddUpdateNotification(false);return false;");
                }
                else
                {
                    btnSaveNotification.Attributes.Add("disabled", "disabled");
                }

                string basePath                   = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string webServicePath             = ConfigurationManager.AppSettings["MaintWebServicePath"];
                string uploaderPath               = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/');
                string imagePath                  = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/');
                string notificationAttachmentPath = ConfigurationManager.AppSettings["NotificationAttachmentPath"].TrimEnd('/');

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

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

                #region notification PagerData
                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex        = 0;
                pagerData.PageSize         = int.Parse(hdnPageSize.Value.ToString());
                pagerData.SelectMethod     = "LoadNotificationList";
                pagerData.ServicePath      = webServicePath;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.AccessLevelID    = accessLevelID;
                pagerData.LoadControlID    = btnSaveNotification.ClientID;
                pagerData.PageAccessRights = access.ToString();
                #endregion

                #region notification type PagerData
                ////using pager for notification types modal popup
                UserControls.PagerData maintTypePagerData = new UserControls.PagerData();
                maintTypePagerData.PageIndex        = 0;
                maintTypePagerData.PageSize         = int.Parse(hdnMasterPageSize.Value.ToString());
                maintTypePagerData.SelectMethod     = "LoadMaintTypesInfo";
                maintTypePagerData.ServicePath      = webServicePath;
                maintTypePagerData.SiteID           = siteID;
                maintTypePagerData.UserID           = userID;
                maintTypePagerData.AccessLevelID    = accessLevelID;
                maintTypePagerData.LoadControlID    = btnSaveNotification.ClientID;
                maintTypePagerData.PageAccessRights = access.ToString();
                #endregion

                #region FLocation and Equipment modal pagerdata
                //using pager for displaying equipment and locations in modal popup
                UserControls.PagerData equipmentPagerData = new UserControls.PagerData();
                equipmentPagerData.PageIndex     = 0;
                equipmentPagerData.PageSize      = int.Parse(hdnEquipmentPageSize.Value.ToString());
                equipmentPagerData.SelectMethod  = "LoadAllEquipmentFLoaction";
                equipmentPagerData.ServicePath   = webServicePath;
                equipmentPagerData.SiteID        = siteID;
                equipmentPagerData.UserID        = userID;
                equipmentPagerData.AccessLevelID = accessLevelID;
                equipmentPagerData.LoadControlID = btnSaveNotification.ClientID;
                #endregion

                thMaintTypes.Attributes.Add("onclick", "javascript:SortMaintTypesTabs('" + thMaintTypes.ClientID + "','MasterDataName');");
                thFLocation.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thFLocation.ClientID + "','LocationName');");
                thEquipment.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thEquipment.ClientID + "','EquipmentName');");
                thEquipmentType.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thEquipmentType.ClientID + "','EquipmentType');");
                sortNotifications.Attributes.Add("onclick", "javascript:SortByNotificationName('" + sortNotifications.ClientID + "','NotificationName');");
                ScriptManager.RegisterStartupScript(this, this.GetType(), "NotificationBasicLoadInfo", "javascript:NotificationBasicLoadInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + "," + (new JavaScriptSerializer()).Serialize(pagerData) + "," + (new JavaScriptSerializer()).Serialize(equipmentPagerData) + "," + (new JavaScriptSerializer()).Serialize(maintTypePagerData) + ",'" + basePath + "','" + webServicePath + "','" + notificationID + "','" + hasEditAccess + "','"
                                                    + hasDeleteAccess + "','" + workOrderHasFullAccess + "','" + uploaderPath + "','" + notificationAttachmentPath + "','" + imagePath + "','" + datePickerFormat + "','" + dateTimeFormat.DateFormat + "','" + dateTimeFormat.TimeFormat + "');", 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/EquipmentInfoScriptResource.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);
                #endregion

                int fLocationID = 0;
                int equipmentID = 0;
                int siteID      = CommonBLL.ValidateSiteID(Request);
                int userID      = this.CurrentUser.UserID;

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

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

                //functional location id
                if (Request.QueryString["flid"] != null && Request.QueryString["flid"].Trim().Length > 0)
                {
                    fLocationID = Convert.ToInt32(Request.QueryString["flid"].Trim());
                }

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

                AccessType access = ValidateUserPrivileges(siteID, accessLevelID);

                FilterObject filterObject = new FilterObject();
                if (Request.QueryString["filterTextValue"] != null && Request.QueryString["filterTextValue"].Trim().Length > 0)
                {
                    filterObject.FilterTextValue = Request.QueryString["filterTextValue"].Trim();
                }
                if (Request.QueryString["fids"] != null && Request.QueryString["fids"].Trim().Length > 0)
                {
                    filterObject.FilterLocationIds = Request.QueryString["fids"].Trim();
                }
                if (Request.QueryString["cids"] != null && Request.QueryString["cids"].Trim().Length > 0)
                {
                    filterObject.FilterCategoryIds = Request.QueryString["cids"].Trim();
                }

                string        basePath       = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string        webServicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim();
                ImagePathInfo imagePathInfo  = new ImagePathInfo();
                imagePathInfo.UploaderPath          = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/');
                imagePathInfo.ImgDefaultProfilePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images/Equipments.png";
                imagePathInfo.EquipmentImgPath      = ConfigurationManager.AppSettings["EquipmentImagePath"].ToString().Trim('/') + "/" + siteID + "/" + "Thumbnail";

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

                BasicParam basicParam = new 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(hdnEquipmentPageSize.Value.ToString());
                pagerData.SelectMethod     = "LoadAllEquipmentInfo";
                pagerData.ServicePath      = webServicePath;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.AccessLevelID    = accessLevelID;
                pagerData.LoadControlID    = divModelInfo.ClientID;
                pagerData.PageAccessRights = access.ToString();

                # region PagerData for Equipment model and master popup
                //using pager for equipment model selection
                UserControls.PagerData modelPagerData = new UserControls.PagerData();
                modelPagerData.PageIndex        = 0;
                modelPagerData.PageSize         = int.Parse(hdnModelPageSize.Value.ToString());
                modelPagerData.SelectMethod     = "LoadEquipmentModelInfo";
                modelPagerData.ServicePath      = webServicePath;
                modelPagerData.SiteID           = siteID;
                modelPagerData.UserID           = userID;
                modelPagerData.PageAccessRights = access.ToString();


                //using pager for displaying maintenance master data in configure maintenance types modal popup
                UserControls.PagerData maintTypePagerData = new UserControls.PagerData();
                maintTypePagerData.PageIndex        = 0;
                maintTypePagerData.PageSize         = int.Parse(hdnModelPageSize.Value.ToString());
                maintTypePagerData.SelectMethod     = "LoadMaintTypesInfo";
                maintTypePagerData.ServicePath      = webServicePath;
                maintTypePagerData.SiteID           = siteID;
                maintTypePagerData.UserID           = userID;
                maintTypePagerData.AccessLevelID    = accessLevelID;
                maintTypePagerData.LoadControlID    = divModelInfo.ClientID;
                maintTypePagerData.PageAccessRights = access.ToString();
                #endregion

                if (access == AccessType.FULL_ACCESS)
                {
                    btnAddMaintType.Attributes.Add("onclick", "javascript:InsertOrUpdateMaintType(" + (new JavaScriptSerializer()).Serialize(0) + ");return false;");
                }
                else
                {
                    btnAddMaintType.Attributes.Add("disabled", "disabled");
                }

                thMaintTypes.Attributes.Add("onclick", "javascript:SortMaintTypesTabs('" + thMaintTypes.ClientID + "','MasterDataName');");
                sortEquipment.Attributes.Add("onclick", "javascript:SortByEquipmentName('" + sortEquipment.ClientID + "','EquipmentName');");

                ScriptManager.RegisterStartupScript(this, this.GetType(), "LoadEquipmentBasicInfo", "javascript:LoadEquipmentBasicInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + "," + (new JavaScriptSerializer()).Serialize(pagerData) + "," + (new JavaScriptSerializer()).Serialize(maintTypePagerData) + "," + (new JavaScriptSerializer()).Serialize(modelPagerData) + ",'" + basePath + "','" + webServicePath + "','" + equipmentID + "','" + hasEditAccess + "','" + hasDeleteAccess + "'," + (new JavaScriptSerializer()).Serialize(imagePathInfo) + ",'" + fLocationID + "','" + hdfDatePickerFormat.Value + "');", true);
            }
Exemplo n.º 3
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)
        {
            #region Script Resource

            ScriptReference scriptReference = new ScriptReference();
            scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/CreateScheduleScriptResource.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);

            #endregion

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

            //if loading page from maintenance schedule
            if (Request.QueryString["ismaintenance"] != null && Request.QueryString["ismaintenance"].Trim().Length > 0)
            {
                scheduleType = Request.QueryString["ismaintenance"].ToString().Trim() == "true" ? "S" : scheduleType;
            }
            //if loading page from measuring point
            else if (Request.QueryString["ischecklist"] != null && Request.QueryString["ischecklist"].Trim().Length > 0)
            {
                scheduleType = Request.QueryString["ischecklist"].ToString().Trim() == "true" ? "I" : scheduleType;
            }

            //if loading page in edit mode
            int maintScheduleID = 0;
            if (Request.QueryString["maintscheduleid"] != null && Request.QueryString["maintscheduleid"].Trim().Length > 0)
            {
                maintScheduleID = Convert.ToInt32(Request.QueryString["maintscheduleid"].ToString().Trim());
            }

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

            AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID);

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

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

            if (accessType == AccessType.FULL_ACCESS || accessType == AccessType.EDIT_ONLY)
            {
                btnSaveScheduleInfo.Attributes.Add("onclick", "javascript:SaveScheduleInfo();return false;");
            }
            else
            {
                btnSaveScheduleInfo.Attributes.Add("disabled", "disabled");
            }

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

            ScriptManager.RegisterStartupScript(this, this.GetType(), "LoadScheduleInfo", "javascript:LoadScheduleInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + ",'" + basePath + "','" + webServicePath + "','" + datePickerFormat + "','" + dateTimeFormat.DateFormat + "','" + dateTimeFormat.TimeFormat + "','" + scheduleType + "'," + maintScheduleID + ",'" + btnSaveScheduleInfo.ClientID + "');", true);
        }
Exemplo n.º 6
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/MaintenanceScheduleScriptResource.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);

                #endregion

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

                //if loading page from manage schedule option
                if (Request.QueryString["isschedule"] != null && Request.QueryString["isschedule"].Trim().Length > 0)
                {
                    scheduleType = Request.QueryString["isschedule"].ToString().Trim() == "true" ? "S" : scheduleType;
                }

                //if loading page from manage work order option
                else if (Request.QueryString["isworkorder"] != null && Request.QueryString["isworkorder"].Trim().Length > 0)
                {
                    scheduleType = Request.QueryString["isworkorder"].ToString().Trim() == "true" ? "W" : scheduleType;
                }

                //if loading page from measuring point
                else if (Request.QueryString["isinspection"] != null && Request.QueryString["isinspection"].Trim().Length > 0)
                {
                    scheduleType = Request.QueryString["isinspection"].ToString().Trim() == "true" ? "I" : scheduleType;
                }

                //if loading page in edit mode
                int maintScheduleID = 0;
                if (Request.QueryString["maintscheduleid"] != null && Request.QueryString["maintscheduleid"].Trim().Length > 0)
                {
                    maintScheduleID = Convert.ToInt32(Request.QueryString["maintscheduleid"].ToString().Trim());
                }

                //if creating workorder for notification
                int notificationID = 0;
                if (Request.QueryString["notificationid"] != null && Request.QueryString["notificationid"].Trim().Length > 0 && scheduleType == "W")
                {
                    notificationID = Convert.ToInt32(Request.QueryString["notificationid"].ToString().Trim());
                }

                string workOrderID = string.Empty;
                //workorder will be there if its workorder of schedule
                if (Request.QueryString["workorderid"] != null && Request.QueryString["workorderid"].Trim().Length > 0 && scheduleType == "W")
                {
                    workOrderID = Request.QueryString["workorderid"].ToString().Trim();
                }

                string workOrderScheduleType = string.Empty;
                //workorder schedule type will be there if its workorder of schedule
                if (Request.QueryString["scheduletype"] != null && Request.QueryString["scheduletype"].Trim().Length > 0 && !string.IsNullOrEmpty(workOrderID))
                {
                    workOrderScheduleType = Request.QueryString["scheduletype"].ToString().Trim();
                }

                bool isFromManageNotify = false;
                if (Request.QueryString["ismn"] != null && Request.QueryString["ismn"].Trim().Length > 0 && scheduleType == "W")
                {
                    isFromManageNotify = Request.QueryString["ismn"].ToString().Trim().ToLower() == "true";
                }

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

                AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID);


                if ((accessType == AccessType.FULL_ACCESS || accessType == AccessType.EDIT_ONLY) && maintScheduleID > 0)
                {
                    btnCancelWorkOrder.Attributes.Add("onclick", "javascript:CancelWorkOrderConfirm();return false;");
                }
                else
                {
                    btnCancelWorkOrder.Attributes.Add("disabled", "disabled");
                }

                btnCancelWorkOrder.Visible = false;
                if (!string.IsNullOrEmpty(workOrderID) && !string.IsNullOrEmpty(workOrderScheduleType) && workOrderScheduleType == "S")
                {
                    accessType = AccessType.READ_ONLY;
                    btnActivateSchedule.Visible = false;
                    btnCancelWorkOrder.Visible  = true;
                }
                if (!string.IsNullOrEmpty(workOrderID) && !string.IsNullOrEmpty(workOrderScheduleType) && workOrderScheduleType == "W")
                {
                    btnCancelWorkOrder.Visible  = false;
                    btnActivateSchedule.Visible = true;
                }

                string basePath                    = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string webServicePath              = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim();
                string defaultImage                = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images/Equipments.png";
                string imagePath                   = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/');
                string taskDocumentPath            = ConfigurationManager.AppSettings["MaintenanceTaskDocumentsPath"].TrimEnd('/');
                string uploaderPath                = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/');
                string maintScheduleAttachmentPath = ConfigurationManager.AppSettings["MaintScheduleAttachmentPath"].TrimEnd('/');

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

                //using pager for displaying maintenance types in configure maintenance types modal popup
                UserControls.PagerData maintTypePagerData = new UserControls.PagerData();
                maintTypePagerData.PageIndex        = 0;
                maintTypePagerData.PageSize         = int.Parse(hdnPageSize.Value.ToString());
                maintTypePagerData.SelectMethod     = "LoadMaintTypesInfo";
                maintTypePagerData.ServicePath      = webServicePath;
                maintTypePagerData.SiteID           = siteID;
                maintTypePagerData.UserID           = userID;
                maintTypePagerData.AccessLevelID    = accessLevelID;
                maintTypePagerData.LoadControlID    = btnSaveMaintInfo.ClientID;
                maintTypePagerData.PageAccessRights = maintTypeAccess.ToString();


                //using pager for displaying equipment and locations in modal popup
                UserControls.PagerData equipmentPagerData = new UserControls.PagerData();
                equipmentPagerData.PageIndex     = 0;
                equipmentPagerData.PageSize      = int.Parse(hdnPageSize.Value.ToString());
                equipmentPagerData.SelectMethod  = "LoadAllEquipmentFLoaction";
                equipmentPagerData.ServicePath   = webServicePath;
                equipmentPagerData.SiteID        = siteID;
                equipmentPagerData.UserID        = userID;
                equipmentPagerData.AccessLevelID = accessLevelID;
                equipmentPagerData.LoadControlID = btnSaveMaintInfo.ClientID;

                if (accessType == AccessType.FULL_ACCESS || (accessType == AccessType.EDIT_ONLY && maintScheduleID > 0))
                {
                    btnSaveMaintInfo.Attributes.Add("onclick", "javascript:AddNewMaintenance();return false;");
                    btnSaveWorkInstruction.Attributes.Add("onclick", "javascript:SaveWorkInstructionInfo();return false;");
                    btnSaveSparePartInfo.Attributes.Add("onclick", "javascript:SaveSparePartInformation();return false;");
                }
                else
                {
                    btnSaveMaintInfo.Attributes.Add("disabled", "disabled");
                    btnSaveWorkInstruction.Attributes.Add("disabled", "disabled");
                    btnSaveSparePartInfo.Attributes.Add("disabled", "disabled");
                }

                if (maintReleaseAccess == AccessType.FULL_ACCESS)
                {
                    btnActivateSchedule.Attributes.Add("onclick", "javascript:ActivateScheduleConfirm();return false;");
                }
                else
                {
                    btnActivateSchedule.Attributes.Add("disabled", "disabled");
                }

                if (accessType == AccessType.FULL_ACCESS)
                {
                    btnAddMaintType.Attributes.Add("onclick", "javascript:InsertOrUpdateMaintType(" + (new JavaScriptSerializer()).Serialize(0) + ");return false;");
                }
                else
                {
                    btnAddMaintType.Attributes.Add("disabled", "disabled");
                }

                thMaintTypes.Attributes.Add("onclick", "javascript:SortMaintTypesTabs('" + thMaintTypes.ClientID + "','MasterDataName');");
                thFLocation.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thFLocation.ClientID + "','LocationName');");
                thEquipment.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thEquipment.ClientID + "','EquipmentName');");
                thEquipmentType.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thEquipmentType.ClientID + "','EquipmentType');");

                ScriptManager.RegisterStartupScript(this, this.GetType(), "InitMaintenanceScheduleInfo", "javascript:InitMaintenanceScheduleInfo(" + (new JavaScriptSerializer()).Serialize(maintTypePagerData) + "," + (new JavaScriptSerializer()).Serialize(equipmentPagerData) + ",'" + basePath + "','" + datePickerFormat + "','" + dateTimeFormat.DateFormat + "','" + dateTimeFormat.TimeFormat + "','" + defaultImage + "','" + scheduleType + "'," + maintScheduleID + ",'" + imagePath + "','" + taskDocumentPath + "','" + uploaderPath + "','" + accessType + "','" + maintScheduleAttachmentPath + "'," + notificationID + ",'" + workOrderID + "','" + isFromManageNotify + "','" + maintReleaseAccess + "');", true);
            }
        }