public DataSetToExcel(string ExcelPath, InfoDataSet InfoDataSet, string title) { this.Excelpath = ExcelPath; this.DataSet = InfoDataSet; this.Title = title; _filter = string.Empty; _Sort = string.Empty; }
public frmAccessMenusForUser(InfoDataSet dsUser, string selectedUser, string selectedUserName) { InitializeComponent(); idsUser = dsUser; strSelectedUser = selectedUser; strSelectedUserName = selectedUserName; this.lblUserID.Text = strSelectedUser; this.lblUserName.Text = strSelectedUserName; }
private void GenDataSet() { ds = this.FInfoDataSet; }
private void doOk() { if (dgView.CurrentRow == null) { this.Close(); return; } dsAllData = (InfoDataSet)this.DataSource.GetDataSource(); if (this.BoxCtrl == null && this.GridCtrl != null) { #region GridCtrl string strValue = this.ValueField; string strSelectedValue = string.Empty; int i = this.dgView.Columns.Count; int k = -1; for (int j = 0; j < i; j++) { if (string.Compare(this.dgView.Columns[j].Name, strValue, true) == 0)//IgnoreCase { k = j; break; } } if (k != -1) strSelectedValue = dgView[k, dgView.CurrentRow.Index].Value.ToString(); if (strSelectedValue != string.Empty) this.GridCtrl.InnerTextBox.Text = strSelectedValue; this.Close(); if (!bCloseEventArises) { this.RefVal.Close(new OnCloseEventArgs()); bCloseEventArises = true; } this.RefVal.Return(new OnReturnEventArgs((DataRowView)dgView.CurrentRow.DataBoundItem)); //if (this.RefVal.SelectCommand == null || this.RefVal.SelectCommand == "") //{ // dsAllData.ClearWhere(); // bClearWhere = true; //} //else //{ // dsAllData.Execute(RefVal.SelectCommand, true); // bClearWhere = true; //} #endregion } else if (this.GridCtrl == null && this.BoxCtrl != null) { #region BoxCtrl string strValue = this.ValueField; string strSelectedValue = string.Empty; int i = this.dgView.Columns.Count; int k = -1; for (int j = 0; j < i; j++) { if (string.Compare(this.dgView.Columns[j].Name, strValue, true) == 0)//IgnoreCase { k = j; break; } } if (k != -1) strSelectedValue = dgView[k, dgView.CurrentRow.Index].Value.ToString(); if (strSelectedValue != string.Empty) { if (this.BoxCtrl.DisableValueMember) { this.BoxCtrl.TextBoxLeaveText = strSelectedValue; } else { this.BoxCtrl.TextBoxText = strSelectedValue; this.BoxCtrl.TextBoxLeaveText = strSelectedValue; } } this.Close(); if (!bCloseEventArises) { this.BoxCtrl.RefVal.Close(new OnCloseEventArgs()); bCloseEventArises = true; } this.BoxCtrl.RefVal.Return(new OnReturnEventArgs((DataRowView)dgView.CurrentRow.DataBoundItem)); //if (this.BoxCtrl.RefVal.SelectCommand == null || this.BoxCtrl.RefVal.SelectCommand == "") //{ // dsAllData.ClearWhere(); // bClearWhere = true; //} //else //{ // //modified by lily 2007/3/13 RefVal.SelectAlias-->null,for runtime loginDB is the right db. // dsAllData.Execute(RefVal.SelectCommand, null, true); // bClearWhere = true; //} #endregion } }
private void Init() { ClearValues(); LoadDBString(); FInfoDataSet = new InfoDataSet(); if (((FDTE2 != null) && (FDTE2.Solution.FileName != "")) && File.Exists(FDTE2.Solution.FileName)) { EnabledOutputControls(); } FInfoDataSet.SetWizardDesignMode(true); try { cbEEPAlias.Text = EEPRegistry.WizardConnectionString; cbDatabaseType.Text = EEPRegistry.DataBaseType; } catch { } DisplayPage(tpConnection); }
private void btnCancel_Click(object sender, EventArgs e) { FInfoDataSet.Dispose(); FInfoDataSet = null; Hide(); }
public void GenWebDataSet(ProjectItem projItem, ClientParam cParam, bool isMasterDetails) { //NotifyRefresh(1000); NotifyRefresh(1000); //WebDataSet string Path = projItem.get_FileNames(0); String lan = GetLanguage(); string FileName = System.IO.Path.GetFileNameWithoutExtension(Path) + ".aspx" + lan; Path = System.IO.Path.GetDirectoryName(Path); FileName = Path + "\\" + FileName; if (!File.Exists(FileName)) return; System.IO.StreamReader SR = new System.IO.StreamReader(FileName); string Context = SR.ReadToEnd(); SR.Close(); if (lan == String.Empty || lan == ".cs") { Context = Context.Replace("this.WMaster.RemoteName = null;", "this.WMaster.RemoteName = \"" + cParam.ProviderName + "\";"); Context = Context.Replace("this.WMaster.Active = false;", "this.WMaster.Active = true;"); if (isMasterDetails) { Context = Context.Replace("this.WDetail.RemoteName = null;", "this.WDetail.RemoteName = \"" + cParam.DetailProviderName + "\";"); Context = Context.Replace("this.WDetail.Active = false;", "this.WDetail.Active = true;"); Context = Context.Replace("\"NewDataSet_\"", "\"NewDataSet_" + cParam.DetailProviderName.Substring(cParam.DetailProviderName.IndexOf('.') + 1, cParam.DetailProviderName.Length - cParam.DetailProviderName.IndexOf('.') - 1) + "\""); } } else if (lan == ".vb") { Context = Context.Replace("Me.WMaster.RemoteName = Nothing", "Me.WMaster.RemoteName = \"" + cParam.ProviderName + "\""); Context = Context.Replace("Me.WMaster.Active = False", "Me.WMaster.Active = True"); if (isMasterDetails) { Context = Context.Replace("Me.WDetail.RemoteName = Nothing", "Me.WDetail.RemoteName = \"" + cParam.DetailProviderName + "\""); Context = Context.Replace("Me.WDetail.Active = False", "Me.WDetail.Active = True"); Context = Context.Replace("\"NewDataSet_\"", "\"NewDataSet_" + cParam.DetailProviderName.Substring(cParam.DetailProviderName.IndexOf('.') + 1, cParam.DetailProviderName.Length - cParam.DetailProviderName.IndexOf('.') - 1) + "\""); } } System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.UTF8); SW.Write(Context); SW.Close(); Filefs.Close(); //WebDataSource Master NotifyRefresh(1000); //GetSchema if (WizardDataSet != null) WizardDataSet.Dispose(); WizardDataSet = new InfoDataSet(true); WizardDataSet.RemoteName = cParam.ProviderName; WizardDataSet.Active = true; WizardDataSet.ServerModify = false; WizardDataSet.PacketRecords = 100; WizardDataSet.AlwaysClose = true; if (isMasterDetails) { if (WizardDetailDataSet != null) WizardDetailDataSet.Dispose(); WizardDetailDataSet = new InfoDataSet(true); WizardDetailDataSet.RemoteName = cParam.DetailProviderName; WizardDetailDataSet.Active = true; WizardDetailDataSet.ServerModify = false; WizardDetailDataSet.PacketRecords = 100; WizardDetailDataSet.AlwaysClose = false; } #if VS90 object oMaster = FDesignerDocument.webControls.item("Master", 0); if (oMaster != null && oMaster is WebDevPage.IHTMLElement) { ((WebDevPage.IHTMLElement)oMaster).setAttribute("DataMember", cParam.TableName, 0); } if (isMasterDetails) { object oDetail = FDesignerDocument.webControls.item("Detail", 0); if (oDetail != null && oDetail is WebDevPage.IHTMLElement) { ((WebDevPage.IHTMLElement)oDetail).setAttribute("DataMember", (cParam.ChildTableName.Split(','))[0], 0); } } WebClientCreator.SaveWebDataSet(WizardDataSet, WizardDetailDataSet, projItem); #else WebDataSource Master = (WebDataSource)FPage.FindControl("Master"); Master.DataMember = cParam.TableName; IComponentChangeService FComponentChangeService = (IComponentChangeService)FDesignerHost.RootComponent.Site.GetService(typeof(IComponentChangeService)); FComponentChangeService.OnComponentChanged(Master, null, "", "M"); if (isMasterDetails) { WebDataSource Detail = (WebDataSource)FPage.FindControl("Detail"); string[] DetailTableName = cParam.ChildTableName.Split(','); Detail.DataMember = DetailTableName[0]; FComponentChangeService.OnComponentChanged(Detail, null, "", "M"); } WebClientCreator.SaveWebDataSet(WizardDataSet, WizardDetailDataSet, projItem); #endif }
private void setWizardStep(int step) { if (step > 4 || step < 0) return; currentStep = step; this.tbcContainer.TabPages.Clear(); switch (step) { case 0: this.tbcContainer.TabPages.Add(this.tp1); this.btnPrevious.Enabled = false; this.btnNext.Enabled = true; this.btnDone.Enabled = false; //init string sevPath = ReportCreator.GetServerPath(); XmlDocument doc = new XmlDocument(); doc.Load(SystemFile.DBFile); XmlNode nDataBase = doc.SelectSingleNode("InfolightDB/DataBase"); ArrayList lstDB = new ArrayList(); foreach (XmlNode node in nDataBase.ChildNodes) { lstDB.Add(node.Name); } this.cmbSelectAlias.DataSource = lstDB; this.cmbSelectAlias.SelectedIndex = 0; this.cmbDataBaseType.SelectedIndex = 1; this.txtDetailsRptFileName.Enabled = false; this.cmbMasterReportStyle.SelectedIndex = 0; break; case 1: this.tbcContainer.TabPages.Add(this.tp4); this.btnPrevious.Enabled = false; this.btnNext.Enabled = true; this.btnDone.Enabled = false; if (this._isWebReport) { this.panel4.Visible = false; if (!Previousflag) { cbWebSite.Items.Clear(); foreach (Project P in _dte2.Solution.Projects) { if (string.Compare(P.Kind, "{E24C65DC-7377-472b-9ABA-BC803B73C61A}") == 0) { cbWebSite.Items.Add(P.Name); } } } } else { this.panel4.Visible = true; if (!Previousflag) { string S = _dte2.Solution.FileName; S = System.IO.Path.GetDirectoryName(S); String SolutionName = Path.GetFileNameWithoutExtension(_dte2.Solution.FileName); tbOutputPath.Text = S + @"\" + SolutionName; tbAssemblyOutputPath.Text = String.Format(@"..\..\EEPNetClient\{0}", SolutionName); tbPackageName.Text = "ClientPackage"; } } if (!Previousflag) { tbFormName.Text = "Form1"; tbFormTitle.Text = "Form1"; } break; case 2: if (checkStepCompleted(step - 1)) { this.tbcContainer.TabPages.Add(this.tp5); this.btnPrevious.Enabled = true; this.btnNext.Enabled = false; this.btnDone.Enabled = true; FInfoDataSet = new InfoDataSet(); FInfoDataSet.SetWizardDesignMode(true); break; } else { this.tbcContainer.TabPages.Add(this.tp4); this.btnPrevious.Enabled = false; this.btnNext.Enabled = true; this.btnDone.Enabled = false; currentStep--; step--; return; } case 3: this.tbcContainer.TabPages.Add(this.tp2); if (this._isWebReport) { this.panel3.Visible = false; Project proj = WebClientProject(); foreach (ProjectItem item in proj.ProjectItems) { if (item.Kind == "{6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C}") { this.cmbRootName.Items.Add(item.Name); } } this.cmbRootName.SelectedItem = this.cbAddToExistFolder.SelectedItem; } else { this.panel3.Visible = true; this.cmbProName.Items.AddRange(ReportCreator.FindAllClientProject(_dte2.Solution as Solution2).ToArray()); this.cmbProName.SelectedItem = tbPackageName.Text; } chkIsMasterDetails.Checked = cbIsMasterDetails.Checked; txtRptFileName.Text = this.tbFormName.Text; if (cbIsMasterDetails.Checked) { txtDetailsRptFileName.Text = this.tbFormName.Text + "-dt"; } txtRptCaption.Text = tbFormTitle.Text; tbHorGaps.Text = "2.54"; tbVertGaps.Text = "0.64"; this.btnPrevious.Enabled = false; this.btnNext.Enabled = true; this.btnDone.Enabled = false; break; case 4: this.tbcContainer.TabPages.Add(this.tp3); this.btnPrevious.Enabled = true; this.btnNext.Enabled = false; this.btnDone.Enabled = true; break; } tbcContainer.SelectedIndex = step; }
private void btnCancel_Click(object sender, EventArgs e) { ClearAllListViewSort(); FInfoDataSet.Dispose(); FInfoDataSet = null; Hide(); }
private void btnDone_Click(object sender, EventArgs e) { try { ClearAllListViewSort(); SetValue(); SetValue_D(); if (FClientData.IsMasterDetailBaseForm()) { if (FClientData.BaseFormName == "SL3DCardMasterDetail" || FClientData.BaseFormName == "SLFormListMasterDetail" || FClientData.BaseFormName == "SLMasterDetail2" || FClientData.BaseFormName == "SLMasterDetail3") AddBlockItem("View", FClientData.RemoteName, FClientData.CommandName, lvViewDesField); AddBlockItem("Master", FClientData.RemoteName, FClientData.CommandName, lvMasterDesField); AddDetailBlockItem("Master", tvRelation.Nodes, lvSelectedFields); } else { if (FClientData.BaseFormName == "SLSingle" || FClientData.BaseFormName == "SL3DCard" || FClientData.BaseFormName == "SLFormList") AddBlockItem("View", FClientData.RemoteName, FClientData.CommandName, lvViewDesField); AddBlockItem("Main", FClientData.RemoteName, FClientData.CommandName, lvMasterDesField); } Hide(); FDTE2.MainWindow.Activate(); DoGenClient(); FInfoDataSet.Dispose(); FInfoDataSet = null; ClearAllControls(); } catch (Exception ex) { WzdUtils.Application_ThreadException(null, new ThreadExceptionEventArgs(ex)); } }
private void btnComboRemoteName_D_Click(object sender, EventArgs e) { if (radioButtonEntity.Checked) { EFAssembly.EFClientToolsAssemblyAdapt.RemoteNameEditorDialog remoteNameEditorDialog = new EFAssembly.EFClientToolsAssemblyAdapt.RemoteNameEditorDialog(); if (remoteNameEditorDialog.RemoteNameEditorDialogForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { tbComboRemoteName_D.Text = remoteNameEditorDialog.ReturnValue; tbComboEntityName_D.Text = remoteNameEditorDialog.ReturnClassName; List<object> refvals = WzdUtils.GetAllDataByTableName("SYS_REFVAL"); for (int i = 0; i < refvals.Count; i++) { if ((refvals[i] as SYS_REFVAL).REFVAL_NO == "SL." + tbComboEntityName_D.Text && lvSelectedFields.SelectedItems[0].Text == (refvals[i] as SYS_REFVAL).VALUE_MEMBER) { cbComboDisplayField_D.Text = (refvals[i] as SYS_REFVAL).DISPLAY_MEMBER; cbComboValueField_D.Text = (refvals[i] as SYS_REFVAL).VALUE_MEMBER; tbOtherFields_D.Text = (refvals[i] as SYS_REFVAL).SELECT_COMMAND; break; } } } } else if (radioButtonInfoCommand.Checked) { string[] fSelectedList = new string[10]; string strSelected = ""; IGetValues aItem = (IGetValues)FInfoDataSet; FProviderNameList = aItem.GetValues("RemoteName"); PERemoteName form = new PERemoteName(FProviderNameList, strSelected); if (form.ShowDialog() == DialogResult.OK) { tbComboRemoteName_D.Text = form.RemoteName; InfoDataSet ds = new InfoDataSet(); ds.SetWizardDesignMode(true); ds.RemoteName = tbComboRemoteName_D.Text; ds.ClearWhere(); ds.SetWhere("1=0"); ds.Active = true; String DataSetName = ds.RealDataSet.Tables[0].TableName; String ModuleName = ds.RemoteName.Substring(0, ds.RemoteName.IndexOf('.')); String SolutionName = System.IO.Path.GetFileNameWithoutExtension(FDTE2.Solution.FullName); tbComboEntityName_D.Text = CliUtils.GetTableName(ModuleName, DataSetName, SolutionName, "", true); DataSet dsSYS_REFVAL = GetDataFromSYS_REFVAL(tbComboEntityName_D.Text, lvSelectedFields.SelectedItems[0].Text); if (dsSYS_REFVAL.Tables.Count > 0 && dsSYS_REFVAL.Tables[0].Rows.Count > 0) { cbComboDisplayField_D.Text = dsSYS_REFVAL.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString(); cbComboValueField_D.Text = dsSYS_REFVAL.Tables[0].Rows[0]["VALUE_MEMBER"].ToString(); tbOtherFields_D.Text = dsSYS_REFVAL.Tables[0].Rows[0]["SELECT_COMMAND"].ToString(); } } } }
private void tbTableName_TextChanged(object sender, EventArgs e) { if (radioButtonEntity.Checked) { if (tbComboEntityName.Text != String.Empty) { Dictionary<string, object> htFields = WzdUtils.GetFieldsByEntityName(FClientData.AssemblyName, FClientData.CommandName, this.tbComboEntityName.Text); cbDataTextField.Items.Clear(); cbDataValueField.Items.Clear(); foreach (var field in htFields) { cbDataTextField.Items.Add(field.Key.ToString()); cbDataValueField.Items.Add(field.Key.ToString()); } } else { cbDataTextField.Items.Clear(); cbDataValueField.Items.Clear(); } } else if (radioButtonInfoCommand.Checked) { if (tbComboEntityName.Text != String.Empty) { InfoDataSet ds = new InfoDataSet(); ds.SetWizardDesignMode(true); ds.RemoteName = tbComboRemoteName.Text; ds.ClearWhere(); ds.SetWhere("1=0"); ds.Active = true; cbDataTextField.Items.Clear(); cbDataValueField.Items.Clear(); foreach (DataColumn field in ds.GetRealDataSet().Tables[0].Columns) { cbDataTextField.Items.Add(field.ColumnName); cbDataValueField.Items.Add(field.ColumnName); } } else { cbDataTextField.Items.Clear(); cbDataValueField.Items.Clear(); } } }
private void Init() { ClearValues(); LoadDBString(); MWizard.WCF.EFAssembly.EFClientToolsAssemblyAdapt.EFClientToolsAssembly = MWizard.WCF.EFAssembly.EFClientToolsAssemblyAdapt.LoadEFClientTools(); FInfoDataSet = new InfoDataSet(); if (((FDTE2 != null) && (FDTE2.Solution.FileName != String.Empty)) && File.Exists(FDTE2.Solution.FileName)) { EnabledOutputControls(); } cbEEPAlias.Text = EEPRegistry.WizardConnectionString; cbDatabaseType.Text = EEPRegistry.DataBaseType; FInfoDataSet.SetWizardDesignMode(true); DisplayPage(tbConnection); }
public void GetData(CacheModeType mode) { string lastDateTime = LastDateTime; InfoDataSet ids = new InfoDataSet(); ids.RemoteName = this.RemoteName; ids.PacketRecords = -1; ClientType dbType = CliUtils.GetDataBaseType(); string mark = (dbType == ClientType.ctMsSql || dbType == ClientType.ctOleDB) ? "+" : "||"; ids.WhereStr = string.Format("{0}{1}{2}>'{3}'", UPDATE_DATE, mark, UPDATE_TIME, lastDateTime); DateTime datetime =DateTime.Now; ids.Active = true; if (ids.RealDataSet.Tables[0].Rows.Count > 0) { if (mode == CacheModeType.All) { RealDataSet.Clear(); ids.SetWhere(string.Format("{0}='I'or {0}='M'", UPDATE_STATE)); } else if (mode == CacheModeType.Smart) { DataRow[] rowDeleteDB = ids.RealDataSet.Tables[0].Select(string.Format("{0}='D'", UPDATE_STATE)); foreach (DataRow dr in rowDeleteDB) { int pklength = ids.RealDataSet.Tables[0].PrimaryKey.Length; if (pklength > 0) { object[] values = new object[pklength]; for (int i = 0; i < pklength; i++) { values[i] = dr[ids.RealDataSet.Tables[0].PrimaryKey[i]]; } DataRow filerow = this.RealDataSet.Tables[0].Rows.Find(values); if (filerow != null) { this.RealDataSet.Tables[0].Rows.Remove(filerow); } } ids.RealDataSet.Tables[0].Rows.Remove(dr); } } this.RealDataSet.Merge(ids.RealDataSet); //save Save(); } LastDateTime = datetime.ToString("yyyyMMddHHmmss", new System.Globalization.CultureInfo("en-us")); }
public void Execute(string user) { if (this.ParentAutoTest != null && (this.KeyField == "" || this.KeyField == null)) { language = CliUtils.fClientLang; string message = SysMsg.GetSystemMessage(language, "Srvtools", "AutoTest", "KeyFieldNull"); MessageBox.Show(message); return; } if (this.infoBindingSource != null) { if (ids == null) { ids = (InfoDataSet)this.infoBindingSource.GetDataSource(); } if (this.ParentAutoTest != null || this.infoBindingSource.DataSource == ids) { for (int times = 0; times < this.Rows; times++) { List<String> listKey = new List<String>(); DataRow dr = ids.RealDataSet.Tables[deep].NewRow(); foreach (infoColumn ColumnsItem in Columns) { for (int i = 0; i < ids.RealDataSet.Tables[deep].Columns.Count; i++) { if (ids.RealDataSet.Tables[deep].Columns[i].Caption == ColumnsItem.ColumnName) { if (deep > 0 && ids.RealDataSet.Tables[0].Rows.Count > 0) { DataRow dr_temp = ids.RealDataSet.Tables[0].Rows[ids.RealDataSet.Tables[0].Rows.Count - 1]; if (ColumnsItem.ColumnName == ids.RealDataSet.Tables[0].PrimaryKey.GetValue(0).ToString()) { dr[ids.RealDataSet.Tables[deep].Columns[i].Caption] = dr_temp[ids.RealDataSet.Tables[0].Columns[i].Caption]; break; } } if (ColumnsItem.valueMode == ValueMode.Fixed) { dr[ids.RealDataSet.Tables[deep].Columns[i].Caption] = GetDefaultValue(ColumnsItem); break; } else if (ColumnsItem.valueMode == ValueMode.Random) { bool flag = true; for (int j = 0; j < ColumnsItem.Value.Length; j++) if (ColumnsItem.Value[j] < 48 || ColumnsItem.Value[j] > 57) flag = false; for (int j = 0; j < ColumnsItem.RandomTo.Length; j++) if (ColumnsItem.RandomTo[j] < 48 || ColumnsItem.RandomTo[j] > 57) flag = false; if (flag == false) { int length; String value = null; if (ColumnsItem.Value.Length < ColumnsItem.RandomTo.Length) length = ColumnsItem.Value.Length; else length = ColumnsItem.RandomTo.Length; Label1: StringBuilder sb = new StringBuilder(length); for (int x = 0; x < length; x++) { sb.Append(getRandomChar(ColumnsItem.Value[x], ColumnsItem.RandomTo[x])); } for (int x = 0; x < ColumnsItem.RandomTo.Length - ColumnsItem.Value.Length; x++) { sb.Append(getRandomChar(ColumnsItem.RandomTo[x])); } if (ColumnsItem.ColumnName == this.KeyField && listKey.Contains(sb.ToString())) { goto Label1; } value = sb.ToString(); dr[ids.RealDataSet.Tables[deep].Columns[i].Caption] = value; listKey.Add(value); } else { int begin, end; Random m_rnd = new Random(); int value; begin = this.getRandomInt(ColumnsItem.Value); end = this.getRandomInt(ColumnsItem.RandomTo); Label2: value = this.m_rnd.Next(begin, end); if (ColumnsItem.ColumnName == this.KeyField && listKey.Contains(value.ToString())) { goto Label2; } dr[ids.RealDataSet.Tables[deep].Columns[i].Caption] = value; listKey.Add(value.ToString()); } break; } else if (ColumnsItem.valueMode == ValueMode.RefRandom) { if (ColumnsItem.RefVal != null) { InfoDataSet r_ds = (InfoDataSet)ColumnsItem.RefVal.GetDataSource(); Random rnd = new Random(); Label3: int x = rnd.Next(r_ds.RealDataSet.Tables[0].Rows.Count); DataRow r_dr = r_ds.RealDataSet.Tables[0].Rows[x]; if (ColumnsItem.ColumnName == this.KeyField && listKey.Contains(r_dr[ColumnsItem.RefVal.ValueMember].ToString())) { goto Label3; } dr[ColumnsItem.ColumnName] = r_dr[ColumnsItem.RefVal.ValueMember]; listKey.Add(r_dr[ColumnsItem.RefVal.ValueMember].ToString()); } break; } else { dr[ColumnsItem.ColumnName] = user + sequence++; break; } } } } try { ids.RealDataSet.Tables[deep].Rows.Add(dr); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } if (this.ChildAutoTest.Count > 0) { int xcount = 0; for (; xcount < this.ChildAutoTest.Count; xcount++) { deep++; deep = deep + xcount; AutoTest test = (AutoTest)this.ChildAutoTest[xcount]; //DateTime StartTime = DateTime.Now; //int start = (StartTime.Hour * 60 * 60 + StartTime.Minute * 60 + StartTime.Second) * 1000 + StartTime.Millisecond; //alLog.Add("UserID: " + user + " PackageName: " + package + " Satuts: DetailStart"); test.Execute(user); //DateTime CompleteTime = DateTime.Now; //int complete = (CompleteTime.Hour * 60 * 60 + CompleteTime.Minute * 60 + CompleteTime.Second) * 1000 + CompleteTime.Millisecond; //int between = complete - start; //alLog.Add("UserID: " + user + " PackageName: " + package + " Satuts: DetailComplete DateTime: " + between.ToString()); //MaxRespendTime = Max(StartTime, CompleteTime, MaxRespendTime); //MinRespendTime = Min(StartTime, CompleteTime, MinRespendTime); } if (xcount > 0) deep -= xcount; else deep++; } //if(deep > 0) //{ // DateTime CompleteTime = DateTime.Now; // int complete = (CompleteTime.Hour * 60 * 60 + CompleteTime.Minute * 60 + CompleteTime.Second) * 1000 + CompleteTime.Millisecond; // int between = complete - start; // alLog.Add("UserID: " + user + " PackageName: " + package + " Satuts: MasterComplete DateTime: " + between.ToString()); //} } } deep = 0; //if (this.Log != null && this.Log != "") //{ // complete = DateTime.Now; //MaxRespendTime = Max(start, complete, MaxRespendTime); //MinRespendTime = Min(start, complete, MinRespendTime); // alLog.Add("UserID: " + user + " PackageName: " + package); // int time = (complete.Hour * 60 * 60 + complete.Minute * 60 + complete.Second) * 1000 + complete.Millisecond; // alLog.Add(" Status: COMPLETE TEST DateTime: " + time.ToString()); // //alLog.Add(" Status: COMPLETE TEST DateTime: " + complete.ToString()); //} } }
public void SaveWebDataSet(InfoDataSet ds) { string Path = FPI.get_FileNames(0); string FileName = Path + ".vi-VN.resx"; string keyName = "WebDataSets"; XmlDocument xDoc = new XmlDocument(); xDoc.Load(FileName); XmlNode aNode = xDoc.DocumentElement.FirstChild; while (aNode != null) { if (aNode.InnerText.Contains(keyName)) { if (aNode.InnerText.Contains("WView")) FWizardDataSet.RemoteName = FClientData.ViewProviderName; else FWizardDataSet.RemoteName = FClientData.ProviderName; int x, y; String temp; x = aNode.InnerText.IndexOf("<Active>"); y = aNode.InnerText.IndexOf("</Active>"); temp = aNode.InnerText.Substring(x, (y - x) + 9); aNode.InnerText = aNode.InnerText.Replace(temp, "<Active>" + FWizardDataSet.Active + "</Active>"); x = aNode.InnerText.IndexOf("<PacketRecords>"); y = aNode.InnerText.IndexOf("</PacketRecords>"); temp = aNode.InnerText.Substring(x, (y - x) + 16); aNode.InnerText = aNode.InnerText.Replace(temp, "<PacketRecords>" + FWizardDataSet.PacketRecords + "</PacketRecords>"); x = aNode.InnerText.IndexOf("<RemoteName>"); y = aNode.InnerText.IndexOf("</RemoteName>"); temp = aNode.InnerText.Substring(x, (y - x) + 13); aNode.InnerText = aNode.InnerText.Replace(temp, "<RemoteName>" + FWizardDataSet.RemoteName + "</RemoteName>"); x = aNode.InnerText.IndexOf("<ServerModify>"); y = aNode.InnerText.IndexOf("</ServerModify>"); temp = aNode.InnerText.Substring(x, (y - x) + 15); aNode.InnerText = aNode.InnerText.Replace(temp, "<ServerModify>" + FWizardDataSet.ServerModify + "</ServerModify>"); break; } aNode = aNode.NextSibling; } xDoc.Save(FileName); }
private void GenDataSet() { //NotifyRefresh(1000); NotifyRefresh(1000); //WebDataSet string Path = FPI.get_FileNames(0); string FileName = System.IO.Path.GetFileNameWithoutExtension(Path) + ".aspx." + FClientData.Language; Path = System.IO.Path.GetDirectoryName(Path); FileName = Path + "\\" + FileName; if (!File.Exists(FileName)) return; System.IO.StreamReader SR = new System.IO.StreamReader(FileName); string Context = SR.ReadToEnd(); SR.Close(); if (FClientData.Language == "cs") { Context = Context.Replace("ID=\"dataGridMaster\" RemoteName=\"\"", "ID=\"dataGridMaster\" RemoteName=\"" + FClientData.ProviderName + "\";"); //Context = Context.Replace("this.WMaster.Active = false;", "this.WMaster.Active = true;"); } else if (FClientData.Language == "vb") { Context = Context.Replace("Me.WMaster.RemoteName = Nothing", "Me.WMaster.RemoteName = \"" + FClientData.ProviderName + "\""); Context = Context.Replace("Me.WMaster.Active = False", "Me.WMaster.Active = True"); } if (FClientData.BaseFormName == "WMasterDetail3") { Context = Context.Replace("this.WView.RemoteName = null;", "this.WView.RemoteName = \"" + FClientData.ViewProviderName + "\";"); Context = Context.Replace("this.WView.Active = false;", "this.WView.Active = true;"); } else if (FClientData.BaseFormName == "VBWebCMasterDetail_VFG") { Context = Context.Replace("Me.WView.RemoteName = Nothing", "Me.WView.RemoteName = \"" + FClientData.ViewProviderName + "\""); Context = Context.Replace("Me.WView.Active = False", "Me.WView.Active = True"); } System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs); SW.Write(Context); SW.Close(); Filefs.Close(); //WebDataSource Master NotifyRefresh(1000); //GetSchema if (FWizardDataSet != null) FWizardDataSet.Dispose(); FWizardDataSet = new InfoDataSet(true); FWizardDataSet.RemoteName = FClientData.ProviderName; FWizardDataSet.Active = true; FWizardDataSet.ServerModify = false; FWizardDataSet.PacketRecords = 100; FWizardDataSet.AlwaysClose = false; #if VS90 object oMaster = FDesignerDocument.webControls.item("Master", 0); if (oMaster != null && oMaster is WebDevPage.IHTMLElement) { ((WebDevPage.IHTMLElement)oMaster).setAttribute("DataMember", FClientData.TableName, 0); } //SaveWebDataSet(FWizardDataSet); //EditPoint ep1 = FTextWindow.ActivePane.StartPoint.CreateEditPoint(); //EditPoint ep2 = null; //TextRanges textRanges = FTextWindow.Selection.TextRanges; //if (ep1.FindPattern("InfoLight:WebDataSource ID=\"Master\"", (int)vsFindOptions.vsFindOptionsMatchWholeWord, ref ep2, ref textRanges)) //{ // ep1.WordRight(7); // ep1.Insert("DataMember=\"" + FClientData.TableName + "\" "); //} #else WebDataSource Master = (WebDataSource)FPage.FindControl("Master"); Master.DataMember = FClientData.TableName; IComponentChangeService FComponentChangeService = (IComponentChangeService)FDesignerHost.RootComponent.Site.GetService(typeof(IComponentChangeService)); FComponentChangeService.OnComponentChanged(Master, null, "", "M"); #endif }
private String GetTableNameByRelationName(InfoDataSet aDataSet, DataRelationCollection Relations, String RelationName) { String Result = ""; if (aDataSet != null) { if (aDataSet.RealDataSet.Tables[0].TableName.CompareTo(RelationName) == 0) Result = RelationName; if (Result == "") Result = GetTableNameByRelationName(null, aDataSet.RealDataSet.Relations, RelationName); } else { foreach (DataRelation Relation in Relations) { if (Relation.RelationName.CompareTo(RelationName) == 0) return Relation.ChildTable.TableName; Result = GetTableNameByRelationName(null, Relation.ChildTable.ChildRelations, RelationName); if (Result != "") return Result; } } return Result; }
private void btnDone_Click(object sender, EventArgs e) { ClearAllListViewSort(); SetValue(); SetValue_D(); if (FClientData.IsMasterDetailBaseForm()) { if (FClientData.BaseFormName == "JQueryMasterDetail1" || FClientData.BaseFormName == "JQueryMasterDetail2" || FClientData.BaseFormName == "VBJQueryMasterDetail1" || FClientData.BaseFormName == "VBJQueryMasterDetail2") AddBlockItem("View", FClientData.ProviderName, FClientData.TableName, lvViewDesField); AddBlockItem("Master", FClientData.ProviderName, FClientData.TableName, lvMasterDesField); AddDetailBlockItem("Master", tvRelation.Nodes, lvSelectedFields); } else { if (FClientData.BaseFormName == "JQuerySingle2" || FClientData.BaseFormName == "VBJQuerySingle2") AddBlockItem("View", FClientData.ProviderName, FClientData.TableName, lvViewDesField); AddBlockItem("Main", FClientData.ProviderName, FClientData.TableName, lvMasterDesField); } Hide(); FDTE2.MainWindow.Activate(); DoGenClient(); FInfoDataSet.Dispose(); FInfoDataSet = null; }
private void InitComponentList(Type ObjectType, ListView aListView, EventHandler aClick, ComboBox aComboBox) { aListView.BeginUpdate(); foreach (Object Obj in FTemplateForm.Container.Components) { if (Obj is Component) { Component Comp = Obj as Component; if (Comp.GetType().Equals(ObjectType)) { ListViewItem Item = aListView.Items.Add(Comp.Site.Name); Item.Tag = Comp; if (aComboBox != null) { aComboBox.Items.Add(Comp.Site.Name); cbViewBindingSource.Items.Add(Comp.Site.Name); } if (ObjectType.Equals(typeof(InfoBindingSource))) { InfoBindingSource bBindingSource = FClientData.FindBindingSource(Comp.Site.Name); if (bBindingSource == null) { bBindingSource = new InfoBindingSource(FContainer); FClientData.BindingSourceList.Add(bBindingSource); } bBindingSource.Site.Name = Comp.Site.Name; if (((InfoBindingSource)Comp).DataSource is InfoDataSet) bBindingSource.text = ((InfoDataSet)((InfoBindingSource)Comp).DataSource).Site.Name; if (((InfoBindingSource)Comp).DataSource is InfoBindingSource) bBindingSource.text = ((InfoBindingSource)((InfoBindingSource)Comp).DataSource).Site.Name; } if (ObjectType.Equals(typeof(InfoDataSet))) { InfoDataSet aDataSet = FClientData.FindDataSet(Comp.Site.Name); if (aDataSet == null) { aDataSet = new InfoDataSet(FContainer); FClientData.DataSetList.Add(aDataSet); } aDataSet.SetWizardDesignMode(true); aDataSet.Site.Name = Item.Text; } Item.SubItems.Add(""); ListViewItem.ListViewSubItem LVSI = Item.SubItems.Add(""); CreateRefValButton(Item, LVSI, aClick); } } } FixupBindingSourceReference(); aListView.EndUpdate(); }
private void tbProviderName_TextChanged(object sender, EventArgs e) { string ProviderName = tbProviderName.Text; if (ProviderName.Trim() == "") return; if (FInfoDataSet != null && FInfoDataSet.Active) { FInfoDataSet.Active = false; FInfoDataSet.Dispose(); FInfoDataSet = null; FInfoDataSet = new InfoDataSet(); FInfoDataSet.SetWizardDesignMode(true); } FInfoDataSet.RemoteName = ProviderName; FInfoDataSet.ClearWhere(); FInfoDataSet.SetWhere("1=0"); FInfoDataSet.Active = true; tbTableName.Text = FInfoDataSet.RealDataSet.Tables[0].TableName; String DataSetName = FInfoDataSet.RealDataSet.Tables[0].TableName; String ModuleName = FInfoDataSet.RemoteName.Substring(0, FInfoDataSet.RemoteName.IndexOf('.')); String SolutionName = System.IO.Path.GetFileNameWithoutExtension(_dte2.Solution.FullName); tbTableNameF.Text = CliUtils.GetTableName(ModuleName, DataSetName, SolutionName, "", true); string DllName = tbProviderName.Text; int Index = DllName.IndexOf('.'); DllName = DllName.Substring(0, Index + 1); ShowTableRelations(ModuleName, SolutionName); }
private void SetFieldNamesByProvider(String TableName, String ProviderName, ListView aListView) { if (ProviderName == null || ProviderName.Trim() == "") return; InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType); aInfoCommand.Connection = InternalConnection; TableName = WzdUtils.RemoveQuote(TableName, FClientData.DatabaseType); aInfoCommand.CommandText = "Select * from COLDEF where TABLE_NAME = '" + TableName + "'"; IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand); DataSet dsColdef = new DataSet(); WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, dsColdef, TableName); aListView.Items.Clear(); InfoDataSet aDataSet = new InfoDataSet(); try { aDataSet.SetWizardDesignMode(true); aDataSet.RemoteName = ProviderName; aDataSet.AlwaysClose = true; aDataSet.Active = true; DataTable Table = aDataSet.RealDataSet.Tables[0]; foreach (DataColumn Column in Table.Columns) { ListViewItem aItem = new ListViewItem(Column.ColumnName); DataRow[] DRS = dsColdef.Tables[0].Select("FIELD_NAME='" + Column.ColumnName + "'"); if (DRS.Length == 1) aItem.SubItems.Add(DRS[0]["CAPTION"].ToString()); else aItem.SubItems.Add(""); aListView.Items.Add(aItem); TBlockFieldItem aFieldItem = new TBlockFieldItem(); aFieldItem.DataField = Column.ColumnName; aItem.Tag = aFieldItem; } } finally { aDataSet.Dispose(); } }
/// <summary> /// Create a new instance of DataSourceItem /// </summary> public DataSourceItem() { _DataSource = new InfoDataSet(); _Caption = string.Empty; _DataMember = string.Empty; _ImageColumns = new DataSourceImageColumnCollections(this, typeof(DataSourceImageColumnItem)); }
private void btnSelectProvider_Click(object sender, EventArgs e) { InfoDataSet aDataSet = new InfoDataSet(FContainer); IGetValues aItem = (IGetValues)aDataSet; String[] FProviderNameList = aItem.GetValues("RemoteName"); String strSelected = ""; PERemoteName form = new PERemoteName(FProviderNameList, strSelected); if (form.ShowDialog() == DialogResult.OK) { ListViewItem ViewItem = (ListViewItem)((Button)sender).Tag; ViewItem.SubItems[1].Text = form.RemoteName; InfoDataSet bDataSet = FClientData.FindDataSet(ViewItem.Text); bDataSet.RealDataSet.Tables.Clear(); bDataSet.RemoteName = form.RemoteName; bDataSet.SetWizardDesignMode(true); bDataSet.Active = true; } }
private void btnDone_Click(object sender, EventArgs e) { if (FClientData.BaseFormName == "") { MessageBox.Show("Web path cannot be empty!"); return; } Hide(); FDTE2.MainWindow.Activate(); DoGenClient(); FInfoDataSet.Dispose(); FInfoDataSet = null; }
private InfoDataSet DoGetRoot(InfoDataSet RootDataSet, DataRelationCollection Relations, String DataSetName) { foreach (DataRelation Relation in Relations) { if (Relation.ChildTable.TableName.CompareTo(DataSetName) == 0) { return RootDataSet; } DoGetRoot(RootDataSet, Relation.ChildTable.ChildRelations, DataSetName); } return null; }
private void SetFieldNamesByProvider(String TableName, String ProviderName, ListView aListView) { if (ProviderName == null || ProviderName.Trim() == "") return; InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType); aInfoCommand.Connection = InternalConnection; String OWNER = String.Empty, SS = TableName; if (SS.Contains(".")) { OWNER = WzdUtils.GetToken(ref SS, new char[] { '.' }); TableName = SS; } aInfoCommand.CommandText = "Select * from COLDEF where TABLE_NAME='" + TableName + "' OR TABLE_NAME='" + OWNER + "." + TableName + "'"; IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand); DataSet dsColdef = new DataSet(); WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, dsColdef, TableName); aListView.Items.Clear(); InfoDataSet aDataSet = new InfoDataSet(); try { aDataSet.SetWizardDesignMode(true); aDataSet.RemoteName = ProviderName; aDataSet.AlwaysClose = true; aDataSet.Active = true; DataTable Table = aDataSet.RealDataSet.Tables[0]; foreach (DataColumn Column in Table.Columns) { ListViewItem aItem = new ListViewItem(Column.ColumnName); DataRow[] DRS = dsColdef.Tables[0].Select("FIELD_NAME='" + Column.ColumnName + "'"); TBlockFieldItem aFieldItem = new TBlockFieldItem(); if (DRS.Length > 0) { aItem.SubItems.Add(DRS[0]["CAPTION"].ToString()); aFieldItem.Description = DRS[0]["CAPTION"].ToString(); aFieldItem.QueryMode = DRS[0]["QUERYMODE"].ToString(); if (DRS[0]["IS_KEY"] != null && DRS[0]["IS_KEY"].ToString() == "Y") aFieldItem.IsKey = true; } else { aItem.SubItems.Add(""); aFieldItem.Description = ""; } aListView.Items.Add(aItem); aFieldItem.DataField = Column.ColumnName; aFieldItem.DataType = Column.DataType; if (DRS.Length > 0 && DRS[0]["CAPTION"] != null) aItem.Tag = aFieldItem; } } finally { aDataSet.Dispose(); } }
private void tbComboRemoteName_TextChanged(object sender, EventArgs e) { string ProviderName = tbComboRemoteName.Text; if (ProviderName.Trim() == "") return; InfoDataSet temp = new InfoDataSet(); temp.SetWizardDesignMode(true); temp.RemoteName = ProviderName; temp.SetWhere("1=0"); temp.Active = true; tbComboTableName.Text = temp.RealDataSet.Tables[0].TableName; String DataSetName = temp.RealDataSet.Tables[0].TableName; String ModuleName = temp.RemoteName.Substring(0, temp.RemoteName.IndexOf('.')); String SolutionName = System.IO.Path.GetFileNameWithoutExtension(FDTE2.Solution.FullName); tbComboTableName_F.Text = CliUtils.GetTableName(ModuleName, DataSetName, SolutionName, "", true); tbComboTableName_F.Text = WzdUtils.RemoveQuote(tbComboTableName_F.Text, FClientData.DatabaseType); cbDataValueField.Items.Clear(); cbDataTextField.Items.Clear(); DataTable dtTableSchema = temp.RealDataSet.Tables[0]; foreach (DataColumn item in dtTableSchema.Columns) { cbDataValueField.Items.Add(item.ColumnName); cbDataTextField.Items.Add(item.ColumnName); } if (InternalConnection.State != ConnectionState.Open) InternalConnection.Open(); DataSet ds = new DataSet(); try { DbCommand comm = InternalConnection.CreateCommand(); comm.CommandText = "SELECT * FROM SYS_REFVAL WHERE REFVAL_NO='Auto." + tbComboTableName_F.Text + "'"; IDbDataAdapter da = WzdUtils.AllocateDataAdapter(FClientData.DatabaseType); da.SelectCommand = comm; da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { cbDataValueField.Text = ds.Tables[0].Rows[0]["VALUE_MEMBER"] == null ? String.Empty : ds.Tables[0].Rows[0]["VALUE_MEMBER"].ToString(); cbDataTextField.Text = ds.Tables[0].Rows[0]["DISPLAY_MEMBER"] == null ? String.Empty : ds.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString(); } } catch (SqlException sex) { if (sex.Number == 208) { string sSysDBAlias = WzdUtils.GetSystemDBName(); ClientType sSysDBType = WzdUtils.GetSystemDBType(); DbConnection sysConn = WzdUtils.AllocateConnection(sSysDBAlias, sSysDBType, false); if (sysConn.State != ConnectionState.Open) sysConn.Open(); DbCommand comm = sysConn.CreateCommand(); comm.CommandText = "SELECT * FROM SYS_REFVAL WHERE REFVAL_NO='Auto." + tbComboTableName_F.Text + "'"; IDbDataAdapter da = WzdUtils.AllocateDataAdapter(sSysDBType); da.SelectCommand = comm; da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { cbDataValueField.Text = ds.Tables[0].Rows[0]["VALUE_MEMBER"] == null ? String.Empty : ds.Tables[0].Rows[0]["VALUE_MEMBER"].ToString(); cbDataTextField.Text = ds.Tables[0].Rows[0]["DISPLAY_MEMBER"] == null ? String.Empty : ds.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void frmDGVGridRefVal_FormClosed(object sender, FormClosedEventArgs e) { if (!bCloseEventArises) { this.RefVal.Close(new OnCloseEventArgs()); bCloseEventArises = true; } dsAllData = (InfoDataSet)this.DataSource.GetDataSource(); //if (!bClearWhere) //{ if (this.RefVal.SelectCommand == null || this.RefVal.SelectCommand == "") { dsAllData.ClearWhere(); } else { //modified by lily 2007/3/13 RefVal.SelectAlias-->null,for runtime loginDB is the right db. dsAllData.Execute(RefVal.SelectCommand, null, true); } //} }
private void tbProviderName_TextChanged(object sender, EventArgs e) { string ProviderName = tbProviderName.Text; if (ProviderName.Trim() == "") return; ClearAll(); if (FInfoDataSet != null && FInfoDataSet.Active) { FInfoDataSet.Active = false; FInfoDataSet.Dispose(); FInfoDataSet = null; FInfoDataSet = new InfoDataSet(); FInfoDataSet.SetWizardDesignMode(true); } FInfoDataSet.RemoteName = ProviderName; FInfoDataSet.ClearWhere(); FInfoDataSet.SetWhere("1=0"); FInfoDataSet.Active = true; tbTableName.Text = FInfoDataSet.RealDataSet.Tables[0].TableName; String DataSetName = FInfoDataSet.RealDataSet.Tables[0].TableName; String ModuleName = FInfoDataSet.RemoteName.Substring(0, FInfoDataSet.RemoteName.IndexOf('.')); String SolutionName = System.IO.Path.GetFileNameWithoutExtension(FDTE2.Solution.FullName); tbTableNameF.Text = CliUtils.GetTableName(ModuleName, DataSetName, SolutionName, "", true); tbTableNameF.Text = WzdUtils.RemoveQuote(tbTableNameF.Text, FClientData.DatabaseType); cbViewProviderName.Items.Clear(); string DllName = tbProviderName.Text; int Index = DllName.IndexOf('.'); DllName = DllName.Substring(0, Index + 1); for (int I = 0; I < FProviderNameList.Length; I++) { if (FProviderNameList[I].ToString().IndexOf(DllName) > -1) { cbViewProviderName.Items.Add(FProviderNameList[I]); } } cbViewProviderName.SelectedIndex = GetProviderIndex(); FClientData.ViewProviderName = cbViewProviderName.Text; ShowTableRelations(); }