Exemplo n.º 1
0
 => Connect(connString, conn
            => ExecuteQuery(Procedures.GetUnvisited, conn, reader
                            => (
                                Id: reader.GetInt32(0),
                                ProjectId: reader.GetInt32(1),
                                Link: reader.GetString(2)
                                )));
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //int totalNumberOfWorkItems = 459;
            //int maxWorkItemPerQuery = 200;

            //int amountGroups = totalNumberOfWorkItems / maxWorkItemPerQuery;
            //int modulus = totalNumberOfWorkItems % maxWorkItemPerQuery;

            //List<int> breakdownList = new List<int>();
            //for (int i = 0; i < amountGroups; i++)
            //{
            //    breakdownList.Add(maxWorkItemPerQuery);
            //}

            //if (modulus > 0)
            //{
            //    breakdownList.Add(modulus);
            //}

            //Console.WriteLine("{0}: {1}", totalNumberOfWorkItems.ToString(), String.Join(", ", breakdownList));
            //Console.WriteLine(breakdownList.Count.ToString());
            //Console.ReadKey();

            ExecuteQuery newQuery = new ExecuteQuery();

            newQuery.RunGetBugsQueryUsingClientLib();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get Exempt Tax Code
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="AD_Org_ID">org to find client</param>
        /// <returns>C_Tax_ID</returns>
        private static int GetExemptTax(Ctx ctx, int AD_Org_ID)
        {
            int    C_Tax_ID = 0;
            String sql      = "SELECT t.C_Tax_ID "
                              + "FROM C_Tax t"
                              + " INNER JOIN AD_Org o ON (t.AD_Client_ID=o.AD_Client_ID) "
                              + "WHERE t.IsTaxExempt='Y' AND o.AD_Org_ID= " + AD_Org_ID
                              + "ORDER BY t.Rate DESC";
            bool found = false;

            try
            {
                DataSet pstmt = ExecuteQuery.ExecuteDataset(sql, null);
                for (int i = 0; i < pstmt.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = pstmt.Tables[0].Rows[i];
                    C_Tax_ID = Utility.Util.GetValueOfInt(dr[0]);
                    found    = true;
                }
            }
            catch (Exception e)
            {
                log.Log(Level.SEVERE, sql, e);
            }
            log.Fine("TaxExempt=Y - C_Tax_ID=" + C_Tax_ID);
            if (C_Tax_ID == 0)
            {
                log.SaveError("TaxCriteriaNotFound", Msg.GetMsg(ctx, "TaxNoExemptFound")
                              + (found ? "" : " (Tax/Org=" + AD_Org_ID + " not found)"));
            }
            return(C_Tax_ID);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns the user's game library using his email
        /// </summary>
        /// <param name="email">the user's email</param>
        /// <returns>List of game id's in his library (string)</sreturns>
        public static DataTable GetGameLibrary(string email)
        {
            int userID = UserManager.GetUserID(email);
            string getUserLibraryQuery = @"SELECT [idGame] FROM Library WHERE [idUser] = " + userID;
            string getPlatformIdQuery = @"SELECT idPlatform from Library WHERE [idUser] = " + userID;
            List<string> platformList = new List<string>();
            foreach (string platformID in ExecuteQuery.Select(getPlatformIdQuery))
            {
                platformList.Add(ExecuteQuery.Select("SELECT Name From Platforms where idPlatform = " + int.Parse(platformID))[0]);
            }

            List<string> gameList = new List<string>();
            foreach (string gameID in ExecuteQuery.Select(getUserLibraryQuery))
            {
                string getGameTitleLibraryQuery = @"SELECT [title] FROM [games] WHERE [idGame] = " + Int32.Parse(gameID);
                gameList.Add(ExecuteQuery.Select(getGameTitleLibraryQuery)[0]);
            }

            DataTable dt = new DataTable();
            dt.Clear();
            dt.Columns.Add("Title");
            dt.Columns.Add("Platform");
            for(int i = 0; i < gameList.Count; i++)
            {
                DataRow _ravi = dt.NewRow();
                _ravi["Title"] = gameList[i];
                _ravi["Platform"] = platformList[i];
                dt.Rows.Add(_ravi);
            }
            
            return dt;
        }
 public DataTable GetEmployee()
 {
     using (ExecuteQuery da = new ExecuteQuery())
     {
         return(da.GetDataTableFromQuery("select * from Person.Person"));
     }
 }
        public bool CreateDevice()
        {
            String currentPath = this.GetType().Assembly.Location;

            String folderPath = currentPath.Substring(0, currentPath.LastIndexOf("\\"));

            DirectoryInfo directoryInfo = null;

            if (!Directory.Exists($"{folderPath}\\BackupFiles\\{CurrentDataBase.Name}"))
            {
                directoryInfo = Directory.CreateDirectory($"{folderPath}\\BackupFiles\\{CurrentDataBase.Name}");
            }

            if (directoryInfo == null)
            {
                QueryStrings.CurrentPathDevice = $"{folderPath}\\BackupFiles\\{CurrentDataBase.Name}\\{CurrentDataBase.Name}.bak";
            }
            else
            {
                QueryStrings.CurrentPathDevice = $"{directoryInfo.FullName}\\{CurrentDataBase.Name}.bak";
            }

            IEnumerable <Boolean> result = ExecuteQuery <Boolean> .Execute(ConnectionInfo, QueryStrings.CreateDevice, (sqlDataReader) => {
                return(SqlSupport.Read <Boolean>(sqlDataReader, ""));
            });

            this.CurrentDataBase = _currentDB;

            return(result.FirstOrDefault());
        }
Exemplo n.º 7
0
        /// <summary>
        /// Set Base Info (UOM)
        /// </summary>
        private void SetBaseInfo()
        {
            if (_M_Product_ID == 0)
            {
                return;
            }
            //
            String      sql = "SELECT C_UOM_ID, M_Product_Category_ID FROM M_Product WHERE M_Product_ID=" + _M_Product_ID;
            IDataReader dr  = null;

            try
            {
                dr = ExecuteQuery.ExecuteReader(sql, null);
                if (dr.Read())
                {
                    _C_UOM_ID = Utility.Util.GetValueOfInt(dr[0]);              //.getInt(1);
                    _M_Product_Category_ID = Utility.Util.GetValueOfInt(dr[1]); //.getInt(2);
                }
                dr.Close();
            }
            catch (Exception e)
            {
                if (dr != null)
                {
                    dr.Close();
                }
                log.Log(Level.SEVERE, sql, e);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool HasRole()
        {
            if (_roles != null && _roles.Length > 0)
            {
                return(true);
            }

            int    roleCount = 0;
            String sql       = "SELECT COUNT(*) FROM AD_User_Roles ur "
                               + "WHERE ur.AD_User_ID=@userid AND ur.IsActive='Y'";

            SqlParameter[] param = new SqlParameter[1];
            IDataReader    idr   = null;

            try
            {
                param[0] = new SqlParameter("@userid", GetAD_User_ID());
                idr      = ExecuteQuery.ExecuteReader(sql, param);
                while (idr.Read())
                {
                    roleCount = idr[0].ToString() == "" ? 0 : Utility.Util.GetValueOfInt(idr[0].ToString());
                }
                idr.Close();
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, sql, e);
            }
            return(roleCount != 0);
        }
Exemplo n.º 9
0
        /// <summary>
        /// check if selected node is TreeMaintenance node
        /// </summary>
        /// <param name="Node_Id">selected node id</param>
        /// <returns></returns>
        public int CheckMaintenenceNode(int Node_Id)
        {
            string sqlCmd = "select count(AD_Menu_Id) from AD_Menu where AD_Form_Id in " +
                            "(select AD_Form_Id from AD_Form where ClassName='org.compiere.Apps.form.VTreeMaintenance') and AD_Menu_id=" + Node_Id;

            return(int.Parse(ExecuteQuery.ExecuteScalar(sqlCmd)));
        }
Exemplo n.º 10
0
        public Store.Common.MessageInfo ManageStock(Store.Stock.BusinessObject.Stock objstock, CommandMode cmdMode)
        {
            string          SQL       = "";
            ParameterList   paramList = new ParameterList();
            DataTableReader dr;

            Store.Common.MessageInfo objMessageInfo = null;
            try
            {
                SQL = "USP_ManageStock";
                paramList.Add(new SQLParameter("@StockID", objstock.StockID));
                paramList.Add(new SQLParameter("@ItemID", objstock.ItemID));
                paramList.Add(new SQLParameter("@StockQuantity", objstock.StockQuantity));
                paramList.Add(new SQLParameter("@CMDMode", cmdMode));
                dr = ExecuteQuery.ExecuteReader(SQL, paramList);
                if (dr.Read())
                {
                    objMessageInfo              = new Store.Common.MessageInfo();
                    objMessageInfo.ErrorCode    = Convert.ToInt32(dr["ErrorCode"]);
                    objMessageInfo.ErrorMessage = Convert.ToString(dr["ErrorMessage"]);
                    objMessageInfo.TranID       = Convert.ToInt32(dr["TranID"]);
                    objMessageInfo.TranCode     = Convert.ToString(dr["TranCode"]);
                    objMessageInfo.TranMessage  = Convert.ToString(dr["TranMessage"]);
                }
            }
            catch (Exception ex)
            {
                Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(Stock).FullName, 1);
            }
            return(objMessageInfo);
        }
Exemplo n.º 11
0
        /// <summary>
        /// delete nodes in tree
        /// </summary>
        /// <returns></returns>
        public void ActionDelete(bool IsDeleteAll)
        {
            StringBuilder sqlCmd = new StringBuilder("delete from");

            //check tree type
            if (_TreeType == "MM")
            {
                sqlCmd.Append(" AD_TREENODEMM ");
            }
            else if (_TreeType == "OO")
            {
                sqlCmd.Append(" AD_TREENODE ");
            }

            sqlCmd.Append("where Ad_Tree_Id=" + _AD_Tree_Id + "");

            //if tree type is MM then dont delete TreeMaintainence  node
            if (_TreeType == "MM")
            {
                sqlCmd.Append(" and Node_Id not in " +
                              "(select AD_Menu_Id from AD_Menu where AD_Form_Id in " +
                              "(select AD_Form_Id from AD_Form where ClassName='org.compiere.Apps.form.VTreeMaintenance'))");
            }
            //if request is to delete a particular row
            if (!IsDeleteAll)
            {
                sqlCmd.Append(" and Node_Id=" + nodeId + "");
            }

            ExecuteQuery.ExecuteNonQuery(sqlCmd.ToString());
        }
Exemplo n.º 12
0
        /// <summary>
        /// Tries to login a new user in the database.
        /// </summary>
        /// <param name="user">the user structure, it containe email, password and rePassword</param>
        /// <returns>true if success</returns>
        public static bool LoginRequest(User user)
        {
            if (user.username == "" || user.password == "")
            {
                throw new EmptyFieldException();
            }
            string testLoginQuery = @"SELECT [Password] FROM [users] WHERE [email] = '" + user.username + "'";

            try
            {
                List <string> queryResult = new List <string>();
                queryResult = ExecuteQuery.Select(testLoginQuery);
                if (queryResult.Count == 1)
                {
                    string hashedPassword = queryResult[0];

                    if (crypto.Verify(user.password, hashedPassword))
                    {
                        return(true);
                    }
                    throw new WrongPasswordException();
                }
                throw new UserDoesntExistException();
            }
            catch (SQLiteException)
            {
                throw new LoginRegisterException("Please register first");
            }
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            var test = new ExecuteQuery();


            var result = test.RunGetBugsQueryUsingClientLib().Result;
        }
Exemplo n.º 14
0
        /// <summary>
        /// Get login client trees with type MM and OO
        /// </summary>
        /// <returns>DataSet</returns>
        public DataSet GetClientTrees()
        {
            //string sqlCmd = "select Name,AD_Tree_Id +'|'+treetype+'|'+IsAllNodes as AD_Tree_Id from Ad_Tree where AD_Client_Id="+ctx.GetAD_Client_ID()+" and TreeType in('MM','OO') order by Name";
            string sqlCmd = "select Name,AD_Tree_Id ||'|'||treetype || '|'||IsAllNodes as AD_Tree_Id from Ad_Tree where AD_Client_Id=" + ctx.GetAD_Client_ID() + " and TreeType in('MM','OO') order by Name";

            return(ExecuteQuery.ExecuteDataset(sqlCmd));
        }
Exemplo n.º 15
0
        public Store.TypeOfVendor.BusinessObject.TypeOfVendorList GetAllTypeOfVendorList(int TypeofVendorID, int Flag, string FlagValue)
        {
            Store.TypeOfVendor.BusinessObject.TypeOfVendorList objTypeOfVendorList = new BusinessObject.TypeOfVendorList();
            Store.TypeOfVendor.BusinessObject.TypeOfVendor     objTypeOfVendor     = new BusinessObject.TypeOfVendor();
            string          SQL       = string.Empty;
            ParameterList   paramList = new ParameterList();
            DataTableReader dr;

            try
            {
                SQL = "proc_TypeOfVendor";
                paramList.Add(new SQLParameter("@TypeofVendorID", TypeofVendorID));
                paramList.Add(new SQLParameter("@Flag", Flag));
                paramList.Add(new SQLParameter("@FlagValue", Flag));
                dr = ExecuteQuery.ExecuteReader(SQL, paramList);
                while (dr.Read())
                {
                    objTypeOfVendor = new BusinessObject.TypeOfVendor();
                    if (dr.IsDBNull(dr.GetOrdinal("TypeofVendorID")) == false)
                    {
                        objTypeOfVendor.TypeofVendorID = dr.GetInt32(dr.GetOrdinal("TypeofVendorID"));
                    }
                    if ((dr.IsDBNull(dr.GetOrdinal("TypeofVendorName")) == false))
                    {
                        objTypeOfVendor.TypeofVendorName = dr.GetString(dr.GetOrdinal("TypeofVendorName"));
                    }
                    if ((dr.IsDBNull(dr.GetOrdinal("ClientID")) == false))
                    {
                        objTypeOfVendor.ClientID = dr.GetInt32(dr.GetOrdinal("ClientID"));
                    }
                    if ((dr.IsDBNull(dr.GetOrdinal("CreatedOn")) == false))
                    {
                        objTypeOfVendor.CreatedOn = dr.GetDateTime(dr.GetOrdinal("CreatedOn"));
                    }
                    if ((dr.IsDBNull(dr.GetOrdinal("CreatedBy")) == false))
                    {
                        objTypeOfVendor.CreatedBy = dr.GetInt32(dr.GetOrdinal("CreatedBy"));
                    }
                    if ((dr.IsDBNull(dr.GetOrdinal("ModifiedBy")) == false))
                    {
                        objTypeOfVendor.ModifiedBy = dr.GetInt32(dr.GetOrdinal("ModifiedBy"));
                    }
                    if ((dr.IsDBNull(dr.GetOrdinal("ModifiedOn")) == false))
                    {
                        objTypeOfVendor.ModifiedOn = dr.GetDateTime(dr.GetOrdinal("ModifiedOn"));
                    }
                    if ((dr.IsDBNull(dr.GetOrdinal("ReferenceID")) == false))
                    {
                        objTypeOfVendor.ReferenceID = dr.GetInt32(dr.GetOrdinal("ReferenceID"));;
                    }
                    objTypeOfVendorList.Add(objTypeOfVendor);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(TypeOfVendor).FullName, 1);
            }
            return(objTypeOfVendorList);
        }
Exemplo n.º 16
0
        }       //	getColumns

        /**
         * Get the MColumn
         * @param sql
         * @return list of columns
         */
        private List <MColumn> GetCols(string sql)
        {
            List <MColumn> list = new List <MColumn>();

            try
            {
                SqlParameter[] param = new SqlParameter[1];
                param[0] = new SqlParameter("@AD_Table_Id", GetAD_Table_ID());
                DataSet ds = ExecuteQuery.ExecuteDataset(sql, param);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    list.Add(new MColumn(GetCtx(), dr, Get_TrxName()));
                }
                ds = null;
            }
            catch (Exception e)
            {
                log.Log(Level.SEVERE, sql, e);
            }
            //try
            //{
            //    if (pstmt != null)
            //        pstmt.close();
            //    pstmt = null;
            //}
            //catch (Exception e)
            //{
            //    pstmt = null;
            //}

            return(list);
        }  // getColumns()
Exemplo n.º 17
0
        public Store.Common.MessageInfo ManageItemPrice(Store.ItemPrice.BusinessObject.ItemPrice objItemPrice, CommandMode cmdMode)
        {
            string          SQL   = "";
            ParameterList   param = new ParameterList();
            DataTableReader dr;

            Store.Common.MessageInfo objMessageInfo = null;
            try
            {
                SQL = "USP_ManageItemPrice";

                param.Add(new SQLParameter("@ItemPriceID", objItemPrice.ItemPriceID));
                param.Add(new SQLParameter("@ItemSalePricePerUnit", objItemPrice.ItemSalePricePerUnit));
                param.Add(new SQLParameter("@ItemDiscountPercentagePerUnit", objItemPrice.ItemDiscountPercentagePerUnit));
                param.Add(new SQLParameter("@ApplicableFrom", objItemPrice.ApplicableFrom));
                param.Add(new SQLParameter("@ApplicableTo", objItemPrice.ApplicableTo));
                param.Add(new SQLParameter("@CMDMode", cmdMode));
                dr = ExecuteQuery.ExecuteReader(SQL, param);
                if (dr.Read())
                {
                    objMessageInfo              = new Store.Common.MessageInfo();
                    objMessageInfo.ErrorCode    = Convert.ToInt32(dr["ErrorCode"]);
                    objMessageInfo.ErrorMessage = Convert.ToString(dr["ErrorMessage"]);
                    objMessageInfo.TranID       = Convert.ToInt32(dr["TranID"]);
                    objMessageInfo.TranCode     = Convert.ToString(dr["TranCode"]);
                    objMessageInfo.TranMessage  = Convert.ToString(dr["TranMessage"]);
                }
            }
            catch (Exception ex)
            {
                Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(ItemPrice).FullName, 1);
            }
            return(objMessageInfo);
        }
Exemplo n.º 18
0
        private async Task ExecuteAndVerify(ExecuteQuery runQuery, MockContext ctx, string workspaceId = DefaultWorkspaceId, string apiKey = DefaultApiKey)
        {
            var client = GetClient(ctx, workspaceId, apiKey);

            client.Preferences.IncludeStatistics = true;
            client.Preferences.IncludeRender     = true;

            client.WorkspaceId = workspaceId;

            var response = await runQuery.Invoke(client);

            Assert.Equal(System.Net.HttpStatusCode.OK, response.Response.StatusCode);
            Assert.Equal("OK", response.Response.ReasonPhrase);
            Assert.True(response.Body.Tables.Count > 0, "Table count isn't greater than 0");
            Assert.False(String.IsNullOrWhiteSpace(response.Body.Tables[0].Name), "Table name was null/empty");
            Assert.True(response.Body.Tables[0].Columns.Count > 1, "Column count isn't greater than 1");
            Assert.True(response.Body.Tables[0].Rows.Count > 1, "Row count isn't greater than 1");

            var resultArray = response.Body.Tables[0].Rows;

            Assert.NotNull(resultArray);
            Assert.Equal(TakeCount, resultArray.Count);

            Assert.NotNull(response.Body.Statistics);
            Assert.NotNull(response.Body.Render);
        }
Exemplo n.º 19
0
        public void ThenIWriteResultsFromTableIntoCSVFile(string tableName)
        {
            string query = String.Format(ComparisonSqls.Products, tableName);

            Console.WriteLine("PATH " + CMD.CMDTargetFolderPath + "\\" + CMD.CurrentFileName + ".csv");
            ExecuteQuery.WriteQueryResultToFile(query, CMD.CMDTargetFolderPath + "\\" + CMD.CurrentFileName + ".csv");
        }
Exemplo n.º 20
0
        /// <summary>
        /// Gets the user ID using his email
        /// </summary>
        /// <param name="email">User's email</param>
        /// <returns>int32 User ID</returns>
        public static int GetUserID(string email)
        {
            string        getUserIdQuery = @"SELECT [idUser] FROM [Users] WHERE [Email] = '" + email + "'";
            List <string> userIDString   = ExecuteQuery.Select(getUserIdQuery);

            return(int.Parse(userIDString[0]));
        }
Exemplo n.º 21
0
        /// <summary>
        /// Tries to register a new user in the database.
        /// </summary>
        /// <param name="user">the user structure, it containe email, password and rePassword</param>
        /// <returns>true if success</returns>
        public static bool RegisterRequest(User user)
        {
            LoginRegisterLib lib = new LoginRegisterLib();

            if (user.username == "" || user.password == "" || user.rePassword == "")
            {
                throw new EmptyFieldException();
            }
            if (lib.ValidMail(user.username))
            {
                if (user.password == user.rePassword)
                {
                    string registerQuery = @"INSERT INTO [Users] (Email, Password) VALUES ('" + user.username + "', '" + crypto.Hash(user.password) + "')";
                    try
                    {
                        ExecuteQuery.Insert(registerQuery);
                        return(true);
                    }
                    catch
                    {
                        throw new UserAldreadyExistsException();
                    }
                }
                throw new PasswordDontMatchException();
            }
            throw new NotValidEmailException();
        }
        public bool RestoreBDByTime(DateTime dateTimeRestore)
        {
            QueryStrings.CurrentPathDevice = ExecuteQuery <String> .Execute(ConnectionInfo, QueryStrings.GetDevicePath, (sqlDataReader) =>
            {
                return(SqlSupport.Read <String>(sqlDataReader, "physical_name"));
            }).FirstOrDefault();


            QueryStrings.ThirdRestoreDBByTime = dateTimeRestore.ToString("yyyy-MM-dd HH:mm:ss");

            try
            {
                ExecuteQuery <int> .ExecuteNonQuery(ConnectionInfo, QueryStrings.FirstRestoreDbByTime);

                ExecuteQuery <int> .Execute(ConnectionInfo, QueryStrings.SecondRestoreDBByTime, null);

                ExecuteQuery <int> .ExecuteNonQuery(ConnectionInfo, QueryStrings.ThirdRestoreDBByTime);

                ExecuteQuery <int> .ExecuteNonQuery(ConnectionInfo, QueryStrings.LastRestoreDBByTime);

                return(true);
            }
            catch (SqlException sqlEx)
            {
                return(false);
            }
        }
        /// <summary>
        /// 页面大小失去焦点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PageSizeTextBoxTool_AfterToolExitEditMode(object sender, AfterToolExitEditModeEventArgs e)
        {
            if (!SysConst.EN_PAGESIZE.Equals(e.Tool.Key))
            {
                return;
            }
            string strValue    = ((TextBoxTool)(e.Tool)).Text.Trim();
            int    tmpPageSize = 0;

            if (!int.TryParse(strValue, out tmpPageSize) || tmpPageSize == 0)
            {
                ((TextBoxTool)(e.Tool)).Text = SysConst.DEFAULT_PAGESIZE.ToString();
                return;
            }
            if (tmpPageSize > SysConst.MAX_PAGESIZE)
            {
                ((TextBoxTool)(e.Tool)).Text = SysConst.MAX_PAGESIZE.ToString();
                return;
            }

            if (tabControlFull.Tabs[SysConst.EN_LIST].Selected)
            {
                PageSize = tmpPageSize;
            }
            else
            {
            }

            ExecuteQuery?.Invoke();
        }
Exemplo n.º 24
0
        private void submitBtn_Click(object sender, EventArgs e)
        {
            ExecuteQuery c = new ExecuteQuery();

            c.addCall(Date.Text, Time.Text, callerName.Text, callerPhone.Text, callerCompany.Text, askingFor.Text, "Testing details", branch.Text);
            f.dashboard1.Visible = true;
            resetFields();
        }
Exemplo n.º 25
0
 /// <summary>
 /// 尾页
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LastPageButton_Click(object sender, RoutedEventArgs e)
 {
     if (CurrentPage < TotalPage)
     {
         CurrentPage = TotalPage;
         ExecuteQuery?.Invoke(CountPerPage * (CurrentPage - 1), CountPerPage);
     }
 }
Exemplo n.º 26
0
 /// <summary>
 /// 前一页
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PreviousPageButton_Click(object sender, RoutedEventArgs e)
 {
     if (CurrentPage > 1)
     {
         CurrentPage--;
         ExecuteQuery?.Invoke(CountPerPage * (CurrentPage - 1), CountPerPage);
     }
 }
Exemplo n.º 27
0
        public void ThenIWriteResultsFromFileIntoIntoExcelFileUsingExampleQuery(string tableName)
        {
            string query = String.Format(ComparisonSqls.Products, tableName);
            var    data  = ExecuteQuery.GetExplicitReults(query);

            Console.WriteLine("Query: " + query);
            ExcelWriter.WriteDataTableToXLS(data, CMD.CMDTargetFolderPath + "\\" + CMD.CurrentFileName);
        }
Exemplo n.º 28
0
        static void Main(string[] args)
        {
            var e     = new ExecuteQuery();
            var query = e.RunGetBugsQueryUsingClientLib();

            Console.WriteLine(query);
            Console.ReadKey();
        }
Exemplo n.º 29
0
        public Store.State.BusinessObject.State GetAllState(int StateID, int Flag, string FlagValue)
        {
            Store.State.BusinessObject.State objState = null;
            string          SQL       = string.Empty;
            ParameterList   paramList = new ParameterList();
            DataTableReader dr;

            try
            {
                SQL = "";
                paramList.Add(new SQLParameter("@StateID", StateID));
                paramList.Add(new SQLParameter("@Flag", Flag));
                paramList.Add(new SQLParameter("@FlagValue", FlagValue));
                dr = ExecuteQuery.ExecuteReader(SQL, paramList);
                while (dr.Read())
                {
                    if (dr.IsDBNull(dr.GetOrdinal("StateID")) == false)
                    {
                        objState.StateID = dr.GetInt32(dr.GetOrdinal("StateID"));
                    }
                    if (dr.IsDBNull(dr.GetOrdinal("StateName")) == false)
                    {
                        objState.StateName = dr.GetString(dr.GetOrdinal("StateName"));
                    }
                    if (dr.IsDBNull(dr.GetOrdinal("CountryID")) == false)
                    {
                        objState.CountryID = dr.GetInt32(dr.GetOrdinal("CountryID"));
                    }
                    if (dr.IsDBNull(dr.GetOrdinal("CreatedBy")) == false)
                    {
                        objState.CreatedBy = dr.GetInt32(dr.GetOrdinal("CreatedBy"));
                    }
                    if (dr.IsDBNull(dr.GetOrdinal("CreatedOn")) == false)
                    {
                        objState.CreatedOn = dr.GetDateTime(dr.GetOrdinal("CreatedOn"));
                    }
                    if (dr.IsDBNull(dr.GetOrdinal("ModifiedBy")) == false)
                    {
                        objState.ModifiedBy = dr.GetInt32(dr.GetOrdinal("ModifiedBy"));
                    }
                    if (dr.IsDBNull(dr.GetOrdinal("ModifiedOn")) == false)
                    {
                        objState.ModifiedOn = dr.GetDateTime(dr.GetOrdinal("ModifiedOn"));
                    }
                    if (dr.IsDBNull(dr.GetOrdinal("ReferenceID")) == false)
                    {
                        objState.ReferenceID = dr.GetInt32(dr.GetOrdinal("ReferenceID"));
                    }
                }
                dr.Close();
                return(objState);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 30
0
        public void GetDataMethodReturnNotNull()
        {
            using (ExecuteQuery da = new ExecuteQuery())
            {
                DataTable dt = da.GetDataTableFromQuery("select * from Person.Person");

                Assert.IsNotNull(dt);
            }
        }
Exemplo n.º 31
0
        public bool Init()
        {
            this.text_box.KeyDown += new System.Windows.Forms.KeyEventHandler
                (this.KeyDownHandler);

            if (this.mode == Mode.New)
            {
                EnsureQueryFilePathExists();
            }
            else if (this.mode == Mode.Existing)
            {
                this.QueryFilePath = this.OpenFileDialog();
                EnsureQueryFilePathExists();
            }
            else if (this.mode == Mode.Last)
            {
                this.QueryFilePath = Program.MongoXMLManager.LastFilePath;
                EnsureQueryFilePathExists();
            }

            //form tile
            this.Text = this.QueryFilePath;
            this.text_box.Text = FileManager.ReadFromFile(this.QueryFilePath);

            //resize window
            this.WindowState = FormWindowState.Maximized;
            this.Show();

            SetQueryOutputDisplayType();

            _executeQuery = new ExecuteQuery(this);

            return true;
        }