protected void wizInstall_NextButtonClick(object sender, WizardNavigationEventArgs e) { try { int activeIndex = 0; switch (e.CurrentStepIndex) { case 0: Panel pnl = (Panel)this.Step2.FindControl("pnlPackage"); GridView grd = (GridView)pnl.FindControl("gdvModule"); List <ModuleInfo> FinalModules = new List <ModuleInfo>(); foreach (GridViewRow row in grd.Rows) { CheckBox cbInstall = (CheckBox)row.FindControl("cbInstall"); if (cbInstall.Checked == true) { Label lbl = (Label)row.FindControl("lblname"); lstAvailableModules = (List <ModuleInfo>)ViewState["AvailableModuleList"]; foreach (ModuleInfo Module in lstAvailableModules) { if (Module.Name.Equals(lbl.Text)) { FinalModules.Add(Module); break; } } ViewState["FinalModuleList"] = FinalModules; } } if (FinalModules.Count > 1) { activeIndex = 2; this.lblLicense.Visible = false; } else if (FinalModules.Count == 1) { ModuleInfo Module = (ModuleInfo)FinalModules[0]; string SourcePath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "Resources"); string filename = Path.Combine(SourcePath, Module.FolderName); string path = HttpContext.Current.Server.MapPath("~/"); string temPath = SageFrame.Common.RegisterModule.Common.TemporaryFolder; string destPath = Path.Combine(path, temPath); Module.TempFolderPath = destPath; installhelp.CopyModuleZipFiles(filename, destPath); ArrayList list = installhelp.Step0CheckLogic(Module.FolderName, Module.TempFolderPath); Module = (ModuleInfo)list[1]; installhelp.fillModuleInfo(Module); this.lblReleaseNotesD.Text = Module.ReleaseNotes; this.lblLicenseD.Text = Module.License; FinalModules = new List <ModuleInfo>(); FinalModules.Add(Module); ViewState["FinalModuleList"] = FinalModules; activeIndex = 1; } break; case 1: activeIndex = 2; break; case 2: //Accept Terms if (chkAcceptLicense.Checked) { ModuleInfo moduleInfo = null; lstAvailableModules = (List <ModuleInfo>)ViewState["FinalModuleList"]; bool confirmationFlag = true; foreach (ModuleInfo Module in lstAvailableModules) { if (lstAvailableModules.Count > 1) { string SourcePath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "Resources"); string filename = Path.Combine(SourcePath, Module.FolderName); string path = HttpContext.Current.Server.MapPath("~/"); string temPath = SageFrame.Common.RegisterModule.Common.TemporaryFolder; string destPath = Path.Combine(path, temPath); Module.TempFolderPath = destPath; installhelp.CopyModuleZipFiles(filename, destPath); ArrayList list = installhelp.Step0CheckLogic(Module.FolderName, Module.TempFolderPath); moduleInfo = (ModuleInfo)list[1]; installhelp.fillModuleInfo(moduleInfo); } else if (lstAvailableModules.Count == 1) { moduleInfo = (ModuleInfo)Module; } installhelp.InstallPackage(moduleInfo); if (moduleInfo.ModuleID < 0) { confirmationFlag = false; InstallConfirmation(moduleInfo, ref activeIndex); break; } if (confirmationFlag && moduleInfo != null) { InstallConfirmation(moduleInfo, ref activeIndex); } } } else { lblAcceptMessage.Text = GetSageMessage("Extensions", "AcceptThePackageLicenseAgreementFirst"); e.Cancel = true; activeIndex = 2; } break; case 3: Bindgrid(); activeIndex = 0; ViewState["FinalModuleList"] = null; ViewState["AvailableModuleList"] = null; break; } wizInstall.ActiveStepIndex = activeIndex; } catch (Exception ex) { ProcessException(ex); } }
protected void wizInstall_NextButtonClick(object sender, WizardNavigationEventArgs e) { int activeIndex = 0; if (!IsModuleExist(Path.GetFileNameWithoutExtension(hdnFileName.Value))) { try { switch (e.CurrentStepIndex) { case 0: //Upload Page string filename = hdnFileName.Value; ArrayList arrColl = installhelp.Step0CheckLogic(filename); int ReturnValue; if (arrColl != null && arrColl.Count > 0) { if ((bool)arrColl[2]) { compositeModule = (CompositeModule)arrColl[1]; compositeModule = installhelp.fillCompositeModuleInfo(compositeModule); ViewState["CompositeModule"] = compositeModule; } else { module = (ModuleInfo)arrColl[1]; ViewState["ModuleInfo"] = module; } ReturnValue = (int)arrColl[0]; if (ReturnValue == 1) { BindPackage(); activeIndex = 2; break; } else if (ReturnValue == 2) { activeIndex = 1; BindPackage(); break; } else if (ReturnValue == 3) { lblLoadMessage.Text = GetSageMessage("Extensions", "ThisPackageIsNotValid"); lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; break; } else if (ReturnValue == 4) { lblLoadMessage.Text = GetSageMessage("Extensions", "ThisPackageDoesNotAppearToBeValid"); lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; break; } else { lblLoadMessage.Text = GetSageMessage("Extensions", "ThereIsErrorWhileInstallingThisModule"); lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; break; } } break; case 1: //Warning Page if (chkRepairInstall.Checked) { if (ViewState["CompositeModule"] != null) { CompositeModule tmpcompositeModule = (CompositeModule)ViewState["CompositeModule"]; this.lblLicense.Text = tmpcompositeModule.License; this.lblReleaseNotes.Text = tmpcompositeModule.ReleaseNotes; foreach (Component component in tmpcompositeModule.Components) { if (component.IsChecked) { bool isexist = installhelp.IsModuleExist(component.Name); if (isexist) { ModuleInfo objModule = installhelp.GetModuleByName(component.Name); if ((objModule != null)) { string path = HttpContext.Current.Server.MapPath("~/"); string targetPath = path + SageFrame.Common.RegisterModule.Common.ModuleFolder + '\\' + objModule.FolderName; objModule.InstalledFolderPath = targetPath; UninstallModule(objModule, true); } } } } } else { module = (ModuleInfo)ViewState["ModuleInfo"]; UninstallModule(module, true); } activeIndex = 2; } else { UninstallModule(module, false); activeIndex = 1; } if (ViewState["CompositeModule"] != null) { compositeModule = (CompositeModule)ViewState["CompositeModule"]; activeIndex = 3; } else { module = (ModuleInfo)ViewState["ModuleInfo"]; } break; case 2: Panel pnl = (Panel)this.Step2.FindControl("pnlPackage"); GridView grd = (GridView)pnl.FindControl("gdvModule"); string existingModules = string.Empty; bool IsErrorFlag = false; foreach (GridViewRow row in grd.Rows) { CheckBox cbInstall = (CheckBox)row.FindControl("cbInstall"); if (cbInstall.Checked == true) { Label lbl = (Label)row.FindControl("lblname"); if (ViewState["CompositeModule"] != null) { CompositeModule tmpcompositeModule = (CompositeModule)ViewState["CompositeModule"]; this.lblLicense.Text = tmpcompositeModule.License; this.lblReleaseNotes.Text = tmpcompositeModule.ReleaseNotes; foreach (Component component in tmpcompositeModule.Components) { if (component.Name.Equals(lbl.Text)) { component.IsChecked = true; bool isexist = installhelp.IsModuleExist(component.Name.ToLower()); if (isexist) { IsErrorFlag = true; existingModules += component.Name + ", "; } break; } } ViewState["CompositeModule"] = tmpcompositeModule; } } else { Label lbl = (Label)row.FindControl("lblname"); if (ViewState["CompositeModule"] != null) { CompositeModule compositeModule = (CompositeModule)ViewState["CompositeModule"]; foreach (Component component in compositeModule.Components) { if (component.Name.Equals(lbl.Text)) { if (!installhelp.IsModuleExist(component.Name.ToLower())) { installhelp.AddAvailableModules(compositeModule.TempFolderPath, component); break; } } } } } } if (IsErrorFlag) { string existingModuleName = existingModules.Substring(0, existingModules.LastIndexOf(",")); ShowMessage("Modules " + existingModuleName + " already exists", "Modules " + existingModuleName + " already exists", "Modules " + existingModuleName + " already exists", SageMessageType.Error); activeIndex = 1; BindPackage(); IsErrorFlag = false; break; } activeIndex = 3; break; case 3: activeIndex = 4; break; case 4: //Accept Terms if (chkAcceptLicense.Checked) { if (ViewState["CompositeModule"] != null) { ModuleInfo moduleInfo = null; compositeModule = (CompositeModule)ViewState["CompositeModule"]; bool confirmationFlag = true; foreach (Component component in compositeModule.Components) { if (component.IsChecked) { ArrayList list = installhelp.Step0CheckLogic(component.ZipFile, compositeModule.TempFolderPath); moduleInfo = (ModuleInfo)list[1]; installhelp.fillModuleInfo(moduleInfo); installhelp.InstallPackage(moduleInfo); if (moduleInfo.ModuleID < 0) { confirmationFlag = false; InstallConfirmation(moduleInfo, ref activeIndex); } } } if (confirmationFlag && moduleInfo != null) { InstallConfirmation(moduleInfo, ref activeIndex); } } else if ((ModuleInfo)ViewState["ModuleInfo"] != null) { module = (ModuleInfo)ViewState["ModuleInfo"]; installhelp.InstallPackage(module); InstallConfirmation(module, ref activeIndex); } activeIndex = 5; } else { lblAcceptMessage.Text = GetSageMessage("Extensions", "AcceptThePackageLicenseAgreementFirst"); e.Cancel = true; activeIndex = 4; } break; } wizInstall.ActiveStepIndex = activeIndex; } catch (Exception ex) { ProcessException(ex); } } else { lblLoadMessage.Text = GetSageMessage("Extensions", "ModuleAlreadyInstall"); lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; string downloadpath = Server.MapPath(string.Format("~/Install/Temp/{0}", hdnFileName.Value)); if (File.Exists(downloadpath)) { File.Delete(downloadpath); } } }
protected void wizInstall_NextButtonClick(object sender, WizardNavigationEventArgs e) { try { //System.Threading.Thread.Sleep(9000); int activeIndex = 0; switch (e.CurrentStepIndex) { case 0: //Upload Page ArrayList arrColl = installhelp.Step0CheckLogic(this.fileModule); int ReturnValue; if (arrColl != null && arrColl.Count > 0) { ReturnValue = (int)arrColl[0]; module = (ModuleInfo)arrColl[1]; ViewState["ModuleInfo"] = module; if (ReturnValue == 0) { lblLoadMessage.Text = GetSageMessage("Extensions_Editors", "YouNeedToSelectAFileToUploadFirst"); lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; break; } else if (ReturnValue == -1) { lblLoadMessage.Text = GetSageMessage("Extensions_Editors", "InvalidFileExtension ") + this.fileModule.FileName; lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; break; } else if (ReturnValue == 1) { BindPackage(); activeIndex = 2; break; } else if (ReturnValue == 2) { activeIndex = 1; BindPackage(); break; } else if (ReturnValue == 3) { lblLoadMessage.Text = GetSageMessage("Extensions_Editors", "ThisPackageIsNotValid"); lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; break; } else if (ReturnValue == 4) { lblLoadMessage.Text = GetSageMessage("Extensions_Editors", "ThisPackageDoesNotAppearToBeValid"); lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; break; } else { lblLoadMessage.Text = GetSageMessage("Extensions_Editors", "ThereIsErrorWhileInstallingThisModule"); lblLoadMessage.Visible = true; e.Cancel = true; activeIndex = 0; break; } } break; case 1: //Warning Page module = (ModuleInfo)ViewState["ModuleInfo"]; if (chkRepairInstall.Checked) { UninstallModule(module, true); activeIndex = 2; } else { UninstallModule(module, false); activeIndex = 1; } break; case 2: activeIndex = 3; break; case 3: activeIndex = 4; break; case 4: //Accept Terms if (chkAcceptLicense.Checked) { module = (ModuleInfo)ViewState["ModuleInfo"]; if (module != null) { installhelp.InstallPackage(module); if (module.ModuleID <= 0) { lblLoadMessage.Text = GetSageMessage("Extensions_Editors", "ThereIsErrorWhileInstalling"); ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("Extensions_Editors", "ErrorWhileInstalling"), "", SageMessageType.Error); lblLoadMessage.Visible = true; chkAcceptLicense.Checked = false; ViewState["ModuleInfo"] = null; activeIndex = 0; } else { lblInstallMessage.Text = GetSageMessage("Extensions_Editors", "ModuleInstalledSuccessfully"); ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("Extensions_Editors", "TheModuleIsInstalledSuccessfully"), "", SageMessageType.Success); wizInstall.DisplayCancelButton = false; activeIndex = 5; } } } else { lblAcceptMessage.Text = GetSageMessage("Extensions_Editors", "AcceptThePackageLicenseAgreementFirst"); e.Cancel = true; activeIndex = 4; } break; } wizInstall.ActiveStepIndex = activeIndex; } catch (Exception ex) { throw ex; } }