예제 #1
2
 protected void Page_Load(object sender, EventArgs e)
 {
     conn = new Connection();
        string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
     conn.Open(connectionstring);
     Rs1 = new Recordset();
     Rs2 = new Recordset();
     Rs3 = new Recordset();
     Rs4 = new Recordset();
     StationID = Request["StationID"];
     UserID = Session["UserID"];
     SecLevel = Session["SecLevel"];
     Barcode = Request["Barcode"];
     ProductType = Request["ProductType"];
     CarPlate = Request["CarPlate"];
     Response.Write(StationID);
     Response.Write(UserID);
     Response.Write(SecLevel);
     Response.End();
     iMessage = null;
     Rs1.Open(("Exec Checkrange '" + Barcode + "'"), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1);
     //Response.write ("Exec Checkrange '"&Barcode&"'")
     //Response.end
     if (Rs1.Eof)
     {
     Message = "Check Range ���ҥ��� - §��L��!";
     Response.Redirect("CouponVerification.aspx?Message=" + Message);
     }
     else
     {
     if (Convert.ToDateTime(Rs1.Fields["Expiry_Date"].Value) < DateTime.Parse(Convert.ToString(DateTime.Now)))
     {
         Message = "���ҥ��� - §��L��!";
         Response.Redirect("CouponVerification.aspx?Message=" + Message);
     }
     }
     Rs1.Close();
     Rs1 = null;
     Rs2.Open(("Exec CheckCouponExist '" + Barcode + "'"), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1);
     //Response.write ("Exec CheckCouponExist '"&Barcode&"'")
     iCount = Rs2.Fields["iCount"].Value;
     Rs2.Close();
     Rs2 = null;
     if (Convert.ToInt32(iCount) > 0)
     {
     Message = "���ҥ��� - ���ƨϥ�!";
     }
     else
     {
     Session.Add("SecLevel", SecLevel);
     Session.Add("UserID", UserID);
     Session.Add("StationID", StationID);
     Response.Redirect("Insert.aspx?ProductType=" + ProductType + "&Barcode=" + Barcode + "&CarPlate=" + CarPlate);
     }
     Session.Add("SecLevel", SecLevel);
     Session.Add("UserID", UserID);
     Session.Add("StationID", StationID);
     Response.Redirect("CouponVerification.aspx?Message=" + Message + "&Coupon_Number=" + Convert.ToString(Coupon_Number));
 }
예제 #2
0
파일: JobManager.cs 프로젝트: git786hub/DLL
        /// <summary>
        /// Gets the string value for FieldName from the active job.
        /// </summary>
        /// <param name="FieldName">Field in G3E_JOB</param>
        /// <returns>string field value</returns>
        private string strJobFieldValue(string FieldName)
        {
            if (string.IsNullOrEmpty(ActiveJob))
            {
                throw new Exception(string.Format("Job must be active to retrieve the value for {0}.", FieldName));
            }

            string    sql = string.Format("select {0} from g3e_job where g3e_identifier=?", FieldName);
            Recordset rs  = dc.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, dc.ActiveJob);

            if (null != rs && rs.RecordCount == 1)
            {
                string tmp = string.Empty;

                if (System.DBNull.Value != rs.Fields[0].Value)
                {
                    tmp = rs.Fields[0].Value.ToString();
                }

                rs.Close();
                return(tmp);
            }
            else
            {
                if (null != rs)
                {
                    rs.Close();
                    rs = null;
                }

                throw new Exception(string.Format("Unable to retrieve distinct value for {0} for the active job.", FieldName));
            }
        }
예제 #3
0
        public Boolean salvar()
        {
            String SQL = "INSERT INTO inventário2013 ( ID_produto, EAN, ID_usuario, Quantidade, Quantidade_anterior, Data ) " +
                         "SELECT " + idProduto + ",'" + EAN + "'," + idUsuario + ", " + quantidade + ", " + qAnterior + ", #" + data.Month + "/"
                         + data.Day + "/" + data.Year + "#;";

            try
            {
                produto.setEAN(this.EAN);
                produto.setquantEstoque(this.quantidade);
                produto.salvar(false);

                if (rsDados.State != 0)
                {
                    rsDados.Close();
                }

                rsDados.Open(SQL, new Conexao().getDb4(), CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
            }
            catch (Exception erro)
            {
                throw new ArgumentException(erro.Message);
            }
            return(true);
        }
        /// <summary>
        /// Function to refresh the entries from the database. This won't be super testable currently, but the database will eventually have its own functions to run on entries.
        /// </summary>
        internal static void refresh(List <int> conflictedRecords)
        {
            List <int> SERVICE_ACTIVITY_IDList = new List <int>();

            foreach (int record in conflictedRecords)
            {
                SERVICE_ACTIVITY_IDList.Add(record);
            }
            string fieldErrorActivityRefreshStatement = "";

            if (SERVICE_ACTIVITY_IDList.Count < 1000)
            {
                string SERVICE_ACTIVITY_IDString = String.Join(", ", SERVICE_ACTIVITY_IDList);
                fieldErrorActivityRefreshStatement = "SELECT * FROM SERVICE_ACTIVITY WHERE SERVICE_ACTIVITY_ID IN (" + SERVICE_ACTIVITY_IDString + ")";
            }
            else
            {
                int    index = 998;
                string SERVICE_ACTIVITY_IDString = String.Join(", ", SERVICE_ACTIVITY_IDList.GetRange(0, index));
                fieldErrorActivityRefreshStatement = "SELECT * FROM SERVICE_ACTIVITY WHERE SERVICE_ACTIVITY_ID IN (" + SERVICE_ACTIVITY_IDString + ")";
                while (SERVICE_ACTIVITY_IDList.Count > index)
                {
                    if (index + 998 > SERVICE_ACTIVITY_IDList.Count)
                    {
                        SERVICE_ACTIVITY_IDString           = String.Join(", ", SERVICE_ACTIVITY_IDList.GetRange(index, SERVICE_ACTIVITY_IDList.Count - index));
                        fieldErrorActivityRefreshStatement += " OR SERVICE_ACTIVITY_ID IN (" + SERVICE_ACTIVITY_IDString + ")";
                        index += 998;
                    }
                    else
                    {
                        SERVICE_ACTIVITY_IDString           = String.Join(", ", SERVICE_ACTIVITY_IDList.GetRange(index, 998));
                        fieldErrorActivityRefreshStatement += " OR SERVICE_ACTIVITY_ID IN (" + SERVICE_ACTIVITY_IDString + ")";
                        index += 998;
                    }
                }
            }
            Recordset refreshData = gtDataContext.OpenRecordset(fieldErrorActivityRefreshStatement, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1);

            if (refreshData.EOF && refreshData.BOF)
            {
                MessageBox.Show("No records found to refresh", "G/TEchnology");
                refreshData.Close();
            }
            else
            {
                refreshData.MoveFirst();
                while (!refreshData.EOF && metaDataRecords.RecordCount > 0)
                {
                    //load the data into the proper rows.
                    int     recordSERVICE_ACTIVITY_ID = Convert.ToInt32(refreshData.Fields["SERVICE_ACTIVITY_ID"].Value);
                    DataRow foundROW = dtList.Rows.Find(recordSERVICE_ACTIVITY_ID);
                    foreach (Field field in refreshData.Fields)
                    {
                        foundROW[field.Name] = field.Value;
                    }
                    refreshData.MoveNext();
                }
                refreshData.Close();
            }
        }
예제 #5
0
        //Checks if a character exists within the database
        public bool DoesCharacterExist(int ClientID, string CharacterName)
        {
            Console.WriteLine("checking if " + CharacterName + " character already exists");
            string Query = "SELECT * FROM characters WHERE CharacterName='" + CharacterName + "'";

            recorder.Open(Query, connection, cursorType, lockType);
            bool CharacterExists = !recorder.EOF;

            recorder.Close();
            return(CharacterExists);
        }
        private void ExtractRecords(out Dictionary <string, List <string[]> > firstRecords, out Dictionary <string, List <string[]> > secondRecords)
        {
            Recordset firstNonMatched = db.QueryResult(GetTable1NotUniqueQuery());

            firstRecords = GroupByHash(firstNonMatched);
            firstNonMatched.Close();

            Recordset secondNonMatched = db.QueryResult(GetTable2NotUniqueQuery());

            secondRecords = GroupByHash(secondNonMatched);
            firstNonMatched.Close();
        }
예제 #7
0
        /// <summary>
        /// Create a new record in Step Table
        /// </summary>
        /// <returns>True, if Step Creation is successful. Else returns false</returns>
        private bool CreateStepForTicket()
        {
            Recordset resultRs = null;

            try
            {
                resultRs = GetRecordSet(string.Format("SELECT GIS_NJUNS_TICKET_ID FROM NJUNS_TICKET WHERE POLE_FID = {0}", m_TicketAttributes.POLE_FID));
                if (resultRs != null && resultRs.RecordCount > 0)
                {
                    resultRs.MoveFirst();
                    m_GisTicketId = Convert.ToInt32(resultRs.Fields["GIS_NJUNS_TICKET_ID"].Value);
                }
                CreateInitialStep();
                CreateStepsForEachAttachment();
                CreateFinalStep();

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                resultRs.Close();
                resultRs = null;
            }
        }
예제 #8
0
        /// <summary>
        /// This method created the keyobject using temporary geometry tooltip and if it is a structure, the form defaults to querying by Structure ID.
        /// </summary>
        /// <param name="Fid"></param>
        private void CreateKeyObjectOfGivenFID(int Fid)
        {
            Recordset rs = null;

            try
            {
                string sql = string.Format("select g3e_fno from common_n where g3e_fid={0}", Fid);
                rs = assetHistoryModel.m_DataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText,
                                                                   null);

                if (rs != null && rs.RecordCount > 0)
                {
                    rs.MoveFirst();
                    ConfirmSelectedFeatureIsStructure(Fid, Convert.ToInt16(rs.Fields[0].Value));
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (rs != null)
                {
                    rs.Close();
                    rs = null;
                }
            }
        }
예제 #9
0
파일: JobManager.cs 프로젝트: git786hub/DLL
        /// <summary>
        /// Checks G3E_JOB for existence of a single occurrence of the active job.
        /// </summary>
        /// <returns>Error string if an error is encountered; otherwise string.Empty</returns>
        private string JobRecordExists()
        {
            string    SQL = "select count(1) from g3e_job where g3e_identifier=?";
            Recordset rs  = dc.OpenRecordset(SQL, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, ActiveJob);

            string exception = string.Empty;

            if (null != rs)
            {
                switch (rs.RecordCount)
                {
                case 0:
                    exception = string.Format("Unable to locate job record for job: {0}.", ActiveJob);
                    break;

                case 1:
                    // This is the expected case so nothing to do here.
                    break;

                default:
                    exception = string.Format("Multiple job records found for job: {0}.", ActiveJob);
                    break;
                }

                rs.Close();
                rs = null;
            }
            return(exception);
        }
예제 #10
0
        public void Insert(string tableName, string date, string guid, string operation)
        {
            Recordset rs        = new Recordset();
            string    selectCmd = "SELECT * FROM " + tableName;

            try
            {
                OpenRecordsetWithGivenSelectCmd(selectCmd, tableName, rs);
                Command cmdInsert   = new Command();
                string  textCommand = CreateInsertIntoTextCommand(tableName, rs);
                CreateCommand(cmdInsert, textCommand);

                InsertDataIntoParameters(guid, date, operation, rs, cmdInsert);

                object nRecordsAffected = Type.Missing;
                object oParams          = Type.Missing;

                cmdInsert.Execute(out nRecordsAffected, ref oParams,
                                  (int)ExecuteOptionEnum.adExecuteNoRecords);
                rs.Close();
                Console.WriteLine("\nSuccess.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error. " + ex);
            }
        }
예제 #11
0
        public List <string> ShowAll(string tableName, Guid myGuid, string historyReport, List <string> resultList)
        {
            resultList = new List <string>();
            Recordset rs = new Recordset();

            historyReport = string.Empty;
            string selectCmd = String.Format("SELECT * FROM CalcDB where GUID = '{0}'", myGuid.ToString());

            try
            {
                OpenRecordsetWithGivenSelectCmd(selectCmd, tableName, rs);
            }
            catch {
                //String.Format("No operations with guid {0} found.", myGuid.ToString());
                return(resultList);
            }

            rs.MoveFirst();

            string temp = string.Empty;

            while (!rs.EOF)
            {
                for (int i = 0; i < rs.Fields.Count - 1; i++)
                {
                    temp = rs.Fields[i + 1].Value.ToString();
                    resultList.Add(temp);
                }
                rs.MoveNext();
            }
            rs.Close();
            return(resultList);
        }
예제 #12
0
        private void coletaDados()
        {
            String     SQL     = "SELECT Fornecedores.* FROM Fornecedores WHERE (((Fornecedores.Cod)=" + id + "));";
            Recordset  RSDados = new Recordset();
            Connection conex   = new Conexao().getContas();

            RSDados.Open(SQL, conex, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);

            if (RSDados.BOF || RSDados.EOF)
            {
                throw new ArgumentException("ID inválido.");
            }
            this.nome     = (RSDados.Fields["FORNECEDOR"].Value.Equals(DBNull.Value))?"": RSDados.Fields["FORNECEDOR"].Value.ToString().ToUpper();
            this.razao    = (RSDados.Fields["RAZÃO"].Value.Equals(DBNull.Value)) ? "" : RSDados.Fields["RAZÃO"].Value.ToString().ToUpper();
            this.CNPJ     = (RSDados.Fields["CNPJ"].Value.Equals(DBNull.Value)) ? "" : RSDados.Fields["CNPJ"].Value.ToString().ToUpper();
            this.IE       = (RSDados.Fields["ESTADUAL"].Value.Equals(DBNull.Value)) ? "" : RSDados.Fields["ESTADUAL"].Value.ToString().ToUpper();
            this.Endereco = (RSDados.Fields["END"].Value.Equals(DBNull.Value)) ? "" : RSDados.Fields["END"].Value.ToString().ToUpper();
            this.cidade   = (RSDados.Fields["cidade"].Value.Equals(DBNull.Value)) ? "" : RSDados.Fields["cidade"].Value.ToString().ToUpper();
            this.UF       = (RSDados.Fields["estado"].Value.Equals(DBNull.Value)) ? "" : RSDados.Fields["estado"].Value.ToString().ToUpper();
            this.CEP      = (RSDados.Fields["CEP"].Value.Equals(DBNull.Value)) ? "" : RSDados.Fields["CEP"].Value.ToString().ToUpper();
            this.bairro   = (RSDados.Fields["Bairro"].Value.Equals(DBNull.Value)) ? "" : RSDados.Fields["Bairro"].Value.ToString().ToUpper();
            this.numero   = (RSDados.Fields["numero"].Value.Equals(DBNull.Value)) ? 0 : Convert.ToInt32(RSDados.Fields["numero"].Value.ToString());
            RSDados.Close();
            conex.Close();
        }
예제 #13
0
        /// <summary>
        /// Get Workpoint Instruction.
        /// </summary>
        /// <param name="cuCode"> CU code of the Active component.</param>
        /// <returns></returns>
        internal string GetWorkInstruction(string cuCode)
        {
            string    sql    = "";
            Recordset tempRs = null;

            try
            {
                sql    = "select SHORT_WORK_INSTRUCTION from CULIB_UNIT where CU_ID=:1";
                tempRs = gTDataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly,
                                                     (int)ADODB.CommandTypeEnum.adCmdText, cuCode);

                if (tempRs.RecordCount > 0)
                {
                    tempRs.MoveFirst();
                    if (!string.IsNullOrEmpty(Convert.ToString(tempRs.Fields[0].Value)))
                    {
                        return(Convert.ToString(tempRs.Fields[0].Value));
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (tempRs != null)
                {
                    tempRs.Close();
                    tempRs = null;
                }
            }

            return(null);
        }
예제 #14
0
        private void coletaDados()
        {
            if (RsDados.State != 0)
            {
                RsDados.Close();
            }
            RsDados.Open(SQL, conex, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);

            if (RsDados.EOF || RsDados.BOF)
            {
                throw new ArgumentException("Regra repassada não é válida.");
            }

            this.ID                  = Convert.ToInt32(RsDados.Fields["cod"].Value);
            this.regra               = Convert.ToString(RsDados.Fields["Regra"].Value);
            this.ICMSD               = Convert.ToDouble(RsDados.Fields["ICMSD"].Value);
            this.percentualICMS      = Convert.ToDouble(RsDados.Fields["PercentualICMS"].Value);
            this.federal             = Convert.ToDouble(RsDados.Fields["Federal"].Value);
            this.PercentualFederal   = Convert.ToDouble(RsDados.Fields["PercentualFederal"].Value);
            this.ICMSD_fora          = Convert.ToDouble(RsDados.Fields["ICMSD_fora"].Value);
            this.percentualICMS_fora = Convert.ToDouble(RsDados.Fields["PercentualICMS_fora"].Value);
            this.informativo         = Convert.ToString(RsDados.Fields["Texto"].Value);
            this.TxFixa              = (RsDados.Fields["TxFixas"].Value.Equals(DBNull.Value)) ? 0 : Convert.ToDouble(RsDados.Fields["TxFixas"].Value.ToString());
            this.CSOSN               = (RsDados.Fields["csosn"].Value.Equals(DBNull.Value)) ? "102" : RsDados.Fields["csosn"].Value.ToString();
            this.ST                  = (RsDados.Fields["ST"].Value.Equals(DBNull.Value)) ? "" : RsDados.Fields["ST"].Value.ToString();
            this.CST                 = (RsDados.Fields["CST"].Value.Equals(DBNull.Value)) ? "0" : RsDados.Fields["CST"].Value.ToString();
            this.IAT                 = (RsDados.Fields["IAT"].Value.Equals(DBNull.Value)) ? "T" : RsDados.Fields["IAT"].Value.ToString();
            this.IPPT                = (RsDados.Fields["IPPT"].Value.Equals(DBNull.Value)) ? "T" : RsDados.Fields["IPPT"].Value.ToString();
        }
예제 #15
0
        /// <summary>
        /// Get template location of the form.
        /// </summary>
        /// <param name="strParameterName"> param name in the SYS_GENERALPARAMETER table.</param>
        /// <returns></returns>
        public string GetFormTemplateLocation(string strParameterName)
        {
            string    strFilePath = "";
            Recordset rs          = null;

            try
            {
                rs = m_gTDataContext.OpenRecordset("select param_value from SYS_GENERALPARAMETER where param_name=:1", ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly,
                                                   (int)ADODB.CommandTypeEnum.adCmdText, strParameterName);


                if (rs != null && rs.RecordCount > 0)
                {
                    rs.MoveFirst();
                    strFilePath = Convert.ToString(rs.Fields["param_value"].Value);
                    return(strFilePath);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                rs.Close();
                rs = null;
            }
            return(null);
        }
예제 #16
0
        /// <summary>
        /// Method to check whether the Job is of type NON-WR.
        /// </summary>
        /// <returns>true, if job is of type NON-WR</returns>
        private bool CheckIfNonWrJob()
        {
            Recordset jobInfoRs = null;

            try
            {
                string jobType = string.Empty;
                jobInfoRs = GetRecordSet(string.Format("select G3E_JOBTYPE, G3E_JOBSTATUS from g3e_job where g3e_identifier  = '{0}'", m_dataContext.ActiveJob));
                if (jobInfoRs != null && jobInfoRs.RecordCount > 0)
                {
                    jobInfoRs.MoveFirst();
                    jobType = Convert.ToString(jobInfoRs.Fields["G3E_JOBTYPE"].Value);
                    jobType = Convert.ToString(jobInfoRs.Fields["G3E_JOBSTATUS"].Value);
                }
                return(!string.IsNullOrEmpty(jobType) && jobType.ToUpper() == "NON-WR" ? true : false);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (jobInfoRs != null)
                {
                    jobInfoRs.Close();
                }
                jobInfoRs = null;
            }
        }
 /// <summary>
 /// Method to clear out the leftover data in the form closing event. Putting it in the global object should allow it to clear out any data that we may not want.
 /// </summary>
 internal static void dispose()
 {
     try
     {
         if (fieldActivityErrorRecords != null && fieldActivityErrorRecords.State != (int)ADODB.ObjectStateEnum.adStateClosed)
         {
             fieldActivityErrorRecords.Close();
         }
         if (gtGeoEditService != null && gtGeoEditService.GeometryCount > 0)
         {
             gtGeoEditService.RemoveAllGeometries();
             gtGeoEditService = null;
         }
         if (metaDataRecords != null)
         {
             metaDataRecords.Close();
         }
         if (ColumnRules != null)
         {
             ColumnRules.Clear();
         }
         ErrorMessage = null;
     }
     catch (Exception e)
     {
         MessageBox.Show("Error in Dispose (" + e.Message + ")", "G/Technology");
     }
 }
예제 #18
0
        /// <summary>
        /// Returns the Structure ID of a feature based on its FID value
        /// </summary>
        /// <param name="FID">G3E_FID value</param>
        /// <returns>Structure ID</returns>
        private string StructureIDbyFID(int FID)
        {
            try
            {
                string retVal = string.Empty;

                IGTApplication app = GTClassFactory.Create <IGTApplication>();
                string         sql = "select structure_id from common_n where g3e_fid=?";
                Recordset      rs  = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, FID);
                if (null != rs && 1 == rs.RecordCount)
                {
                    rs.MoveFirst();
                    if (DBNull.Value != rs.Fields[0].Value)
                    {
                        retVal = rs.Fields[0].Value.ToString();
                    }
                }

                if (null != rs)
                {
                    if (rs.State != Convert.ToInt32(ObjectStateEnum.adStateClosed))
                    {
                        rs.Close();
                    }
                    rs = null;
                }

                return(retVal);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
예제 #19
0
        private void coletaDados(Int32 ID_cliente)
        {
            if (ID_cliente != 0)
            {
                SQL = "SELECT Aparelhos.Cod_cliente, Tipo_aparelho.Aparelho, Tipo_marca.Marca, OS_Entragas.Data, Aparelhos.modelo, Aparelhos.Cod " +
                      "FROM ((Aparelhos INNER JOIN Tipo_aparelho ON Aparelhos.cod_tipo = Tipo_aparelho.Cod) INNER JOIN Tipo_marca ON Aparelhos.cod_marca = Tipo_marca.Cod) INNER JOIN OS_Entragas ON Aparelhos.Cod = OS_Entragas.OS " +
                      "WHERE (((Aparelhos.Cod_cliente)=" + ID_cliente + "))ORDER BY Aparelhos.Cod DESC;";
            }
            else
            {
                SQL = "SELECT Aparelhos.Cod, Tipo_aparelho.Aparelho, Tipo_marca.Marca, Aparelhos.modelo, Aparelhos.Cod_cliente, OS_Entragas.Data " +
                      "FROM (Tipo_marca INNER JOIN (Tipo_aparelho INNER JOIN Aparelhos ON Tipo_aparelho.Cod = Aparelhos.cod_tipo) ON Tipo_marca.Cod = Aparelhos.cod_marca) LEFT JOIN OS_Entragas ON Aparelhos.Cod = OS_Entragas.Cod " +
                      "WHERE (((Aparelhos.Cod_cliente)=%)) ORDER BY Aparelhos.Cod DESC;";
            }
            listaAparelhos.Clear();
            if (RSDados.State != 0)
            {
                RSDados.Close();
            }

            RSDados.Open(SQL, new Conexao().getContas(), CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);


            while (!(RSDados.EOF || RSDados.BOF))
            {
                listaAparelhos.Add(new String[] { Convert.ToString(RSDados.Fields["cod"].Value), Convert.ToString(RSDados.Fields["Aparelho"].Value),
                                                  Convert.ToString(RSDados.Fields["Marca"].Value), Convert.ToString(RSDados.Fields["Modelo"].Value), Convert.ToString(RSDados.Fields["data"].Value) });
                RSDados.MoveNext();
            }
        }
예제 #20
0
        public bool CheckAssociatedVirtualPoint(IGTKeyObject feature, int isolationscenarioFeatureFID)
        {
            bool associated = false;

            try
            {
                String sql = "select G3E_FID,G3E_FNO from VIRTUALPT_N where ASSOCIATED_FID = ?";

                Recordset virtualRS = DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText,
                                                                isolationscenarioFeatureFID);
                if (virtualRS != null && virtualRS.RecordCount > 0)
                {
                    virtualRS.MoveFirst();

                    while (!virtualRS.EOF)
                    {
                        if (Convert.ToInt32(virtualRS.Fields["g3e_fid"].Value) == feature.FID)
                        {
                            associated = true;
                            break;
                        }
                        virtualRS.MoveNext();
                    }
                }
                virtualRS.Close();
                virtualRS = null;
            }
            catch
            {
                throw;
            }
            return(associated);
        }
예제 #21
0
 private void desconectar()
 {
     if (RSDados.State != 0)
     {
         RSDados.Close();
     }
 }
예제 #22
0
        /// <summary>
        /// Get DesignAreaKeyObject of current Job.
        /// </summary>
        /// <returns></returns>
        public IGTKeyObject GetDesignAreaKeyObject()
        {
            string    sql          = "SELECT G3E_FID FROM DESIGNAREA_P WHERE JOB_ID=:1";
            int       outRecords   = 0;
            Recordset rsDesignArea = null;

            try
            {
                rsDesignArea = m_gTDataContext.Execute(sql, out outRecords, (int)CommandTypeEnum.adCmdText, ActiveWorkRequest);

                if (rsDesignArea.RecordCount > 0)
                {
                    rsDesignArea.MoveFirst();
                    return(m_gTDataContext.OpenFeature(8100, Convert.ToInt32(rsDesignArea.Fields[0].Value)));
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                rsDesignArea.Close();
                rsDesignArea = null;
            }

            return(null);
        }
예제 #23
0
        private void SaveToCacheRs(string Key, string FullPathToSave)
        {
            CreateCacheFolder();

            string FullPathCache = GetFullPathCacheRs(Key);

            if (!File.Exists(FullPathCache))
            {
                CreateRs(FullPathCache, false);
            }

            Recordset Rs = new Recordset();

            Rs.Open(FullPathCache, Missing.Value, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockPessimistic, -1);

            string Criteria = "Key = '" + Key.Replace("'", "''") + "'";

            Rs.Find(Criteria, 0, SearchDirectionEnum.adSearchForward, Missing.Value);

            if (!Rs.EOF)
            {
                Rs.Fields["Content"].AppendChunk(CFile.GetByteFromFile(FullPathToSave));
            }
            else
            {
                Rs.AddNew(Missing.Value, Missing.Value);
                Rs.Fields["Key"].Value = Key;
                Rs.Fields["Content"].AppendChunk(CFile.GetByteFromFile(FullPathToSave));
            }

            Rs.Save(FullPathCache, PersistFormatEnum.adPersistXML);
            Rs.Close();
            Rs = null;
        }
예제 #24
0
        /// <summary>
        ///  Method to get the primary graphic cno for fno
        /// </summary>
        /// <param name="fNo"></param>
        /// <param name="Geo">true to return Geo CNO, false to return Detail CNO</param>
        /// <returns>cno or 0</returns>
        internal short GetPrimaryGraphicCno(short fNo, bool Geo)
        {
            short     primaryGraphicCno = 0;
            Recordset tempRs            = null;

            try
            {
                tempRs = gTDataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "G3E_FNO = " + fNo);

                if (tempRs != null && tempRs.RecordCount > 0)
                {
                    tempRs.MoveFirst();
                    string field = Geo ? "G3E_PRIMARYGEOGRAPHICCNO" : "G3E_PRIMARYDETAILCNO";

                    //if(System.DBNull.Value != tempRs.Fields[field].Value)
                    if (!Convert.IsDBNull(tempRs.Fields[field].Value))
                    {
                        primaryGraphicCno = Convert.ToInt16(tempRs.Fields[field].Value);
                    }
                }
                return(primaryGraphicCno);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (tempRs != null)
                {
                    tempRs.Close();
                    tempRs = null;
                }
            }
        }
예제 #25
0
        /// <summary>
        /// Returns the feature name by the FNO value
        /// </summary>
        /// <param name="FNO">G3E_FNO</param>
        /// <returns>G3E_FEATURE.G3E_USERNAME</returns>
        private string FeatureNameByFNO(short FNO)
        {
            try
            {
                string featureName = string.Empty;

                string         sql = "select g3e_username from g3e_features_optlang where g3e_fno=?";
                IGTApplication app = GTClassFactory.Create <IGTApplication>();
                Recordset      rs  = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, FNO);
                if (null != rs && 1 == rs.RecordCount)
                {
                    if (System.DBNull.Value != rs.Fields["g3e_username"].Value)
                    {
                        featureName = rs.Fields["g3e_username"].Value.ToString();
                    }
                    rs.Close();
                    rs = null;
                }

                return(featureName);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
예제 #26
0
        /// <summary>
        /// Get RateSchedule value.
        /// </summary>
        /// <param name="strRateSchedule"></param>
        /// <param name="strESILocation"></param>
        /// <returns></returns>
        private string GetRateSchedule(string strRateSchedule, string strESILocation)
        {
            string    sql        = null;
            Recordset rsValidate = null;

            try
            {
                sql        = "select RATE_SCHEDULE from STLT_ACCOUNT where ESI_LOCATION in ?";
                rsValidate = m_gTDataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly,
                                                           (int)ADODB.CommandTypeEnum.adCmdText, strESILocation);

                if (rsValidate.RecordCount > 0)
                {
                    rsValidate.MoveFirst();
                    if (!rsValidate.EOF && !rsValidate.BOF)
                    {
                        strRateSchedule = Convert.ToString(rsValidate.Fields[0].Value);
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                rsValidate.Close();
                rsValidate = null;
            }
            return(strRateSchedule);
        }
예제 #27
0
 private static void fechaConexao()
 {
     if (dados.State != 0)
     {
         dados.Close();
     }
 }
예제 #28
0
        /// <summary>
        /// Check the file name is already attached to the active job.
        /// </summary>
        /// <param name="strFilename">Html file name</param>
        /// <returns></returns>
        public bool IsExistingAttachment(string strFilename)
        {
            string    sql = "";
            Recordset rs  = null;

            try
            {
                sql = "select count(*) from JOB_HYPERLINK_N where g3e_fid=:1 and HYPERLINK_T=:2";
                rs  = m_gTDataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly,
                                                    (int)ADODB.CommandTypeEnum.adCmdText, designAreaFid, strFilename);

                if (rs != null && rs.RecordCount > 0)
                {
                    rs.MoveFirst();
                    if (Convert.ToInt32(rs.Fields[0].Value) > 0)
                    {
                        return(true);
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                rs.Close();
                rs = null;
            }

            return(false);
        }
예제 #29
0
        private KeyValueCollection ExtendedProperties(IDatabase db, string schema, string entitytype, string entity, string column)
        {
            KeyValueCollection hash = new KeyValueCollection();
            Recordset          rs   = db.ExecuteSql(
                String.Format(QUERY,
                              "'" + schema + "'",
                              "'" + entitytype + "'",
                              "'" + entity + "'",
                              ((column == null) ? "null" : "'column'"),
                              ((column == null) ? "null" : "'" + column + "'")
                              )
                );

            if (rs != null)
            {
                rs.MoveFirst();

                while (!rs.EOF && !rs.BOF)
                {
                    hash.AddKeyValue(rs.Fields["name"].Value.ToString(), rs.Fields["value"].Value.ToString());
                    rs.MoveNext();
                }
                rs.Close();
                rs = null;
            }
            return(hash);
        }
예제 #30
0
        /// <summary>
        ///  Method to get the primary graphic cno for fno
        /// </summary>
        /// <param name="fNo"></param>
        /// <returns>cno or 0</returns>
        internal short GetPrimaryGraphicCno(short fNo)
        {
            short     primaryGraphicCno = 0;
            Recordset tempRs            = null;

            try
            {
                tempRs = m_oGTDataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "G3E_FNO = " + fNo);
                if (tempRs != null && tempRs.RecordCount > 0)
                {
                    tempRs.MoveFirst();
                    primaryGraphicCno = Convert.ToInt16(tempRs.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value);
                }
                return(primaryGraphicCno);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (tempRs != null)
                {
                    tempRs.Close();
                    tempRs = null;
                }
            }
        }
예제 #31
0
파일: Produto.cs 프로젝트: Laerton2016/SIME
        /// <summary>
        /// Método que faz emparelhamento com os dados do SIME com SMALL
        /// </summary>
        public void indexar()
        {
            Recordset  rsDadosSime  = new Recordset();
            Recordset  rsDadosSmall = new Recordset();
            String     SQL1; //, SQL2;
            Connection conex1 = new Conexao().getDb4();
            //Connection conex2 = new Conexao().getSmall();
            Produto item;

            SQL1 = "SELECT PRODUTOS.* FROM PRODUTOS ORDER BY PRODUTOS.Cod;";
            //SQL2 = "SELECT ESTOQUE.* FROM ESTOQUE ORDER BY ESTOQUE.CODIGO;";

            //Procedimentos Verificar se o produto está cadastrado no Small
            //Se estiver ver se há quantidade em estoque igual a do Sime
            //Se não estiver incluir o produto
            //Se a quantidade estiver diferente fazer ajuste do Small com o sime.

            rsDadosSime.Open(SQL1, conex1, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
            //rsDadosSmall.Open(SQL2, conex2, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
            while (!(rsDadosSime.EOF || rsDadosSime.BOF))
            {
                item = new Produto(Convert.ToInt32(rsDadosSime.Fields["cod"].Value), conex1);
                item.salvarSmall();
                rsDadosSime.MoveNext();
            }
            rsDadosSime.Close();
            conex1.Close();
        }
예제 #32
0
    protected void Page_Load(object sender, EventArgs e)
    {
         conn = new Connection();
         string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
         conn.Open(connectionstring); 
      
        UserIPAddress = GetIPAddress();
        //For Demo            
        //UserIPAddress = "192.168.1.12";
        //UserIPAddress = Request.ServerVariables["REMOTE_ADDR"];
        Rs1 = new Recordset();
       sql1 = "Select * From Station s Left Join CVSUser u on ";

       sql1 = sql1 +  " s.LoginUser = u.UserName Where IPAddress ='" + UserIPAddress + "'";
        Rs1 = conn.Execute(sql1);
        StationID = (Rs1.Fields["Station"].Value).ToString().Trim();
        UserID = (Rs1.Fields["LoginUser"].Value).ToString().Trim();
        SecLevel = (Rs1.Fields["SecLevel"].Value).ToString().Trim();

        if (UserID == "")
        {
            Response.Redirect("Default.aspx");
        }
        Message = Request["Message"];
        Coupon_Number = Request["Coupon_Number"];
        Car_No = Request["Car_No"];
        Face_Value = Request["Face_Value"];
        Period = Request["Period"];
        //search by date
        if (Request["SDay"] != null)
        {
            SDay = Request["SDay"];
            SMonth = Request["SMonth"];
            SYear = Request["SYear"];
        }
        else
        {
            SDay = Convert.ToString(DateTime.Now.Day);
            SMonth = Convert.ToString(DateTime.Now.Month);
            SYear = Convert.ToString(DateTime.Now.Year);
        }
        if (Request["NDay"] != null)
        {
            NDay = Request["NDay"];
            NMonth = Request["NMonth"];
            NYear = Request["NYear"];
        }
        else
        {
            NDay = Convert.ToString(DateTime.Now.Day);
            NMonth = Convert.ToString(DateTime.Now.Month);
            NYear = Convert.ToString(DateTime.Now.Year);
        }
        //Search_Date = Formatdatetime(DateSerial(SYear, SMonth, SDay),2)
        //Search_NDate = Formatdatetime(DateSerial(NYear, NMonth, NDay),2)
        Search_Date = SDay + "/" + SMonth + "/" + SYear;
        Search_NDate = NDay + "/" + NMonth + "/" + NYear;
        //Response.write search_date
        //response.write SecLevel & "<br>"
        //response.write UserID

        if (Request.Form["pageid"] != null)
            pageid = (Request.Form["pageid"]).Trim();
        if (pageid == "")
        {
            pageid = "1";
        }
        if (Request.Form["Barcode"] != null)
        {
            Barcode = (Request.Form["Barcode"]).Trim().Replace("%", "%");
            Barcode = Barcode.Replace("'", "''");
            if (Barcode.Length == 15)
            {
                Face_Value = Barcode.Substring(0, 3);
                Coupon_Type = Barcode.Substring(5 - 1, 2);
                Coupon_batch = Barcode.Substring(7 - 1, 3);
                Coupon_Number = Barcode.Substring(10 - 1, 6);
            }
        }
        fsql = "select * from MasterCoupon where RequestedID = " + Convert.ToString(StationID);
        //Search Coupon Number
        //********************
        if (Barcode != "")
        {
            if (Barcode.Length == 15)
            {
                fsql = fsql + " and Coupon_Number = '" + Coupon_Number + "'";
                fsql = fsql + " and Face_Value = '" + Face_Value + "'";
                fsql = fsql + " and Coupon_Type = '" + Coupon_Type + "'";
                fsql = fsql + " and Coupon_Batch = '" + Coupon_batch + "'";
            }
            else
            {
                fsql = fsql + " and Coupon_Number LIKE '%" + Barcode + "%' ";
            }
        }
        fsql = fsql + " and  Present_Date >=   Convert(datetime, '" + Convert.ToString(Search_Date) + "', 105) ";
        fsql = fsql + " and  Present_Date < DATEADD(dd,DATEDIFF(dd,0, Convert(datetime, '" + Convert.ToString(Search_NDate) + "', 105)),0) + 1 ";
        //By UserID
        if (Convert.ToString(SecLevel).Trim() == "1")
        {
            fsql = fsql + " and Period = '" + Convert.ToString(UserID) + "' ";
        }
        fsql = fsql + " order by id desc";
        frs = new Recordset();
        frs.CursorType = (nce.adodb.CursorType)1;
        frs.LockType = (nce.adodb.LockType)1;
        Rs1.Close();
        frs.Open(fsql, conn);       
    }