예제 #1
0
        private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset)
        {
            //This is where you put validation code
            //This event gets called when the following actions occur
            bool bCancel = false;

            switch (adReason) {
                case ADODB.EventReasonEnum.adRsnAddNew:
                    break;
                case ADODB.EventReasonEnum.adRsnClose:
                    break;
                case ADODB.EventReasonEnum.adRsnDelete:
                    break;
                case ADODB.EventReasonEnum.adRsnFirstChange:
                    break;
                case ADODB.EventReasonEnum.adRsnMove:
                    break;
                case ADODB.EventReasonEnum.adRsnRequery:
                    break;
                case ADODB.EventReasonEnum.adRsnResynch:
                    break;
                case ADODB.EventReasonEnum.adRsnUndoAddNew:
                    break;
                case ADODB.EventReasonEnum.adRsnUndoDelete:
                    break;
                case ADODB.EventReasonEnum.adRsnUndoUpdate:
                    break;
                case ADODB.EventReasonEnum.adRsnUpdate:
                    break;
            }

            //bCancel = True
            //  adStatus = adStatusCantDeny
        }
예제 #2
0
        public System.Data.DataTable selectTest(ADODB.Connection cn)
        {
            string sql = "select * from users";
            System.Data.DataTable dt = conn.ExecuteScalar(sql, cn);

            return dt;
        }
예제 #3
0
        public ADODB.Recordset selectTest2(ADODB.Connection cn)
        {
            string sql = "select top 1 * from users";
            var rs5 = conn.Execute(sql, cn);

            return rs5;
        }
예제 #4
0
 public static bool GetBoolField(ADODB.Field field)
 {
     if (field.Value == null)
         return false;
     else
         return bool.Parse(field.Value.ToString());
 }
예제 #5
0
        public static void Update_ADODB_from_ADO(DataTable inTable, ref ADODB.Recordset adoRs)
        {
            // ADODB.Recordset result = adoRs.Clone(ADODB.LockTypeEnum.adLockOptimistic);
            ADODB.Fields adoFields = adoRs.Fields;
            System.Data.DataColumnCollection inColumns = inTable.Columns;
            //Delete
            adoRs.MoveFirst();
            while (!adoRs.EOF)
            {
                adoRs.Delete();
                adoRs.MoveNext();

            }
            //Add
            foreach (DataRow dr in inTable.Rows)
            {
                adoRs.AddNew(System.Reflection.Missing.Value,
                                System.Reflection.Missing.Value);

                for (int columnIndex = 0; columnIndex < inColumns.Count; columnIndex++)
                {
                    adoFields[columnIndex].Value = dr[columnIndex];
                }
            }
        }
예제 #6
0
 public static string GetStringField(ADODB.Field field)
 {
     if (field.Value == null)
         return "";
     else
         return field.Value.ToString().Trim();
 }
예제 #7
0
    public FormGroups(DataRow row, ADODB db)
    {
        tf_formGroupId   = row.IsNull("tf_GroupId") ? "" : (string)row["tf_GroupId"];
        tf_formGroupName = row.IsNull("tf_GroupName") ? "" : (string)row["tf_GroupName"];
        tf_numCols       = row.IsNull("tf_numCols") ? 1 : (int)row["tf_numCols"];

        tf_groupFields = FormgroupFields.getlstdata(tf_formGroupId, db);
    }
예제 #8
0
 public FormScheme(DataRow row, ADODB db)
 {
     tf_schemeId     = row.IsNull("tf_schemeId") ? "" : (string)row["tf_schemeId"];
     tf_windowWidth  = row.IsNull("tf_windowWidth") ? -1 : (int)row["tf_windowWidth"];
     tf_windowHeight = row.IsNull("tf_windowHeight") ? -1 : (int)row["tf_windowHeight"];
     tf_schemeLayout = row.IsNull("tf_schemeLayout") ? "" : (string)row["tf_schemeLayout"];
     tf_schemeGroups = FormGroups.getlstdata(tf_schemeId, db);
 }
예제 #9
0
 public GridSchemeGroup(DataRow row, ADODB db)
 {
     tf_gridGroupId       = row.IsNull("tf_GroupId") ? "" : (string)row["tf_GroupId"];
     tf_gridGroupName     = row.IsNull("tf_GroupName") ? "" : (string)row["tf_GroupName"];
     tf_isShowHeaderSpans = row.IsNull("tf_isShowHeaderSpans") ? false : (Boolean)row["tf_isShowHeaderSpans"];
     tf_isLocked          = row.IsNull("tf_isLocked") ? false : (Boolean)row["tf_isLocked"];
     tf_groupFields       = GridGroupFields.getlstdata(tf_gridGroupId, db);
 }
예제 #10
0
 public void ExecuteQuery(string sql, ADODB.Connection cn2)
 {
     if (rs.State == 1)
     {
         rs.Close();
     }
     rs.Open(sql, cn2, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1);
 }
예제 #11
0
 public static ADODB.Recordset getRSwaitron(ref object sql, ref ADODB.Connection cn)
 {
     ADODB.Recordset functionReturnValue = default(ADODB.Recordset);
     functionReturnValue = new ADODB.Recordset();
     functionReturnValue.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
     functionReturnValue.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic);
     return functionReturnValue;
 }
예제 #12
0
 public static DateTime GetDateTimeField(ADODB.Field field)
 {
     if (field.Value == null)
         return DateTime.MinValue;
     else if (field.Value.ToString().Trim() == "")
         return DateTime.MinValue;
     else
         return DateTime.Parse(field.Value.ToString());
 }
예제 #13
0
 public static int GetIntField(ADODB.Field field)
 {
     if (field.Value == null)
         return 0;
     else if (field.Value.ToString().Trim() == "")
         return 0;
     else
         return int.Parse(field.Value.ToString());
 }
 public Geocode(string roadsTableName, string pointsTableName,
 ADODB.Connection odbcDatabaseConnection, double Lon,
 double Lat)
 {
     this.roadsTableName = roadsTableName;
     this.pointsTableName = pointsTableName;
     this.odbcDatabaseConnection = odbcDatabaseConnection;
     this.Lon = Lon; this.Lat = Lat;
 }
예제 #15
0
 public System.Data.DataTable ExecuteScalar(string sql, ADODB.Connection cn2)
 {
     rs.Open(sql, cn2, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1);
     System.Data.OleDb.OleDbDataAdapter ol = new System.Data.OleDb.OleDbDataAdapter();
     System.Data.DataTable dt = new System.Data.DataTable();
     ol.Fill(dt, rs);
     rs.Close();
     return dt;
 }
예제 #16
0
 public ADODB.Recordset Execute(string sql, ADODB.Connection cn2)
 {
     if (rs.State == 1)
     {
         rs.Close();
     }
     rs.Open(sql, cn2, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1);
     return rs;
 }
예제 #17
0
 public static double GetDoubleField(ADODB.Field field)
 {
     if (field.Value == null)
         return 0;
     else if (field.Value.ToString().Trim() == "")
         return 0;
     else
         return double.Parse(field.Value.ToString());
 }
예제 #18
0
파일: Menu.cs 프로젝트: shinbochen/DataBase
    public void LoadMenu(  )
    {
        ADODB db = new ADODB();

        if (db.Open())
        {
            // 顶级菜单
            root = this.LoadMenu(db, "0");
            db.Close();
        }
    }
예제 #19
0
파일: Menu.cs 프로젝트: shinbochen/DataBase
    /// <summary>
    /// condition
    /// </summary>
    /// <param name="db"></param>
    /// <param name="condition"></param>
    /// <returns></returns>

    public List <Dictionary <string, object> > LoadMenu(ADODB db, string condition)
    {
        List <Dictionary <string, object> > lst = new List <Dictionary <string, object> >();
        string    sql = String.Format("select * from sm_menu where _parent='{0}' and _permission <= {1} order by id asc", condition, this.permission);
        DataTable dt  = db.exec_dataset(sql);

        if (dt != null)
        {
            foreach (DataRow dr in dt.Rows)
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                foreach (DataColumn dc in dt.Columns)
                {
                    string key, value;
                    int    ivalue;

                    key = dc.ColumnName;

                    switch (key)
                    {
                    case "_text":
                    case "_moduleName":
                    case "_extraParams":
                    case "_xtype":
                        value = dr.IsNull(key) ? "" : (string)dr[key];
                        dic.Add(key, value);
                        break;

                    // 字符换为十六进制
                    case "_glyph":
                        ivalue = dr.IsNull(key) ? 0 : Convert.ToInt32((string)dr[key], 16);
                        dic.Add(key, ivalue);
                        break;

                    // 不为0表示有子项
                    case "_child":

                        value = dr.IsNull(key) ? "" : (string)dr[key];
                        if (value.Length > 0 && value != "0")
                        {
                            dic.Add("items", this.LoadMenu(db, value));
                        }
                        break;

                    default:
                        break;
                    }
                }
                lst.Add(dic);
            }
        }
        return(lst);
    }
예제 #20
0
        private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset)
        {
            int lQuantity = 0;
            if (adoPrimaryRS.Fields("StockTakeDeposit_Quantity").OriginalValue != adoPrimaryRS.Fields("StockTakeDeposit_Quantity").Value) {
                lQuantity = Convert.ToInt32(adoPrimaryRS.Fields("StockTakeDeposit_Quantity").Value) - Convert.ToInt32(adoPrimaryRS.Fields("StockTakeDeposit_Quantity").OriginalValue);
                modRecordSet.cnnDB.Execute("UPDATE WarehouseDepositItemLnk SET WarehouseDepositItemLnk.WarehouseDepositItemLnk_Quantity = [WarehouseDepositItemLnk]![WarehouseDepositItemLnk_Quantity]+(" + lQuantity + ") WHERE (((WarehouseDepositItemLnk.WarehouseDepositItemLnk_WarehouseID)=" + adoPrimaryRS.Fields("StockTakeDeposit_WarehouseID").Value + ") AND ((WarehouseDepositItemLnk.WarehouseDepositItemLnk_DepositID)=" + adoPrimaryRS.Fields("StockTakeDeposit_DepositID").Value + ") AND ((WarehouseDepositItemLnk.WarehouseDepositItemLnk_DepositTypeID)=" + adoPrimaryRS.Fields(1).Value + "));");

                modRecordSet.cnnDB.Execute("UPDATE Company INNER JOIN DayEndDepositItemLnk ON Company.Company_DayEndID = DayEndDepositItemLnk.DayEndDepositItemLnk_DayEndID SET DayEndDepositItemLnk.DayEndDepositItemLnk_QuantityShrink = [DayEndDepositItemLnk]![DayEndDepositItemLnk_QuantityShrink]+" + lQuantity + " WHERE (((DayEndDepositItemLnk.DayEndDeposittemLnk_DepositID)=" + adoPrimaryRS.Fields("StockTakeDeposit_DepositID").Value + ") AND ((DayEndDepositItemLnk.DayEndDeposittemLnk_DepositType)=" + adoPrimaryRS.Fields(1).Value + "));");

                doDiskFlush();

            }
        }
예제 #21
0
    public int GetLastID(ADODB db)
    {
        int       result = -1;
        string    sql    = String.Format("SELECT IDENT_CURRENT('{0}')", table);
        DataTable dt     = db.exec_dataset(sql);

        if (dt.Rows.Count > 0)
        {
            DataRow row  = dt.Rows[0];
            decimal temp = row.IsNull(0) ? -1 : (decimal)row[0];
            result = (int)temp;
        }
        return(result);
    }
예제 #22
0
        private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset)
        {
            int lQuantity = 0;

            if (adoPrimaryRS.Fields("Reference").OriginalValue != adoPrimaryRS.Fields("Reference").Value) {

                //cnndb.Execute "Update PastelDescription Set Narrative ='
            }

            if (adoPrimaryRS.Fields("AccountNumber").OriginalValue != adoPrimaryRS.Fields("AccountNumber").Value) {
                //cnnDB.Execute "Update PastelDescription Set AccountNumber =' "

            }
        }
예제 #23
0
    static public List <FormgroupFields> getlstdata(string id, ADODB db)
    {
        List <FormgroupFields> lst = null;
        DataTable dt = db.exec_dataset(FormgroupFields.getquerysql(id));

        if (dt != null)
        {
            lst = new List <FormgroupFields>();

            foreach (DataRow row in dt.Rows)
            {
                FormgroupFields obj = new FormgroupFields(row, db);
                lst.Add(obj);
            }
        }
        return(lst);
    }
예제 #24
0
    static public List <GridSchemeGroup> getlstdata(string id, ADODB db)
    {
        List <GridSchemeGroup> lst = null;
        DataTable dt = db.exec_dataset(GridSchemeGroup.getquerysql(id));

        if (dt != null)
        {
            lst = new List <GridSchemeGroup>();

            foreach (DataRow row in dt.Rows)
            {
                GridSchemeGroup obj = new GridSchemeGroup(row, db);
                lst.Add(obj);
            }
        }
        return(lst);
    }
예제 #25
0
 private DataTable ADODBRecordset_to_ADODataTable(ADODB.Recordset adoRs)
 {
     string tableName = "adoTable";
     try
     {
         tableName = adoRs.Properties["Unique Table"].Value.ToString();
     }
     catch
     {
         // No existe el nombre de la tabla.
     }
     tableName = (tableName == "") ? "adoTable" : tableName;
     ADODB.Recordset dummyrs = adoRs.Clone(ADODB.LockTypeEnum.adLockReadOnly);
     OleDbDataAdapter myDA = new OleDbDataAdapter();
     DataSet myDS = new DataSet();
     myDA.Fill(myDS, dummyrs, tableName);
     dummyrs = null;
     return myDS.Tables[0];
 }
예제 #26
0
    public Summary(DataRow row, ADODB db)
    {
        tf_moduleName = row.IsNull("tf_moduleName") ? "" : (string)row["tf_moduleName"];
        tf_title      = row.IsNull("tf_title") ? "" : (string)row["tf_title"];


        tf_glyph = row.IsNull("tf_glyph") ? 0 : Convert.ToInt32((string)row["tf_glyph"], 16);

        tf_shortname        = row.IsNull("tf_shortname") ? "" : (string)row["tf_shortname"];
        tf_englishName      = row.IsNull("tf_englishName") ? "" : (string)row["tf_englishName"];
        tf_englishShortName = row.IsNull("tf_englishShortName") ? "" : (string)row["tf_englishShortName"];
        tf_description      = row.IsNull("tf_description") ? "" : (string)row["tf_description"];
        tf_primaryKey       = row.IsNull("tf_primaryKey") ? "" : (string)row["tf_primaryKey"];
        tf_nameFields       = row.IsNull("tf_nameFields") ? "" : (string)row["tf_nameFields"];

        tf_fields      = Fields.getlstdata(tf_moduleName, db);
        tf_gridSchemes = GridScheme.getlstdata(tf_moduleName, db);
        tf_formSchemes = FormScheme.getlstdata(tf_moduleName, db);
    }
예제 #27
0
    /// <summary>
    ///  返回受影响的条数
    /// </summary>
    /// <param name="db"></param>
    /// <param name="action"></param>
    /// <returns></returns>
    public int execSQL(ADODB db, string action /*, HttpContext context*/)
    {
        int    result = -1;
        string sql    = "";

        if (lst != null)
        {
            action = action.ToLower();

            switch (action)
            {
            case "add":      //增加 应该一次只加一条数据
                foreach (Dictionary <string, object> dic in lst)
                {
                    sql = getAddSQL(dic);
                }
                break;

            case "delete":
                sql = getDeleteSQL();
                break;

            case "edit":     //修改 应该一次只修改一条数据
                foreach (Dictionary <string, object> dic in lst)
                {
                    sql = getUpdateSQL(dic);
                }
                break;

            default:
                break;
            }
            if (sql.Length > 0)
            {
                msql = sql;

                //context.Response.Write(sql);
                result = db.execNonQuery(sql);
            }
        }
        return(result);
    }
예제 #28
0
    public void LoadData( )
    {
        ADODB db = new ADODB();

        if (db.Open())
        {
            DataTable dt = db.exec_dataset(Summary.getquerysql());
            root = new List <Summary>();

            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    Summary obj = new Summary(row, db);
                    root.Add(obj);
                }
            }
            db.Close();
        }
        return;
    }
		protected DataTable RecordSetToDataTable(ADODB.Recordset record)
		{
			OleDbDataAdapter custDA = new OleDbDataAdapter();
			DataTable custTable = new DataTable();
			custDA.Fill(custTable, record);
			return custTable;
		}
예제 #30
0
        private void adoPrimaryRS_FieldChangeComplete(int cFields, object Fields, ADODB.Error pError, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset)
        {
            string sql = null;
            sql = "DELETE From PriceChannelLnk WHERE (((PriceChannelLnk.PriceChannelLnk_StockItemID)=" + adoPrimaryRS.Fields("CatalogueChannelLnk_StockItemID").Value + ") AND ((PriceChannelLnk.PriceChannelLnk_Quantity)=" + adoPrimaryRS.Fields("CatalogueChannelLnk_Quantity").Value + ") AND ((PriceChannelLnk.PriceChannelLnk_ChannelID)=" + adoPrimaryRS.Fields("CatalogueChannelLnk_ChannelID").Value + "));";
            modRecordSet.cnnDB.Execute(sql);

            sql = "INSERT INTO PriceChannelLnk ( PriceChannelLnk_StockItemID, PriceChannelLnk_Quantity, PriceChannelLnk_ChannelID, PriceChannelLnk_Price ) SELECT CatalogueChannelLnk.CatalogueChannelLnk_StockItemID, CatalogueChannelLnk.CatalogueChannelLnk_Quantity, CatalogueChannelLnk.CatalogueChannelLnk_ChannelID, " + pRecordset.Fields("CatalogueChannelLnk_Price").Value + " AS Price From CatalogueChannelLnk WHERE (((CatalogueChannelLnk.CatalogueChannelLnk_StockItemID)=" + pRecordset.Fields("CatalogueChannelLnk_StockItemID").Value + ") AND ((CatalogueChannelLnk.CatalogueChannelLnk_Quantity)=" + pRecordset.Fields("CatalogueChannelLnk_Quantity").Value + ") AND ((CatalogueChannelLnk.CatalogueChannelLnk_ChannelID)=" + pRecordset.Fields("CatalogueChannelLnk_ChannelID").Value + ") AND ((CatalogueChannelLnk.CatalogueChannelLnk_PriceSystem)<>" + pRecordset.Fields("CatalogueChannelLnk_Price").Value + "));";

            modRecordSet.cnnDB.Execute(sql);
        }
예제 #31
0
        private void RecToExchange(ADODB.Record Rec)
        {
            Rec.Fields["nw:mo:no"].Value = OrderNo;
            Rec.Fields["nw:partno"].Value = ItemNo;

            if (Item != null)
                Rec.Fields["nw:part:revision"].Value = Item.CustomerRevision;

            Rec.Fields["nw:part:tmxrefno"].Value = CustomerItemNo;
            Rec.Fields["nw:material"].Value = Material;
            Rec.Fields["nw:parttype"].Value = ItemType;
            Rec.Fields["nw:partname"].Value = ItemName;
            Rec.Fields["nw:strprice"].Value = OurPrice.ToString();
            Rec.Fields["nw:cpo:item:strprice"].Value = CustomerPrice.ToString();
            Rec.Fields["nw:mo:origin"].Value = Origin;
            Rec.Fields["nw:customer"].Value = Customer;
            Rec.Fields["nw:mo:destination"].Value = Destination;
            Rec.Fields["nw:mo:moveqty"].Value = int.Parse(MoveQty.ToString());
            Rec.Fields["nw:mo:arrivedqty"].Value = int.Parse(ArrivedQty.ToString());
            Rec.Fields["nw:cpo:item:shipmethod"].Value = ShipMethod;
            //Rec.Fields.Append("nw:mo:movedate", ADODB.DataTypeEnum.adFileTime);

            if (CompDate.Year > 2000)
                Rec.Fields["nw:mo:compdate"].Value = CompDate;

            if (MoveDate.Year > 2000)
                Rec.Fields["nw:mo:movedate"].Value = MoveDate; // DateTime.Today;

            Rec.Fields["nw:cpo:no"].Value = SalesOrderNo; //  SOLine.OrderNo;
            Rec.Fields["nw:cpo:item:index"].Value = SalesOrderIndex; //  SOLine.OrderIndex;
            Rec.Fields["nw:mo:refno"].Value = RefNo;
            Rec.Fields["nw:mo:reftype"].Value = RefType;//  "CPO";
            Rec.Fields["nw:mo:sotype"].Value = SoType; //  "FQC";
            Rec.Fields["nw:mo:status"].Value = OrderStatus;
            Rec.Fields["nw:history"].Value = History;
        }
예제 #32
0
        public bool addFacturas(bool defectos, bool contado, xTangoFacturaData data, out ADODB.Recordset adoReporte)
        {
            bool resultado = false;
            // Clase para el alta de comprobantes.
            XTANGO_GV.Comprobantes xComprobantes;
            try
            {
                xComprobantes = (XTANGO_GV.Comprobantes)Activator.CreateInstance
                    (Type.GetTypeFromProgID("XTango_GV.Comprobantes"));

                object reporte = null;

                if (contado)
                {
                    resultado = xComprobantes.Add_FacturaContado(tangoLogOn, data.rsFacEncabezado as object, data.rsFacRenglones as object, data.rsFacImpuestos as object, data.rsFonEncabezado as object, data.rsFonRenglones as object, defectos, ref reporte);
                }
                else
                {
                    resultado = xComprobantes.Add_FacturaCtaCorriente(tangoLogOn, data.rsFacEncabezado as object, data.rsFacRenglones as object, data.rsFacImpuestos as object, data.rsFacCuotas as object, defectos, ref reporte);
                }
                // if (!resultado) { throw new XTangoException("Fallo al agregar facturas"); }

                adoReporte = (ADODB.Recordset)reporte;
            }
            catch (Exception ex)
            {
                throw new Excepciones.XTangoException("Error al agregar facturas: " + ex.Message);
            }
            finally {
                xComprobantes = null;
            }

            return resultado;
        }
예제 #33
0
 private void InitFromRec(ADODB.Record Rec)
 {
     CellLine = ExchangeHelper.GetStringField(Rec.Fields["nw:cellline"]);
     FQCInspectionDate = ExchangeHelper.GetDateTimeField(Rec.Fields["nw:fqc:inspectiondate"]);
     FQCInspector = ExchangeHelper.GetStringField(Rec.Fields["nw:fqc:inspector"]);
     ActiveQty = ExchangeHelper.GetDoubleField(Rec.Fields["nw:js:activeqty"]);
     IrNo = ExchangeHelper.GetStringField(Rec.Fields["nw:js:irno"]);
     Location = ExchangeHelper.GetStringField(Rec.Fields["nw:js:location"]);
     NeedDate = ExchangeHelper.GetDateTimeField(Rec.Fields["nw:js:needdate"]);
     NeedQty = ExchangeHelper.GetDoubleField(Rec.Fields["nw:js:needqty"]);
     OrderNo = ExchangeHelper.GetStringField(Rec.Fields["nw:js:no"]);
     OrderStatus = ExchangeHelper.GetStringField(Rec.Fields["nw:js:status"]);
     Material = ExchangeHelper.GetStringField(Rec.Fields["nw:material"]);
     ItemName = ExchangeHelper.GetStringField(Rec.Fields["nw:partname"]);
     ItemNo = ExchangeHelper.GetStringField(Rec.Fields["nw:partno"]);
     ItemType = ExchangeHelper.GetStringField(Rec.Fields["nw:parttype"]);
     ActiveLocation = ExchangeHelper.GetStringField(Rec.Fields["nw:js:activelocation"]);
     Item = Item.Load(ItemNo);
 }
예제 #34
0
 private void InitFromExchange(ADODB.Record Rec)
 {
     ItemNo = ExchangeHelper.GetStringField(Rec.Fields["nw:partno"]);
     ItemName = ExchangeHelper.GetStringField(Rec.Fields["nw:partname"]);
     ItemType = ExchangeHelper.GetStringField(Rec.Fields["nw:parttype"]);
     Qty = ExchangeHelper.GetDoubleField(Rec.Fields["nw:inv:totalqty"]);
     QAQty = ExchangeHelper.GetDoubleField(Rec.Fields["nw:inv:qaqty"]);
     DefectQty = ExchangeHelper.GetDoubleField(Rec.Fields["nw:inv:defectqty"]);
 }
예제 #35
0
 public GridScheme(DataRow row, ADODB db)
 {
     tf_schemeId     = row.IsNull("tf_schemeId") ? "" : (string)row["tf_schemeId"];
     tf_schemeName   = row.IsNull("tf_schemeName") ? "" : (string)row["tf_schemeName"];
     tf_schemeGroups = GridSchemeGroup.getlstdata(tf_schemeId, db);
 }
예제 #36
0
 /// <summary>
 /// Copies the contents of an ADO Recordset object onto a worksheet, beginning at the upper-left corner of the specified range.
 /// If the Recordset object contains fields with OLE objects in them, this method fails.
 /// </summary>
 /// <param name="recordset">A wrapped ADODB.Recordset object representing the data to copy</param>
 /// <param name="maxRows">The maximum number of records to copy onto the worksheet. If this argument is omitted, all the records in the Recordset object are copied.</param>
 /// <param name="maxColumns">The maximum number of fields to copy onto the worksheet. If this argument is omitted, all the fields in the Recordset object are copied.</param>
 /// <returns>?</returns>
 public int CopyFromRecordset(ADODB.Recordset recordset, int? maxRows, int? maxColumns)
 {
     return CopyFromRecordset(recordset.InternalObject, maxRows, maxColumns);
 }
예제 #37
0
        private string doString(ref string lString, ref ADODB.Recordset rs)
        {
            string functionReturnValue = null;
            string lString1 = null;
            string lString2 = null;
            string lText = null;
            if (Strings.Len(lString) > 15) {
                lText = Strings.Mid(lString, 16);
                if (Strings.InStr(lText, "NAME 1 CENTER")) {
                    lString1 = rs.Fields("PersonName").Value;
                    splitString(ref Strings.Len(lText), ref lString1, ref lString2);
                    functionReturnValue = Strings.Left(lString, 15) + doCenter(ref lText, ref lString1);
                    return functionReturnValue;
                }
                if (Strings.InStr(lText, "DATE")) {
                    lString1 = Strings.Format(DateAndTime.Now, "yymm");
                    functionReturnValue = Strings.Left(lString, 15) + Strings.Format(DateAndTime.Now, "yymm");
                    return functionReturnValue;
                }

                if (Strings.InStr(lText, "BARCODE")) {
                    if (doCheckSum(ref rs.Fields("Person_QuickAccess").Value)) {
                    } else {
                        functionReturnValue = Strings.Left(lString, 15) + rs.Fields("Person_QuickAccess").Value;
                    }
                    return functionReturnValue;
                }
                if (Strings.InStr(lText, "600106007141")) {
                    if (doCheckSum(ref rs.Fields("Person_QuickAccess").Value))
                        functionReturnValue = Strings.Left(lString, 15) + rs.Fields("Person_QuickAccess").Value;
                    return functionReturnValue;
                }
                functionReturnValue = lString;
            } else {
                functionReturnValue = lString;
            }
            return functionReturnValue;
        }
예제 #38
0
        private void UpdateDBVersion(ADODB.Connection mycn)
        {
            var myUpdate = @"Update tblCaptions Set mdbVersion = '1.01.09'";
               var myCmd = new ADODB.Command { ActiveConnection = mycn, CommandText = myUpdate };
               myCmd.CommandType = CommandTypeEnum.adCmdText;

               object dummy = Type.Missing;
               ADODB.Recordset rs = myCmd.Execute(out dummy, ref dummy, 0);
        }
예제 #39
0
        private void InitializeCustomerSettings(ADODB.Connection mycn)
        {
            var myInsert =
               @"INSERT INTO tblCustomerSettings
                            ( CustomerID,
                              BillingMethodID,
                              MobileCarrierID
                            )
                            SELECT
                            tblCustomers.CustomerID,
                            0 AS bmID,
                            0 AS mcID
                            FROM tblCustomers;";

               var myCmd = new ADODB.Command {ActiveConnection = mycn, CommandText = myInsert};
               myCmd.CommandType = CommandTypeEnum.adCmdText;

               object dummy = Type.Missing;
               ADODB.Recordset rs = myCmd.Execute(out dummy, ref dummy,0);
        }
예제 #40
0
 /// <summary>
 /// Copies the contents of an ADO Recordset object onto a worksheet, beginning at the upper-left corner of the specified range.
 /// If the Recordset object contains fields with OLE objects in them, this method fails.
 /// </summary>
 /// <param name="recordset">A wrapped ADODB.Recordset object representing the data to copy</param>
 /// <returns>?</returns>
 public int CopyFromRecordset(ADODB.Recordset recordset)
 {
     return CopyFromRecordset(recordset.InternalObject);
 }
예제 #41
0
 public FormgroupFields(DataRow row, ADODB db)
 {
     tf_fieldName = row.IsNull("tf_fieldName") ? "" : (string)row["tf_fieldName"];
     tf_colspan   = row.IsNull("tf_colspan") ? 1 : (int)row["tf_colspan"];
     tf_isEndRow  = row.IsNull("tf_isEndRow") ? false : (Boolean)row["tf_isEndRow"];
 }
예제 #42
0
 private void adoPrimaryRS_MoveComplete(ADODB.EventReasonEnum adReason, ADODB.Error pError, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset)
 {
     //This will display the current record position for this recordset
 }
예제 #43
0
        /// <summary>
        /// Executes a query against the give ADODB connection to populate a lookup
        /// dictionary to be used by construction notes.
        /// </summary>
        /// <param name="processConnection">ADODB connection (PX)</param>
        /// <param name="Keys">Column(s) constrained to be unique</param>
        /// <param name="Value">Column to be used as the value</param>
        /// <param name="Table">Table to be queried</param>
        /// <param name="nameLookup">Dictionary to return the results</param>
        private static Dictionary<string, string> QueryLookupTable(ADODB.Connection processConnection, string[] Keys, string Value, string Table)
        {
            Dictionary<string, string> nameLookup = new Dictionary<string, string>();

            if (Keys == null ||
                Keys.Length < 1 ||
                string.IsNullOrEmpty(Value) ||
                string.IsNullOrEmpty(Table))
                return null;

            #region Build the Query

            string columns = string.Join(",", Keys);

            //set up statement
            string sql =
                string.Format("SELECT {0},{1} FROM {2}",
                //ScsConstants.FIELD_WMSCODE,
                //ScsConstants.FIELD_CUNAME,
                //ScsConstants.FIELD_ALTDESC,
                //ScsConstants.TABLE_CU);
               columns,
               Value,
               Table);

            #endregion

            Recordset recordSet = null;
            try
            {

                #region Execute the Query

                try
                {
                    if (processConnection.ConnectionString.Contains(".mdb"))
                        sql = sql.Replace("PROCESS.", "");

                    recordSet = GetRecordSet(processConnection, sql);
                    recordSet.MoveFirst();
                }
                catch (Exception ex)
                {
                    //throw, noting the SQL
                    throw new Exception("Error executing sql statement: " + sql, ex);
                }

                #endregion

                string[] vals = new string[Keys.Length];
                while (!recordSet.EOF)
                {

                    #region Process the results

                    string altdesc = "";
                    try
                    {
                        object oval = null;

                        //The alternate description isn't allowed to be null, this
                        //would cause undesirable results in the construction notes
                        oval = recordSet.Fields[Value].Value;
                        if (oval == null || oval == DBNull.Value)
                            continue;

                        altdesc = oval.ToString();

                        //The pieces in the composite key are allowed to contain
                        //null values, if they are we give them a special value
                        for (int i = 0; i < Keys.Length; i++)
                        {
                            oval = recordSet.Fields[Keys[i]].Value;
                            if (oval == null || oval == DBNull.Value)
                                vals[i] = "<Null>";
                            else
                                vals[i] = oval.ToString().ToUpper();
                        }
                        /*
                        oval = recordSet.Fields[ScsConstants.FIELD_WMSCODE].Value;
                        if (oval == null || oval == DBNull.Value)
                            wmscode = "<Null>";
                        else
                            wmscode = oval.ToString().ToUpper();

                        oval = recordSet.Fields[ScsConstants.FIELD_CUNAME].Value;
                        if (oval == null || oval == DBNull.Value)
                            name = "<Null>";
                        else
                            name = oval.ToString().ToUpper();
                        */
                        string key = string.Join("\t", vals);
                        if (!nameLookup.ContainsKey(key))
                            nameLookup.Add(key, altdesc);
                    }
                    finally
                    {
                        //move next
                        recordSet.MoveNext();
                    }

                    #endregion

                }
            }
            finally
            {
                if (recordSet != null)
                    recordSet.Close();
                recordSet = null;
            }

            return nameLookup;
        }