public System.Data.DataTable GetSubjectList() { try { return(GetSubjectList(0)); } catch (Exception ex) { Except.AddException(ex); return(null); } }
private void SetWorkFlowCondition() { try { DataColumn DC = new DataColumn("WorkFlowCondition"); DC.Expression = ClassLibrary.JGeneral.ConvertToPersian(Condition); _PublicDataRow.Columns.Add(DC); } catch (Exception ex) { Except.AddException(ex); } }
/// <summary> /// کد دسترسی سریع را برمیگرداند /// </summary> /// <param name="pCode">کد</param> /// <returns>int</returns> public int GetAccessCode(int pCode) { JDataBase db = new JDataBase(); try { db.setQuery("select ISNULL(max(AccessCode),-1) FROM ArchivedSubject where code = " + pCode); return(Convert.ToInt32(db.Query_ExecutSacler())); } catch (Exception ex) { Except.AddException(ex); } finally { db.Dispose(); } return(-1); }
public System.Data.DataTable GetSubjectList(int pCode) { JDataBase db = new JDataBase(); try { string Where = ""; if (pCode > 0) { Where = " Where Code=" + pCode.ToString(); } db.setQuery("select code , Name as 'name' , AccessCode FROM ArchivedSubject" + Where);//+ '_' + cast(AccessCode as nvarchar(20)) return(db.Query_DataTable()); } catch (Exception ex) { Except.AddException(ex); } finally { db.Dispose(); } return(null); }
public bool Update(DataTable tmpdt) { JTruckTable PDT = new JTruckTable(); JDataBase db = new JDataBase(); try { if (tmpdt != null) { db.beginTransaction("InsertTruck"); foreach (DataRow dr in tmpdt.Rows) { if (dr.RowState == DataRowState.Added) { Name = dr["Name"].ToString(); StartDate = Convert.ToDateTime(dr["StartDate"]); EndDate = Convert.ToDateTime(dr["EndDate"]); Price = Convert.ToInt32(dr["Price"]); Shortcut = dr["Shortcut"].ToString(); Insert(db); dr["Code"] = Code; if (Code < 1) { return(false); } } if (dr.RowState == DataRowState.Modified) { Name = dr["Name"].ToString(); StartDate = JDateTime.GregorianDate(dr["StartDate"].ToString()); EndDate = JDateTime.GregorianDate(dr["EndDate"].ToString()); Price = Convert.ToInt32(dr["Price"]); Shortcut = dr["Shortcut"].ToString(); Code = Convert.ToInt32(dr["Code"]); if (!Update(db)) { return(false); } } if (dr.RowState == DataRowState.Deleted) { dr.RejectChanges(); Code = (int)dr["Code"]; GetData(Code); if (!Delete(db)) { return(false); } dr.Delete(); } } tmpdt.AcceptChanges(); if (db.Commit()) { return(true); } else { return(false); } } return(true); } catch (Exception ex) { db.Rollback("InsertTruck"); Except.AddException(ex); return(false); } finally { PDT.Dispose(); db.Dispose(); } }