Ejemplo n.º 1
0
        public LIST_TEMPLATEInfo Get(
            String DTB,
            String Code,
            ref string sErr)
        {
            LIST_TEMPLATEInfo objEntr = new LIST_TEMPLATEInfo();

            connect();
            InitSPCommand(_strSPGetName);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.DTB.ToString(), DTB);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.Code.ToString(), Code);

            DataTable list = new DataTable();

            try
            {
                list = executeSelectSP(command);
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();

            if (list.Rows.Count > 0)
            {
                objEntr = (LIST_TEMPLATEInfo)GetDataFromDataRow(list, 0);
            }
            //if (dr != null) list = CBO.FillCollection(dr, ref list);
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(objEntr);
        }
Ejemplo n.º 2
0
        public DataTableCollection Get_Page(LIST_TEMPLATEInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr)
        {
            string whereClause         = CreateWhereClause(obj);
            DataTableCollection dtList = null;

            connect();
            InitSPCommand(_strSPGetPages);

            AddParameter(prefix + "WhereClause", whereClause);
            AddParameter(prefix + "OrderBy", orderBy);
            AddParameter(prefix + "PageIndex", pageIndex);
            AddParameter(prefix + "PageSize", pageSize);

            try
            {
                dtList = executeCollectSelectSP();
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(dtList);
        }
Ejemplo n.º 3
0
        public string Update(LIST_TEMPLATEInfo objEntr)
        {
            connect();
            InitSPCommand(_strSPUpdateName);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.DTB.ToString(), objEntr.DTB);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.Code.ToString(), objEntr.Code);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.Data.ToString(), objEntr.Data);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.Length.ToString(), objEntr.Length);

            string sErr = "";

            try
            {
                excuteSPNonQuery();
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(sErr);
        }
Ejemplo n.º 4
0
        protected override object GetDataFromDataRow(DataTable dt, int i)
        {
            LIST_TEMPLATEInfo result = new LIST_TEMPLATEInfo();

            result.DTB    = (dt.Rows[i][LIST_TEMPLATEInfo.Field.DTB.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][LIST_TEMPLATEInfo.Field.DTB.ToString()]));
            result.Code   = (dt.Rows[i][LIST_TEMPLATEInfo.Field.Code.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][LIST_TEMPLATEInfo.Field.Code.ToString()]));
            result.Data   = (dt.Rows[i][LIST_TEMPLATEInfo.Field.Data.ToString()] == DBNull.Value ? null : (Byte[])(dt.Rows[i][LIST_TEMPLATEInfo.Field.Data.ToString()]));
            result.Length = (dt.Rows[i][LIST_TEMPLATEInfo.Field.Length.ToString()] == DBNull.Value ? 0 : (int)(dt.Rows[i][LIST_TEMPLATEInfo.Field.Length.ToString()]));
            return(result);
        }
Ejemplo n.º 5
0
        public string InsertUpdate(LIST_TEMPLATEInfo obj)
        {
            string sErr = "";

            if (IsExist(
                    obj.DTB,
                    obj.Code
                    ))
            {
                sErr = Update(obj);
            }
            else
            {
                Add(obj, ref sErr);
            }
            return(sErr);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Return 1: Table is exist Identity Field
        /// Return 0: Table is not exist Identity Field
        /// Return -1: Erro
        /// </summary>
        /// <param name="tableName"></param>
        public Int32 Add(LIST_TEMPLATEInfo objEntr, ref string sErr)
        {
            int ret = -1;

            connect();
            InitSPCommand(_strSPInsertName);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.DTB.ToString(), objEntr.DTB);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.Code.ToString(), objEntr.Code);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.Data.ToString(), objEntr.Data);
            AddParameter(prefix + LIST_TEMPLATEInfo.Field.Length.ToString(), objEntr.Length);

            try
            {
                //command.ExecuteNonQuery();
                object tmp = executeSPScalar();
                if (tmp != null && tmp != DBNull.Value)
                {
                    ret = Convert.ToInt32(tmp);
                }
                else
                {
                    ret = 0;
                }
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }

            return(ret);
        }
Ejemplo n.º 7
0
 public DataTableCollection Get_Page(LIST_TEMPLATEInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr)
 {
     return(_objDAO.Get_Page(obj, orderBy, pageIndex, pageSize, ref sErr));
 }
Ejemplo n.º 8
0
 public string Update(LIST_TEMPLATEInfo obj)
 {
     return(_objDAO.Update(obj));
 }
Ejemplo n.º 9
0
 public Int32 Add(LIST_TEMPLATEInfo obj, ref string sErr)
 {
     return(_objDAO.Add(obj, ref sErr));
 }
Ejemplo n.º 10
0
        public string TransferIn(DataRow row)
        {
            LIST_TEMPLATEInfo inf = new LIST_TEMPLATEInfo(row);

            return(InsertUpdate(inf));
        }
Ejemplo n.º 11
0
 public DataTable ToTransferInStruct()
 {
     return(LIST_TEMPLATEInfo.ToDataTable());
 }
Ejemplo n.º 12
0
        private string CreateWhereClause(LIST_TEMPLATEInfo obj)
        {
            String result = "";

            return(result);
        }