/** INSTANCE METHODS **/ public bool Save() { // Get the Display Name if (DisplayName.Trim() == String.Empty) { this.DisplayName = GetDisplayName(this.Username); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); if (Id <= DefaultValues.GetUserIdMinValue()) { int TempId = DBLayer.CreateNewUser(this); if (TempId > 0) { _Id = TempId; return(true); } else { return(false); } } else { return(DBLayer.UpdateUser(this)); } }
public MenuInfo Load(string string_2) { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); DataTable table = dataAccessLayer.ExecuteDataTable("select * from " + this.string_0 + " where MenuID=" + string_2); MenuInfo info = null; if (table.Rows.Count > 0) { DataRow row = table.Rows[0]; info = new MenuInfo { MenuID = Convert.ToString(row["MenuID"]) }; object obj1 = row["NAME"]; info.NAME = Convert.ToString(row["NAME"]); info.ORDERBY = new int?(!(row["ORDERBY"] is DBNull) ? Convert.ToInt32(row["ORDERBY"]) : -1); info.PROGID = Convert.ToString(row["PROGID"]); info.SHORTCUT = Convert.ToString(row["SHORTCUT"]); info.SUBTYPE = new int?(!(row["SUBTYPE"] is DBNull) ? Convert.ToInt32(row["SUBTYPE"]) : -1); info.VISIBLE = new bool?(!(row["VISIBLE"] is DBNull) ? (Convert.ToInt32(row["VISIBLE"]) == 1) : true); info.ItemCol = new int?(!(row["ItemCol"] is DBNull) ? Convert.ToInt32(row["ItemCol"]) : -1); info.ISPOPMENUITEM = new bool?(!(row["ISPOPMENUITEM"] is DBNull) ? (Convert.ToInt32(row["ISPOPMENUITEM"]) == 1) : false); info.COMPONENTDLLNAME = Convert.ToString(row["COMPONENTDLLNAME"]); info.CLASSNAME = Convert.ToString(row["CLASSNAME"]); info.BEGINGROUP = new bool?(!(row["BEGINGROUP"] is DBNull) ? (Convert.ToInt32(row["BEGINGROUP"]) == 1) : false); info.CAPTION = Convert.ToString(row["CAPTION"]); info.PARENTIDS = Convert.ToString(row["PARENTIDS"]); } dataAccessLayer.Close(); return(info); }
/// <summary> /// Actualiza el estado de la transacción pendiente a procesada. /// </summary> /// <param name="transaccion">Datos de la Transacción</param> /// <returns> /// Retorna cero si se ha guardado correctamente, valor distinto a cero /// si se presenta algún error. /// </returns> private string ActualizarTransaccion(ETransaccion transaccion) { string sres = string.Empty; int nres = 0; try { DataAccessLayerBaseClass dal = DataAccessLayerFactory.GetDataAccessLayer(); IDataParameter[] opar = new IDataParameter[4]; opar[0] = dal.CreateParameter("presult", ParameterDirection.Output, nres, DbType.Int32, null, 0); opar[1] = dal.CreateParameter("pmessage", ParameterDirection.Output, sres, DbType.String, null, 0); opar[2] = dal.CreateParameter("pidtransaccion", ParameterDirection.Input, transaccion.IdTransaccion, DbType.Guid, null, 0); opar[3] = dal.CreateParameter("pestado", ParameterDirection.Input, 1, DbType.Double, null, 0); int dae = dal.ExecuteQuery("sp_update_ps_transaccion", CommandType.StoredProcedure, opar); } catch (Exception ex) { sres = "201"; Logger.ErrorLog.RegErrorDB(Logger.NivelDeError.Cinco, sres, this.ToString(), "sp_update_ps_transaccion", ex.Message + "|" + ex.StackTrace); } return(sres); }
/*** STATIC METHODS ***/ public static bool SaveQuery(string username, int projectId, string queryName, QueryClauseCollection queryClauses) { if (username == null || username.Length == 0) { throw new ArgumentOutOfRangeException("username"); } if (projectId <= DefaultValues.GetProjectIdMinValue()) { throw new ArgumentOutOfRangeException("projectId"); } if (queryName == null || queryName.Length == 0) { throw new ArgumentOutOfRangeException("queryName"); } if (queryClauses.Count == 0) { throw new ArgumentOutOfRangeException("queryClauses"); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.SaveQuery(username, projectId, queryName, queryClauses)); }
public MenuInfo GetByClassName(string string_2, string string_3) { MenuInfo menuInfo = null; try { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); DataTable dataTable = dataAccessLayer.ExecuteDataTable(string.Concat(new string[] { "select * from ", this.string_0, " where COMPONENTDLLNAME='", string_2, "' and CLASSNAME='", string_3, "'" })); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.Rows[0]; menuInfo = new MenuInfo(); menuInfo.MenuID = System.Convert.ToString(dataRow["MenuID"]); menuInfo.NAME = System.Convert.ToString(dataRow["NAME"]); object arg_C4_0 = dataRow["ORDERBY"]; menuInfo.ORDERBY = new int?((!(dataRow["ORDERBY"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["ORDERBY"]) : -1); menuInfo.PROGID = System.Convert.ToString(dataRow["PROGID"]); menuInfo.SHORTCUT = System.Convert.ToString(dataRow["SHORTCUT"]); menuInfo.SUBTYPE = new int?((!(dataRow["SUBTYPE"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["SUBTYPE"]) : -1); menuInfo.VISIBLE = new bool?(dataRow["VISIBLE"] is System.DBNull || System.Convert.ToInt32(dataRow["VISIBLE"]) == 1); menuInfo.ItemCol = new int?((!(dataRow["ItemCol"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["ItemCol"]) : -1); menuInfo.ISPOPMENUITEM = new bool?(!(dataRow["ISPOPMENUITEM"] is System.DBNull) && System.Convert.ToInt32(dataRow["ISPOPMENUITEM"]) == 1); menuInfo.COMPONENTDLLNAME = System.Convert.ToString(dataRow["COMPONENTDLLNAME"]); menuInfo.CLASSNAME = System.Convert.ToString(dataRow["CLASSNAME"]); menuInfo.BEGINGROUP = new bool?(!(dataRow["BEGINGROUP"] is System.DBNull) && System.Convert.ToInt32(dataRow["BEGINGROUP"]) == 1); menuInfo.CAPTION = System.Convert.ToString(dataRow["CAPTION"]); menuInfo.PARENTIDS = System.Convert.ToString(dataRow["PARENTIDS"]); } dataAccessLayer.Close(); } catch { } return(menuInfo); }
public void Update(MenuInfo menuInfo_0) { string str = string.Format("update {0} set PARENTIDS='{1}' where MenuID={2}", this.string_0, string.IsNullOrEmpty(menuInfo_0.PARENTIDS) ? "NULL" : ("'" + menuInfo_0.PARENTIDS + "'"), menuInfo_0.MenuID); DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); dataAccessLayer.ExecuteNonQuery(CommandType.Text, str); dataAccessLayer.Close(); }
public static bool DeleteQuery(int queryId) { if (queryId <= DefaultValues.GetQueryIdMinValue()) { throw new ArgumentOutOfRangeException("queryId"); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.DeleteQuery(queryId)); }
public static bool SaveCustomFieldValues(int issueId, CustomFieldCollection fields) { if (fields == null) { throw (new ArgumentOutOfRangeException("fields")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.SaveCustomFieldValues(issueId, fields)); }
/*** STATIC METHODS ***/ public static bool DeleteCategory(int categoryId) { if (categoryId <= DefaultValues.GetCategoryIdMinValue()) { throw (new ArgumentOutOfRangeException("categoryId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.DeleteCategory(categoryId)); }
public static bool DeletePriority(int priorityId) { if (priorityId <= DefaultValues.GetPriorityIdMinValue()) { throw (new ArgumentOutOfRangeException("priorityId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.DeletePriority(priorityId)); }
public static ITUser GetUserByUsername(string username) { if (username == null || username.Length == 0) { throw (new ArgumentOutOfRangeException("username")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.GetUserByUsername(username)); }
public static IssueCollection PerformQuery(int projectId, QueryClauseCollection queryClauses) { if (queryClauses.Count == 0) { throw new ArgumentOutOfRangeException("queryClauses"); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.PerformQuery(projectId, queryClauses)); }
public static IssueCollection PerformSavedQuery(int projectId, int queryId) { if (queryId <= DefaultValues.GetQueryIdMinValue()) { throw (new ArgumentOutOfRangeException("queryId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.PerformSavedQuery(projectId, queryId)); }
public static Issue GetIssueById(int issueId) { if (issueId <= DefaultValues.GetIssueIdMinValue()) { throw (new ArgumentOutOfRangeException("issueId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.GetIssueById(issueId)); }
public static bool DeleteStatus(int statusId) { if (statusId <= DefaultValues.GetStatusIdMinValue()) { throw (new ArgumentOutOfRangeException("statusId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.DeleteStatus(statusId)); }
/*** STATIC METHODS ***/ public static bool DeleteIssueNotification(int issueId, string username) { if (issueId <= DefaultValues.GetIssueIdMinValue()) { throw (new ArgumentOutOfRangeException("issueId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.DeleteIssueNotification(issueId, username)); }
public static CategoryCollection GetCategoryByProjectId(int projectId) { if (projectId <= DefaultValues.GetProjectIdMinValue()) { throw (new ArgumentOutOfRangeException("projectId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.GetCategoriesByProjectId(projectId)); }
public static CustomFieldCollection GetCustomFieldsByIssueId(int issueId) { if (issueId <= DefaultValues.GetProjectIdMinValue()) { throw (new ArgumentOutOfRangeException("issueId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.GetCustomFieldsByIssueId(issueId)); }
public static MilestoneCollection GetMilestoneByProjectId(int milestoneId) { if (milestoneId <= DefaultValues.GetMilestoneIdMinValue()) { throw (new ArgumentOutOfRangeException("milestoneId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.GetMilestoneByProjectId(milestoneId)); }
/*** STATIC METHODS ***/ public static bool DeleteMilestone(int milestoneId) { if (milestoneId <= DefaultValues.GetMilestoneIdMinValue()) { throw (new ArgumentOutOfRangeException("milestoneId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.DeleteMilestone(milestoneId)); }
/*** STATIC METHODS ***/ public static IssueHistoryCollection GetIssueHistoryByIssueId(int issueId) { // validate input if (issueId <= DefaultValues.GetIssueIdMinValue()) { throw (new ArgumentOutOfRangeException("issueId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.GetIssueHistoryByIssueId(issueId)); }
public int Add(MenuInfo menuInfo_0) { if (!this.IsExist(menuInfo_0)) { string str = string.Format("insert into {0}([NAME],PARENTIDS,ORDERBY,[PROGID],[SHORTCUT],SUBTYPE,VISIBLE,ItemCol,ISPOPMENUITEM,COMPONENTDLLNAME,CLASSNAME,BEGINGROUP,CAPTION) values({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13})", new object[] { this.string_0, string.IsNullOrEmpty(menuInfo_0.NAME) ? "NULL" : ("'" + menuInfo_0.NAME + "'"), string.IsNullOrEmpty(menuInfo_0.PARENTIDS) ? "NULL" : ("'" + menuInfo_0.PARENTIDS + "'"), menuInfo_0.ORDERBY.HasValue ? menuInfo_0.ORDERBY.Value.ToString() : "NULL", string.IsNullOrEmpty(menuInfo_0.PROGID) ? "NULL" : ("'" + menuInfo_0.PROGID + "'"), string.IsNullOrEmpty(menuInfo_0.SHORTCUT) ? "NULL" : ("'" + menuInfo_0.SHORTCUT + "'"), menuInfo_0.SUBTYPE.HasValue ? menuInfo_0.SUBTYPE.Value.ToString() : "NULL", menuInfo_0.VISIBLE.HasValue ? (menuInfo_0.VISIBLE.Value ? "1" : "0") : "NULL", menuInfo_0.ItemCol.HasValue ? menuInfo_0.ItemCol.Value.ToString() : "NULL", menuInfo_0.ISPOPMENUITEM.HasValue ? (menuInfo_0.ISPOPMENUITEM.Value ? "1" : "0") : "NULL", string.IsNullOrEmpty(menuInfo_0.COMPONENTDLLNAME) ? "NULL" : ("'" + menuInfo_0.COMPONENTDLLNAME + "'"), string.IsNullOrEmpty(menuInfo_0.CLASSNAME) ? "NULL" : ("'" + menuInfo_0.CLASSNAME + "'"), menuInfo_0.BEGINGROUP.HasValue ? (menuInfo_0.BEGINGROUP.Value ? "1" : "0") : "NULL", string.IsNullOrEmpty(menuInfo_0.CAPTION) ? "NULL" : ("'" + menuInfo_0.CAPTION + "'") }); DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); dataAccessLayer.ExecuteNonQuery(CommandType.Text, str); dataAccessLayer.Close(); } return(0); }
public static void DeleteIssueAttachment(int attachmentId) { // validate input if (attachmentId <= DefaultValues.GetIssueAttachmentIdMinValue()) { throw (new ArgumentOutOfRangeException("attachmentId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); DBLayer.DeleteIssueAttachment(attachmentId); }
public static ProjectCollection GetProjectByMemberUsername(string username) { // validate input if (username == string.Empty) { throw (new ArgumentOutOfRangeException("username")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.GetProjectByMemberUsername(username)); }
public static Project GetProjectById(int projectId) { // validate input if (projectId <= 0) { throw (new ArgumentOutOfRangeException("projectId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.GetProjectById(projectId)); }
/*** STATIC METHODS ***/ public static bool DeleteProject(int projectId) { // validate input if (projectId <= DefaultValues.GetProjectIdMinValue()) { throw (new ArgumentOutOfRangeException("projectId")); } DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); return(DBLayer.DeleteProject(projectId)); }
public void ClearAll() { try { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); dataAccessLayer.ExecuteNonQuery("delete from " + this.string_0, new object[0]); dataAccessLayer.Close(); } catch { } }
public System.Collections.Generic.List <MenuInfo> Load() { System.Collections.Generic.List <MenuInfo> list = new System.Collections.Generic.List <MenuInfo>(); try { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); DataTable dataTable = dataAccessLayer.ExecuteDataTable("select * from " + this.string_0); for (int i = 0; i < dataTable.Rows.Count; i++) { DataRow dataRow = dataTable.Rows[i]; MenuInfo menuInfo = new MenuInfo(); menuInfo.MenuID = System.Convert.ToString(dataRow["MenuID"]); menuInfo.NAME = System.Convert.ToString(dataRow["NAME"]); object arg_8E_0 = dataRow["ORDERBY"]; menuInfo.ORDERBY = new int?((!(dataRow["ORDERBY"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["ORDERBY"]) : -1); menuInfo.PROGID = System.Convert.ToString(dataRow["PROGID"]); menuInfo.SHORTCUT = System.Convert.ToString(dataRow["SHORTCUT"]); menuInfo.SUBTYPE = new int?((!(dataRow["SUBTYPE"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["SUBTYPE"]) : -1); menuInfo.VISIBLE = new bool?(dataRow["VISIBLE"] is System.DBNull || System.Convert.ToInt32(dataRow["VISIBLE"]) == 1); menuInfo.ItemCol = new int?((!(dataRow["ItemCol"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["ItemCol"]) : -1); menuInfo.ISPOPMENUITEM = new bool?(!(dataRow["ISPOPMENUITEM"] is System.DBNull) && System.Convert.ToInt32(dataRow["ISPOPMENUITEM"]) == 1); menuInfo.COMPONENTDLLNAME = System.Convert.ToString(dataRow["COMPONENTDLLNAME"]); menuInfo.CLASSNAME = System.Convert.ToString(dataRow["CLASSNAME"]); menuInfo.PARENTIDS = System.Convert.ToString(dataRow["PARENTIDS"]); menuInfo.BEGINGROUP = new bool?(!(dataRow["BEGINGROUP"] is System.DBNull) && System.Convert.ToInt32(dataRow["BEGINGROUP"]) == 1); menuInfo.CAPTION = System.Convert.ToString(dataRow["CAPTION"]); list.Add(menuInfo); } dataAccessLayer.Close(); } catch { } return(list); }
private void btnTestConnection_Click(object sender, EventArgs e) { DataProviderType oleDb = DataProviderType.OleDb; string str = ""; if (this.radioGroup1.SelectedIndex == 0) { str = this.SQLTemplete.Replace("#SERVER#", this.txtServer.Text) .Replace("#USER#", this.txtUser.Text) .Replace("#PASSWORD#", this.txtPassword.Text) .Replace("#DATABASE#", this.txtDatabase.Text); oleDb = DataProviderType.Sql; } else if (this.radioGroup1.SelectedIndex == 1) { str = this.OraceleTemplete.Replace("#SERVER#", this.txtServer.Text) .Replace("#USER#", this.txtUser.Text) .Replace("#PASSWORD#", this.txtPassword.Text); oleDb = DataProviderType.OleDb; } else { str = this.OLETemplete.Replace("#DATABASE#", this.txtServer.Text); } if (str != "") { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(oleDb, str); try { try { if (dataAccessLayer.Open()) { MessageBox.Show("连接成功!"); dataAccessLayer.Close(); } } catch (Exception exception) { MessageBox.Show(exception.Message); } } finally { } } }
/*** INSTANCE METHODS ***/ public bool Save() { DataAccessLayerBaseClass DBLayer = DataAccessLayerBaseClassHelper.GetDataAccessLayer(); int TempId = DBLayer.CreateNewIssueNotification(this); if (TempId > 0) { _Id = TempId; return(true); } else { return(false); } }