/// <summary>
        /// Search function by department ID and Namne
        /// </summary>
        /// <param name="DepartmentID"></param>
        /// <param name="SearchText"></param>
        /// <param name="TenantID"></param>
        /// <returns></returns>
        public List <StoreFunctionModel> SearchStoreFunctionByDepartment(int departmentID, string SearchText, int tenantID)
        {
            DataSet      ds  = new DataSet();
            MySqlCommand cmd = new MySqlCommand();
            List <StoreFunctionModel> funcationMasters = new List <StoreFunctionModel>();

            try
            {
                conn.Open();
                cmd.Connection = conn;
                MySqlCommand cmd1 = new MySqlCommand("SP_SearchFunctionByDepartmentId", conn);
                cmd1.CommandType = CommandType.StoredProcedure;
                cmd1.Parameters.AddWithValue("@Department_ID", departmentID);
                cmd1.Parameters.AddWithValue("@FuncText", string.IsNullOrEmpty(SearchText) ? "" : SearchText.ToLower());
                cmd1.Parameters.AddWithValue("@Tenant_ID", tenantID);
                MySqlDataAdapter da = new MySqlDataAdapter();
                da.SelectCommand = cmd1;
                da.Fill(ds);
                if (ds != null && ds.Tables[0] != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        StoreFunctionModel function = new StoreFunctionModel();
                        function.FunctionID    = Convert.ToInt32(ds.Tables[0].Rows[i]["FunctionID"]);
                        function.FuncationName = Convert.ToString(ds.Tables[0].Rows[i]["FuncationName"]);
                        function.DepartmentID  = departmentID;
                        function.TenantID      = tenantID;
                        funcationMasters.Add(function);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }

                if (ds != null)
                {
                    ds.Dispose();
                }
            }
            return(funcationMasters);
        }
Пример #2
0
        public List <StoreFunctionModel> GetStoreFunctionList(int TenantID, int UserID)
        {
            DataSet      ds  = new DataSet();
            MySqlCommand cmd = new MySqlCommand();
            List <StoreFunctionModel> users = new List <StoreFunctionModel>();

            try
            {
                conn.Open();
                cmd.Connection = conn;
                MySqlCommand cmd1 = new MySqlCommand("SP_GetStoreUserFullName", conn);
                cmd1.CommandType = CommandType.StoredProcedure;
                cmd1.Parameters.AddWithValue("@Tenant_ID", TenantID);
                cmd1.Parameters.AddWithValue("@User_ID", UserID);
                MySqlDataAdapter da = new MySqlDataAdapter();
                da.SelectCommand = cmd1;
                da.Fill(ds);
                if (ds != null && ds.Tables[0] != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        StoreFunctionModel user = new StoreFunctionModel();
                        user.FunctionID    = Convert.ToInt32(ds.Tables[0].Rows[i]["UserID"]);
                        user.FuncationName = Convert.ToString(ds.Tables[0].Rows[i]["FullName"]);
                        user.IsActive      = Convert.ToBoolean(ds.Tables[0].Rows[i]["IsActive"]);

                        users.Add(user);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

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

            return(users);
        }
        /// <summary>
        /// Get Function By multiple DepartmentIDs
        /// </summary>
        /// <param name="DepartmentID"></param>
        /// <returns></returns>
        public List <StoreFunctionModel> GetStoreFunctionbyMultiDepartment(string DepartmentIds, int TenantID)
        {
            DataSet      ds  = new DataSet();
            MySqlCommand cmd = new MySqlCommand();
            List <StoreFunctionModel> funcationMasters = new List <StoreFunctionModel>();

            try
            {
                conn.Open();
                cmd.Connection = conn;
                MySqlCommand cmd1 = new MySqlCommand("SP_getFunctionByMultipleDepartmentId", conn);
                cmd1.CommandType = CommandType.StoredProcedure;
                cmd1.Parameters.AddWithValue("@Department_ID", string.IsNullOrEmpty(DepartmentIds) ? "": DepartmentIds.TrimEnd(','));
                cmd1.Parameters.AddWithValue("@Tenant_ID", TenantID);
                MySqlDataAdapter da = new MySqlDataAdapter();
                da.SelectCommand = cmd1;
                da.Fill(ds);
                if (ds != null && ds.Tables[0] != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        StoreFunctionModel function = new StoreFunctionModel();
                        function.FunctionID    = Convert.ToInt32(ds.Tables[0].Rows[i]["FunctionID"]);
                        function.FuncationName = Convert.ToString(ds.Tables[0].Rows[i]["FuncationName"]);
                        funcationMasters.Add(function);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
            return(funcationMasters);
        }