public PaintObject <string, OracleParameter> CreatePaintObject(string storeName, Color connectorColor) { using (var ctrlSA = new SAController()) { DataContainer container; ctrlSA.ExecuteSQL(out container, "SELECT * FROM USER_ARGUMENTS WHERE OBJECT_NAME = '" + storeName + "' ORDER BY POSITION"); var table = container.DataTable; var oracleParams = (from DataRow row in table.Rows select new OracleParameter { ParameterName = (string)row["ARGUMENT_NAME"], ParameterType = (OracleParameterType)Enum.Parse(typeof(OracleParameterType), (string)row["IN_OUT"]) }).ToList(); var storePaintObject = new PaintObject <string, OracleParameter> { Title = storeName, Parent = storeName, Childs = (from oracleParam in oracleParams select oracleParam).ToList(), Icon = Resources.Database, BeginEnd = BeginEndMode.Begin, ConnectorColor = connectorColor }; storePaintObject.CustomLabel += storePaintObject_CustomLabel; return(storePaintObject); } }
public void ExecuteSearch(List <string> values) { CurrentThread = new WorkerThread( delegate { LockUserAction(); try { using (var ctrlSA = new SAController()) { string lastSearchResultKey; DateTime lastSearchTime; ctrlSA.ExecuteStatistics(out lastSearchResultKey, out lastSearchTime, ModuleInfo.ModuleID, ModuleInfo.SubModule, values); BufferResult = new BufferedResultManager(ModuleInfo, lastSearchResultKey, lastSearchTime); ExecuteFetchResult(); } } catch (Exception ex) { ShowError(ex); UnLockUserAction(); } }, this); CurrentThread.ProcessComplete += Execute_ProcessComplete; CurrentThread.Start(); }
public override void Execute() { if (ValidateModule()) { base.Execute(); try { using (var ctrlSA = new SAController()) { for (var i = 0; i < CheckMarksUtils.SelectedCount; i++) { var row = (DataRowView)CheckMarksUtils.GetSelectedRow(i); ctrlSA.ExecuteStoreProcedure("DEV_SP_DEFMODFLD_INS_" + this["C02"], new List <string> { (string)this["C01"], (string)row["FLDNAME"], (string)row["FLDTYPE"], (string)row["SCDTYPE"], (string)row["CTRLTYPE"] }); } } CloseModule(); } catch (Exception ex) { ShowError(ex); } } }
public SearchConditionInstance GetConditionInstance() { var instance = new SearchConditionInstance(); var objConditionInfo = (ModuleFieldInfo)m_Condition.EditValue; instance.ConditionID = objConditionInfo.FieldID; instance.Operator = m_Operator.EditValue.ToString(); instance.Value = m_EditValue.EditValue.Encode(objConditionInfo); if (string.IsNullOrEmpty(objConditionInfo.FunctionSCDValue) != true) { using (var ctrlSA = new SAController()) { List <string> values; DataContainer container = null; DataSet dsResult; values = new List <string>(); values.Add(objConditionInfo.FunctionSCDValue + "('" + instance.Value + "')"); ctrlSA.ExecuteProcedureFillDataset(out container, "sp_get_condition_value", values); dsResult = container.DataSet; if (dsResult.Tables.Count == 1) { instance.Value = dsResult.Tables[0].Rows[0][0].ToString(); } } } return(instance); }
private void ExportModules(string fileName) { try { var generatedModules = new List <string>(); foreach (ImageListBoxItem item in lstModule.SelectedItems) { using (var ctrlSA = new SAController()) { string generatedModule; if (item.Value is CodeInfo) { var code = item.Value as CodeInfo; ctrlSA.ExecuteGenerateModulePackage(code.CodeValue, out generatedModule); generatedModules.Add(generatedModule); } if (item.Value is ModuleInfo) { var module = item.Value as ModuleInfo; ctrlSA.ExecuteGenerateModulePackage(module.ModuleID, out generatedModule); generatedModules.Add(generatedModule); } } } var serilizer = new XmlSerializer(typeof(List <string>)); var stream = File.Open(fileName, FileMode.Create, FileAccess.Write); serilizer.Serialize(stream, generatedModules); stream.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadSkins() { DataContainer container; DataContainer containerSkins; using (var ctrlSA = new SAController()) { ctrlSA.ExecuteLoadSkins(out container); var dsResult = container.DataSet; ctrlSA.ExecuteLoadCurrentSkins(out containerSkins); var dsResultSkins = containerSkins.DataSet; BarManager barManagerSkins = new BarManager(); barManagerSkins.BeginUpdate(); barManagerSkins.Images = this.imageCollection2; barSubItem2.ClearLinks(); foreach (DataRow row in dsResult.Tables[0].Rows) { BarButtonItem item = new BarButtonItem(barManagerSkins, row[1].ToString(), Int32.Parse(row[0].ToString()) - 1); barSubItem2.AddItem(item); if (row[1].ToString() == dsResultSkins.Tables[0].Rows[0][0].ToString()) { item.Enabled = false; } } barManagerSkins.ItemClick += new ItemClickEventHandler(barManagerSkins_ItemClick); barManagerSkins.EndUpdate(); } }
private void btnSave_Click(object sender, EventArgs e) { #if DEBUG CurrentThread = new WorkerThread( delegate { try { LockUserAction(); foreach (DataRow row in m_LanguageTable.Rows) { if (row["LANGVALUE"] != null && row["LANGVALUE"] != DBNull.Value && !string.IsNullOrEmpty(row["LANGVALUE"].ToString())) { using (var ctrlSA = new SAController()) { ctrlSA.ExecuteSaveLanguage(row["LANGID"].ToString(), row["LANGNAME"].ToString(), row["LANGVALUE"].ToString()); } } } } catch (Exception ex) { ShowError(ex); } finally { UnLockUserAction(); } }, this); CurrentThread.ProcessComplete += CurrentThread_ProcessComplete; CurrentThread.Start(); #endif }
public override List <ModuleFieldInfo> BuildModuleFieldCache() { using (var ctrlSA = new SAController()) { return(ctrlSA.BuildModuleFieldsInfo()); } }
public override List <GroupSummaryInfo> BuildGroupSummaryCache() { using (var ctrlSA = new SAController()) { return(ctrlSA.BuildGroupSummaryInfo()); } }
public override List <ExportHeader> BuildExportHeaderCache() { using (var ctrlSA = new SAController()) { return(ctrlSA.BuildExportHeaderInfo()); } }
public override List <LanguageInfo> BuildLanguageCache() { using (var ctrlSA = new SAController()) { return(ctrlSA.BuildLanguageInfo()); } }
public override List <OracleParam> BuildOracleParamsCache() { using (var ctrlSA = new SAController()) { return(ctrlSA.BuildOracleParamsInfo()); } }
private void btnSave_Click(object sender, EventArgs e) { if (ValidateModule()) { new WorkerThread( delegate { try { LockUserAction(); using (var client = new SAController()) { string generatedPackage; client.ExecuteGenerateModulePackage((string)this["C01"], out generatedPackage); File.WriteAllText((string)this["C02"], generatedPackage, Encoding.UTF8); } CloseModule(); } catch (Exception ex) { ShowError(ex); UnLockUserAction(); } } , this).Start(); } }
protected override void InitializeModuleData() { base.InitializeModuleData(); try { lbTitle.Text = string.Format("Store procedure \"{0}\"", this["P01"]); GetStoreSource(); using (var ctrlSA = new SAController()) { DataContainer container; reMain.BeginPaintObjects = new List <AbstractPaintObject> { CreatePaintObject((string)this["P01"], Color.Blue) }; reMain.EndPaintObjects = new List <AbstractPaintObject>(); ctrlSA.ExecuteSQL(out container, "SELECT * FROM USER_TABLES"); var table = container.DataTable; foreach (DataRow row in table.Rows) { cboTablesName.Properties.Items.Add(row["TABLE_NAME"]); } } } catch (Exception ex) { ShowError(ex); } }
private void txtPassword_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { using (var ctrlSA = new SAController()) { Session session; ctrlSA.CreateUserSession(out session, txtUsername.Text, txtPassword.Text); MainProcess.LoginToSystem(session); if (session.ChkLog == 1) { frmInfo.ShowWarning("Error System", "Tài khoản của bạn đăng nhập lần đầu hoặc mật khẩu của bạn đã hết hạn. \n Bạn nên thay đổi mật khẩu để đảm bảo an toàn bảo mật khi sử dụng hệ thống !", this); MainProcess.ExecuteModule("02913", "MAD"); } } CloseModule(); } catch (Exception ex) { ActiveControl = txtUsername; txtPassword.Text = ""; //txtUsername.Focus(); txtPassword.Focus(); ShowError(ex); } } }
public override List <CodeInfo> BuildCodesInfoCache() { using (var ctrlSA = new SAController()) { return(ctrlSA.BuildCodesInfo()); } }
public override void ShowModule(IWin32Window owner) { // terminal last session try { var clientInfos = CachedUtils.GetCacheOf <ClientInfo>("LastSession"); if (clientInfos.Count > 0) { App.Environment.ClientInfo.SessionKey = clientInfos[0].SessionKey; using (var ctrlSA = new SAController()) { ctrlSA.TerminalCurrentSession(); } } } catch { } // login var frmOwner = (XtraForm)Parent; InitializeModuleData(); App.Environment.ClientInfo.SessionKey = null; frmOwner.ShowDialog(owner); if (App.Environment.ClientInfo.SessionKey == null) { MainProcess.Close(); } }
public override List <ButtonInfo> BuildSearchButtonsCache() { using (var ctrlSA = new SAController()) { return(ctrlSA.BuildSearchButtonsInfo()); } }
protected override void InitializeModuleData() { base.InitializeModuleData(); if (UserID != 0) { lbTitle.Text = string.Format(Language.Info, UserName); try { using (var ctrlSA = new SAController()) { ctrlSA.ListUserRoles(out m_Roles, UserID); foreach (var role in m_Roles) { role.TranslatedRoleName = Language.GetRoleName(role.RoleName); } roleTree.DataSource = m_Roles; UpdateCategory(roleTree.Nodes); } } catch (Exception ex) { ShowError(ex); CloseModule(); } #if !DEBUG colRoleID.Visible = false; #endif } }
//#if DEBUG public static void ForceLoad(string moduleID) { using (var ctrlSA = new SAController()) { List <ModuleInfo> modulesInfo; List <ModuleFieldInfo> moduleFieldsInfo; List <ButtonInfo> buttonsInfo; List <ButtonParamInfo> buttonParamsInfo; List <LanguageInfo> languageInfo; List <OracleParam> oracleParamsInfo; ctrlSA.ForceLoadModule( out modulesInfo, out moduleFieldsInfo, out buttonsInfo, out buttonParamsInfo, out languageInfo, out oracleParamsInfo, moduleID); ModuleUtils.ForceLoad( moduleID, modulesInfo, moduleFieldsInfo, buttonsInfo, buttonParamsInfo, languageInfo, oracleParamsInfo); return; } }
protected override void InitializeModuleData() { base.InitializeModuleData(); List <string> values = null; values = new List <string>(); //values.Add(Program.treeModuleID.ToString()); values.Add(ModuleInfo.ModuleID); using (var ctrlSA = new SAController()) { DataContainer con; ctrlSA.GetTreeStore(out con, values); AssignFieldValuesFromResult(con); DataTable dt = con.DataTable; SYSTEM_STORE_PROCEDURES.MODULE_TREE = dt.Rows[0][0].ToString(); } try { LoadData(SYSTEM_STORE_PROCEDURES.MODULE_TREE); } catch { CloseModule(); throw; } finally { StopCallback = false; } }
public void StartupModules() { if (App.Environment.ClientInfo.SessionKey != null) { ThemeUtils.ChangeSkin(App.Environment.ClientInfo.UserProfile.ApplicationSkinName); foreach (var module in AllCaches.ModulesInfo) { if (module.StartMode == CODES.DEFMOD.STARTMODE.AUTOMATIC) { try { using (var ctrlSA = new SAController()) { ctrlSA.CheckRole(module); var startupModule = CreateModuleInstance(module.ModuleID, module.SubModule); startupModule.ShowModule(m_mainForm); } } catch (FaultException ex) { if (ex.Code.Name != ERR_SYSTEM.ERR_SYSTEM_MODULE_NOT_ALLOW_ACCESS.ToString()) { frmInfo.ShowError(((IMain)m_mainForm).Language.ApplicationTitle, ex, m_mainForm); } } catch (Exception ex) { frmInfo.ShowError(((IMain)m_mainForm).Language.ApplicationTitle, ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_UNKNOWN, ex.Message), m_mainForm); } } } } }
private void RefreshModules() { using (var ctrlSA = new SAController()) { lstModule.BeginUpdate(); lstModule.Items.Clear(); ctrlSA.ListModuleInfo(out m_Modules); var groupModules = (from module in m_Modules group module by module.ModuleID into groupModule select groupModule); foreach (var modtype in CodeUtils.GetCodes("DEFMOD", "MODTYPE")) { if (modtype.CodeValueName.Contains(txtFilter.Text.ToUpper()) || (txtFilter.Text == "?TYPE")) { lstModule.Items.Add(new ImageListBoxItem(modtype, Language.ModuleTypeImageIndex)); } } foreach (var groupModule in groupModules) { if (groupModule.First().ModuleName.Contains(txtFilter.Text.ToUpper())) { lstModule.Items.Add(new ImageListBoxItem(groupModule.First(), Language.ModuleImageIndex)); } } lstModule.EndUpdate(); } }
private void ExecuteReportAndSendMail() { CurrentThread = new WorkerThread( delegate { LockUserAction(); DataContainer container; try { using (SAController ctrlSA = new SAController()) { List <string> Values; GetOracleParameterValues(out Values, ReportInfo.StoreName); ctrlSA.ExecuteMaintainReport(out container, ModuleInfo.ModuleID, ModuleInfo.SubModule, Values); // Show success frmInfo.ShowInfo("Gửi Email sao kê", "Đã gửi sao kê thành công !", this); CloseModule(); } } catch (FaultException ex) { ShowError(ex); } catch (Exception ex) { ShowError(ex); } finally { UnLockUserAction(); } }, this); CurrentThread.Start(); }
private void lookUpEdit1_EditValueChanged(object sender, EventArgs e) { if (textEdit1.Text != "") { textEdit1.Text = "[" + lookUpEdit1.EditValue + "] == "; } CurrentExpress = ""; using (var ctrlSA = new SAController()) { string fldid = Regex.Split(textEdit1.Text, "==")[0].Trim().Replace("[", "").Replace("]", ""); List <string> values = new List <string>(); values.Add(fldid); DataContainer con; ctrlSA.ExecuteProcedureFillDataset(out con, "sp_formular_selbyfldid", values); AssignFieldValuesFromResult(con); DataTable dt = con.DataTable; if (dt.Rows.Count > 0) { string formula = dt.Rows[0]["FORMULA"].ToString(); DataTable dtSource = (DataTable)gridControl1.DataSource; for (int i = 0; i < dtSource.Rows.Count; i++) { formula = formula.Replace("[" + dtSource.Rows[i]["RPTFLDID"].ToString() + "]", "[" + dtSource.Rows[i]["VALUE"].ToString() + "]"); } convertExpression(formula); textEdit1.Text = textEdit1.Text + formula; } } }
protected override void SetDefaultValues(List <ModuleFieldInfo> fields) { base.SetDefaultValues(fields); foreach (var field in fields) { if (field.DefaultValue != null && field.ControlType != CODES.DEFMODFLD.CTRLTYPE.CHECKEDCOMBOBOX) { switch (field.FieldGroup) { case CODES.DEFMODFLD.FLDGROUP.COMMON: this[field.FieldID] = FieldUtils.Convert(field, field.DefaultValue); break; } } else if (field.DefaultValue != null && field.ControlType == CODES.DEFMODFLD.CTRLTYPE.CHECKEDCOMBOBOX) { using (var ctrlSA = new SAController()) { List <string> values; DataContainer con; GetOracleParameterValues(out values, field.DefaultValue); ctrlSA.ExecuteProcedureFillDataset(out con, field.DefaultValue, values); var dsResult = con.DataSet; this[field.FieldID] = FieldUtils.Convert(field, dsResult.Tables[0].Rows[0][0].ToString()); } } } }
public void GetFullBuffer() { Clear(); var fromRow = 0; using (var ctrlSA = new SAController()) { DataTable tempTable; do { DataContainer container; ctrlSA.FetchAllSearchResult(out container, ModuleInfo.ModuleID, ModuleInfo.SubModule, LastSearchResultKey, LastSearchTime, fromRow); if (Rows.Count == 0) { container.BuildSchema(this, ColumnFields); } tempTable = container.GetTable(ColumnFields); if (tempTable.Rows.Count > 0) { fromRow = fromRow + tempTable.Rows.Count; foreach (DataRow row in tempTable.Rows) { ImportRow(row); } } }while (tempTable.Rows.Count > 0); m_BufferSize = Rows.Count; AcceptChanges(); } }
private void btnClose_Click(object sender, EventArgs e) { Program.txnum = null; if (MaintainInfo.ModuleID == "02913") { MainProcess.LogoutFromSystem(true); } if (MaintainInfo.Report == CODES.MODMAINTAIN.REPORT.FILE) { if (!string.IsNullOrEmpty(filetempname)) { DeleteFile(filetempname); } using (var ctrlSA = new SAController()) { List <string> values = new List <string>(); //values.Add(Program.FileName); ctrlSA.ExecuteStoreProcedure("sp_delfile_all", values); CloseModule(); } } else { CloseModule(); } }
public void ClearLog() { var w = new WorkerThread(delegate(WorkerThread worker) { LockUserAction(); try { using (var client = new SAController()) { m_SystemLog = client.GetSystemLog(true); worker.ExecuteUpdateGUI(); } } catch { } finally { UnLockUserAction(); } }, this); w.DoUpdateGUI += worker_DoUpdateGUI; w.Start(); }
private void cboTablesName_SelectedValueChanged(object sender, EventArgs e) { using (var ctrlSA = new SAController()) { var tableName = (string)cboTablesName.EditValue; reMain.EndPaintObjects.Clear(); DataContainer container; ctrlSA.ExecuteSQL(out container, "SELECT * FROM USER_TAB_COLS WHERE TABLE_NAME = '" + tableName + "' ORDER BY COLUMN_ID"); var table = container.DataTable; var tablePaintObject = new PaintObject <string, ColumnInfo> { BeginEnd = BeginEndMode.End, Childs = (from DataRow row in table.Rows select new ColumnInfo { ColumnType = ColumnType.COLUMN, ColumnName = (string)row["COLUMN_NAME"] }).ToList(), ConnectorColor = Color.Red, Icon = Resources.Database, Parent = tableName, Title = tableName }; tablePaintObject.CustomLabel += tablePaintObject_CustomLabel; reMain.EndPaintObjects.Add(tablePaintObject); } }